Archived

This topic is now archived and is closed to further replies.

sandesh247

Using Textures

Recommended Posts

sandesh247    122
What is the best way to use textures? I store all my textured quads in display lists, but the speed is so slow.... I had posted a similar question earlier, and Ruudje said that optimising was an art. Perhaps some of you out there could tell something about this art to others... I access the net after every 24hrs, so I may not be able to answer back any questions you may have immediately :-(

Share this post


Link to post
Share on other sites
sandesh247    122
Here is the code to make the list :

glNewList(shot, GL_COMPILE);

glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);

//Mask
glBlendFunc(GL_DST_COLOR,GL_ZERO);
glBindTexture(GL_TEXTURE_2D, textures[TEX_SHOT_MASK]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);glVertex3f(-0.5f, -0.5f, 0.0f);
glTexCoord2f(1.0f, 0.0f);glVertex3f( 0.5f, -0.5f, 0.0f);
glTexCoord2f(1.0f, 1.0f);glVertex3f( 0.5f, 0.5f, 0.0f);
glTexCoord2f(0.0f, 1.0f);glVertex3f(-0.5f, 0.5f, 0.0f);
glEnd();

//Actual image
glBlendFunc(GL_ONE,GL_ONE);
glBindTexture(GL_TEXTURE_2D, textures[TEX_SHOT]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);glVertex3f(-0.5f, -0.5f, 0.0f);
glTexCoord2f(1.0f, 0.0f);glVertex3f( 0.5f, -0.5f, 0.0f);
glTexCoord2f(1.0f, 1.0f);glVertex3f( 0.5f, 0.5f, 0.0f);
glTexCoord2f(0.0f, 1.0f);glVertex3f(-0.5f, 0.5f, 0.0f);
glEnd();

glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);

glEndList();


I call this list wherever I need it. I use five or six of these, and it becomes quite slow. Too slow for something like a fire effect or so. Is there a better way than this?

Share this post


Link to post
Share on other sites
lobravo    122
I think it won''t supply ur need, but will help :D

Try to disable depth_test before Blend. Use GL_TRIANGLE_STRIPS instead of GL_QUADS. Is it somekind of particle system? Because if so, u have the number of particles, but twice

"There are people who live in the reality. We recreate it!"

Share this post


Link to post
Share on other sites