Hi,

I am using the ortho -1,-1,1,1 and use the numbers between -1 and 1.

I can change my drawing to using integer values. What is faster to work with opengl: integer values or double values?

Thank’s

Alexei

Hi,

I am using the ortho -1,-1,1,1 and use the numbers between -1 and 1.

I can change my drawing to using integer values. What is faster to work with opengl: integer values or double values?

Thank’s

Alexei

The Ortho function is expecting doubles. And generally, it is faster to use floating points than integers.

Hi,

My teacher in the univer. told me that the integers are fater than float point numbers. But I need to know he is right or not?

Thank’s

Alexei

Rencent hardware of graphic cards generally compute floating point faster than integers. This is true for all vertex attributes (vertex positions, normals, texture coordinates…). But this is generally false for the index arrays of elements. This turns out because attributes are generally floating points (for best precision and ease) and they are millions of them in use during an application.

What you teacher is saying is really logical. For a cpu (not a gpu) it is faster to add, multiply… two integers because this is an operation directly on all the bits representing the values. But for floating points, you must do other calculations (mantisse and exponent).

Also, on some C/C++ compilers (generally old ones) plain integers are 16 bits whereas float are 32 bits and double are 64 bits. Calculations, and then also memory manipulation is then faster for those integers. However on recent compilers (like the GNU C compiler), int is 4 bytes, so 32 bits.

Hope that helps.

Originally posted by jide:

What you teacher is saying is really logical. For a cpu (not a gpu) it is faster to add, multiply… two integers because this is an operation directly on all the bits representing the values. But for floating points, you must do other calculations (mantisse and exponent).

This isnt entirely true, older Pentium 4 CPUs (Willamette & Northwood core) actually used the floating point multiplier unit to multiply integers (imul) including the required conversion steps.

Nowadays you simply cant say integers are faster then floats (or vice versa) because it highly depends on the underlying technology you are talking about.

Just as a confirmation, I also heard floating point to be faster than integers even on CPUs.

I must say however, I was not able to proof this myself. My CPU is probably too old to show this behaviour.

Hi,

Thank’s

Alexei

Originally posted by <Whocares>:

[b] [quote]Originally posted by jide:

What you teacher is saying is really logical. For a cpu (not a gpu) it is faster to add, multiply… two integers because this is an operation directly on all the bits representing the values. But for floating points, you must do other calculations (mantisse and exponent).

This isnt entirely true, older Pentium 4 CPUs (Willamette & Northwood core) actually used the floating point multiplier unit to multiply integers (imul) including the required conversion steps.

Nowadays you simply cant say integers are faster then floats (or vice versa) because it highly depends on the underlying technology you are talking about.[/b][/QUOTE]This doesn’t mean FPU implies that float computations and memory management is faster than integers. This accelerates things, that’s all what we can say.