Meaning of: GLfixed frame_speed = (1 16)
Dear Everybody,
I try to understand OpenGL ES, but this line does not make sense to me, even after reading C++ help.
GLfixed frame_speed = (1 << 16);
Can anybody help to explain, please. GLfixed should be 32 bit fixed point interger having format (s15.16).
Regards,
Rene
[Edited by - bunkai on September 12, 2009 1:39:41 PM]
I assume thats just a 'easier' way of writing that number, I often do similar things eg
x += (8*16 + 8);
I could of writen 136 but writing (8*16 + 8) perhaps makes it clearer why the number comes to 136
x += (8*16 + 8);
I could of writen 136 but writing (8*16 + 8) perhaps makes it clearer why the number comes to 136
Its because of the GLfixed format. That line appears to be saying that it wants the "frame_speed" to be equal to 1. If you just had the line
GLfixed frame_speed = 1;
Then it wouldn't actually be equal to 1 instead it would be equal to (1>>16).
Therefore to get the correct fixed-point value you must shift it along to the correct place within the 32bit field, which is why you have:
GLfixed frame_speed = (1 << 16);
http://en.wikipedia.org/wiki/Fixed-point_arithmetic
Andy
GLfixed frame_speed = 1;
Then it wouldn't actually be equal to 1 instead it would be equal to (1>>16).
Therefore to get the correct fixed-point value you must shift it along to the correct place within the 32bit field, which is why you have:
GLfixed frame_speed = (1 << 16);
http://en.wikipedia.org/wiki/Fixed-point_arithmetic
Andy
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement