View Full Version : opengl texture coordinates values
Lowercase
08-03-2010, 03:00 PM
Another stupid question for you gurus :-[
using delphi, I use this instruction : gltexcoord2f(111/128, 21/128)
Despite to the fact values "111/128" and "21/128" are constants, are they evaluated every frame or only at build time ?
thanks
Brainer
08-03-2010, 05:05 PM
If they are constants, they are calculated only once. But if not, they are every frame.
Lowercase
08-03-2010, 06:10 PM
well that was my question.. I Wasn't so clear.
in my mind "111/128" is constant, since the value never change.
So, how does the compiler evaluate "111/128" ?
In other words, what is stored at compilation time, is it 111/128 or 0.8671875 ?
I use fractions to store texture coordinates, because it's more expressive to me (retrieve coordinate faster).
I feel my app is very slow, that let me think that for every value, there is a division slowing the rendering process.
VilleK
08-03-2010, 08:35 PM
At compile time the compiler calculates the constant expression. So typing "111/128" or "0.8671875" will generate identical code. In other words there are no run-time penalties for using a constant expression.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.