Advertisement

Using Textures

Started by August 06, 2003 12:42 PM
3 comments, last by sandesh247 21 years, 6 months ago
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 :-(
Post some code pls

Corrail
corrail@gmx.at
ICQ#59184081
--------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened...
Advertisement
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?
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!"
"There are people who live in the reality. We recreate it!"
I didn''t get it. I don''t see me having twice the number of particles. I have one for a mask, and one for the actual texture. That seems fair enough.

This topic is closed to new replies.

Advertisement