Jump to content
  • Advertisement

Archived

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

sandesh247

Using Textures

This topic is 5458 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

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
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?

Share this post


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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!