How can I change my floating function of reshape into fixed point?? I don't know how to handle the w/h part...pls help
void reshape (UGWindow uwin, int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity(); GLfixed temp=(w<<16)/(h); //temp<<=16; //ugluPerspectivef(80.0, (GLfloat) w/(GLfloat) h, 1.0, 400.0); ugluPerspectivex(5262880, temp, 65536, 26214400); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); ugluLookAtx(655360, 655360, 655360, 0, 0, 0, 0, 65536, 0); }
The display is ok if I use ugluPerspectivef, but ugluPerspectivex is not ok even I change the data into fixed value...
void reshape (UGWindow uwin, int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity();
ugluPerspectivef(80, 1, 1, 400); //ugluPerspectivex(5242880, 65536, 65536, 26214400); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); ugluLookAtx(655360, 655360, 655360, 0, 0, 0, 0, 65536, 0); }
Log in to post a comment.
How can I change my floating function of reshape into fixed point?? I don't know how to handle the w/h part...pls help
void reshape (UGWindow uwin, int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
GLfixed temp=(w<<16)/(h);
//temp<<=16;
//ugluPerspectivef(80.0, (GLfloat) w/(GLfloat) h, 1.0, 400.0);
ugluPerspectivex(5262880, temp, 65536, 26214400);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
ugluLookAtx(655360, 655360, 655360, 0, 0, 0, 0, 65536, 0);
}
The display is ok if I use ugluPerspectivef, but ugluPerspectivex is not ok even I change the data into fixed value...
void reshape (UGWindow uwin, int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
ugluPerspectivef(80, 1, 1, 400);
//ugluPerspectivex(5242880, 65536, 65536, 26214400);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
ugluLookAtx(655360, 655360, 655360, 0, 0, 0, 0, 65536, 0);
}