Jump to content
  • Advertisement
Sign in to follow this  
bunkai

OpenGL Meaning of: GLfixed frame_speed = (1 16)

This topic is 3377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!