#103910 - Dark Knight ez - Mon Sep 25, 2006 10:32 am
Hey all.
I need to speed up some things in my game.
So far, I've been using only floats. It worked, but with lots of 3D objects to display, the game slows down.
So, I've been converting this code:
To this:
Of course, glColor3f could be done with glColorb as well, I guess.
Anyway, I tried this out and it appears it's not working correctly.
The quad does exist, and with the glColor3f enabled, it also appears in a colour (although weird enough, that colour appears to be "random"... not white as is specified [the values are all 1.0f]).
When I comment out the glColor3f line, the quad is just black.
So my questions are:
1) Am I moving from floats to fixed points in the right way? (And does this indeed gain in speed?)
2) How do I get the texture binding to work properly again?
I need to speed up some things in my game.
So far, I've been using only floats. It worked, but with lots of 3D objects to display, the game slows down.
So, I've been converting this code:
Code: |
glBindTexture(GL_TEXTURE_2D, textureSurroundings[0]); // front
glBegin(GL_QUADS); glColor3f(surroundingsColorRPerc, surroundingsColorGPerc, surroundingsColorBPerc); glTexCoord2f(0.0f, 0.0f); glVertex3f(-EDGE, EDGE, -EDGE); glTexCoord2f(0.0f, 1.0f); glVertex3f( EDGE, EDGE, -EDGE); glTexCoord2f(1.0f, 1.0f); glVertex3f( EDGE, -EDGE, -EDGE); glTexCoord2f(1.0f, 0.0f); glVertex3f(-EDGE, -EDGE, -EDGE); glEnd(); |
To this:
Code: |
glBindTexture(GL_TEXTURE_2D, textureSurroundings[0]); // front
glBegin(GL_QUADS); glColor3f(surroundingsColorRPerc, surroundingsColorGPerc, surroundingsColorBPerc); glTexCoord2t16(floattot16(0.0f), floattot16(0.0f)); glVertex3v16(floattov16(-EDGE), floattov16( EDGE), floattov16(-EDGE)); glTexCoord2t16(floattot16(0.0f), floattot16(1.0f)); glVertex3v16(floattov16( EDGE), floattov16( EDGE), floattov16(-EDGE)); glTexCoord2t16(floattot16(1.0f), floattot16(1.0f)); glVertex3v16(floattov16( EDGE), floattov16(-EDGE), floattov16(-EDGE)); glTexCoord2t16(floattot16(1.0f), floattot16(0.0f)); glVertex3v16(floattov16(-EDGE), floattov16(-EDGE), floattov16(-EDGE)); glEnd(); |
Of course, glColor3f could be done with glColorb as well, I guess.
Anyway, I tried this out and it appears it's not working correctly.
The quad does exist, and with the glColor3f enabled, it also appears in a colour (although weird enough, that colour appears to be "random"... not white as is specified [the values are all 1.0f]).
When I comment out the glColor3f line, the quad is just black.
So my questions are:
1) Am I moving from floats to fixed points in the right way? (And does this indeed gain in speed?)
2) How do I get the texture binding to work properly again?