Jump to content
  • Advertisement

Archived

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

cggm

How to accelerate texture mapping in OpenGL!!!

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

I have a question as follows. While I render the mesh with texture mapping, the Frame rate is always slow down. (I use the OpenGL, Win32 and Visual C++ 6.0) Therefore, I think whether having any technique to accelerate the rendering speed with texture mapping, e.g., using hardware approach or others. If you can tell me any related approach, excluding View Frustum and Occlusion Culling, to slove above question, I will thank you very much. In addition, That is so great if having any example(Source Code) written in OpenGL and C/C++. Sincerely!!!

Share this post


Link to post
Share on other sites
Advertisement
What are your system specs? Can you be a little more clear about exactly what you''re doing, drawing, etc.

Maybe you can sort your meshes by texture, to reduce state changes... But I''m not really sure what you''re trying to do..

Share this post


Link to post
Share on other sites
First, thanks for your answer.
My program is executed on WindowsXP and the Code is written by Visual C++ 6.0 with OpenGL.
My drawing code is as follows:
----------------------------------------------
glBindTexture(GL_TEXTURE_2D, Texture No.);
glBegin(GL_TRIANGLES);
glNormal3fv(Normal);
glTexCoord2fv(V1.UV);
glVertex3fv(V1.XYZ);
glTexCoord2fv(V2.UV);
glVertex3fv(V2.XYZ);
glTexCoord2fv(V3.UV);
glVertex3fv(V3.XYZ);
glEnd();
----------------------------------------------
I know when rendering with texture mapping, the speed will decrease. However, now I have to draw a model(scene) with many textures, but a large number of texture cause bad frame rate. Accordingly, I think whether having any technique can accelerate the performance of texture mapping, e.g., maybe use hardware approach etc.
Really thanks for you. ^^

Share this post


Link to post
Share on other sites
Use GL_LINEAR_MIPMAP_NEAREST when creating the texture. It speeds up my programs quite a bit. NeHe has a tut on it too.

Share this post


Link to post
Share on other sites
batch triangles with same texture and draw them in one call to VA

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
Thanks for everyone to reply my question.

Because I use the "Normal Mask technique", which checks per face every time, to do the backface Culling, I can''t use the Vertex Array to accelerate the rendering.
Therefore, does having any other approach accelerate the render speed?

In another OpenGL news, someone tells me to try the "hardware texture compression", but i don''t know it. ><|||
Who can tell me about it or other approaches.
Thanks very much.

Share this post


Link to post
Share on other sites
I hadn''t heard of ''Normal masks'' before, so I spent 5 minutes googling and found this. Which seems to be an old-skool way of doing backface culling back when drawing a single face was expensive. Assuming you''re actually using some sort of 3d hardware (which since you mention OpenGL is pretty much certain) then this is almost certainly a Bad Thing.

Chuck the normal masks in the bin, and use the standard backface culling via vertex winding. Then stick your triangles into a vertex array or display list, sorted by texture.

In general, if you find yourself doing things per face or per vertex, you''re going to have performance problems (unless you can use GF3+ hardware, but we''ll ignore that for now).

(500x7 + 56k == teh suck)

Share this post


Link to post
Share on other sites
On some hardware set ups its even faster to simply draw the polys rather than check for backfacing! GTA3 on the PC has no backface culling because it was originally coded for the PS2 and on that system backface culling is slower than straight drawing.

To maximise performance sort your vertices by texture to minimise state changes (a google search should explain this if you want to understand more) and render them as vertex arrays.

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!