Jump to content
  • Advertisement

Archived

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

Xanthen

Multiple Textures and Performance issues

This topic is 6025 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''m a little confused on the whole "working set of high performance textures" and I''m not sure If i''m using this at all. If I create an application with say 10000 triangles, and 2 textures. And for some really stupid reason I decide I want to render 1 triangle from 1 texture, and then 1 triangle from the other texture 5000 times.
  
for (i=0;i<5000;i++)
{
glBindTexture(GL_TEXTURE_2D, tex1);
glBegin(GL_TRIANGLE);
...
glEnd();
glBindTexture(GL_TEXTURE_2D, tex2);
glBegin(GL_TRIANGLE);
...
glEnd();
}
  
I would think this would, while not optimal, render pretty fast considering the hardware is doing all the work. However im not getting the performance I expected from doing such a thing. Even if I draw really tiny triangles. Is there some option I have to set in order to specify my texture should stay in resident memory on the card?

Share this post


Link to post
Share on other sites
Advertisement
im not surprised try this
bind texture 0
glBegin( GL_TRIS )
loop 5000x
{
draw triangle
}
glEnd()

bind texture 1
glBegin( GL_TRIS )
loop 5000x
{
draw triangle
}
glEnd()

Share this post


Link to post
Share on other sites
That was the whole point. I can''t do that easily. I''m swapping textures a total of about 300 times in a really complicated scene. Its hard to organize every single triangle according to the texture on it, and it seems rediculous that I have to do so.

Share this post


Link to post
Share on other sites
you are only using 2 texutures?

Well if the limits on all your triangles are like this

0,0
1,1
0,1

and never MORE than one, try placing BOTH the textures onto one texture side by side.

So the triangle A would now use
0,0
0.5,1
0,1

and triangle B would use
0.5,0
1,1
0.5,1



Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites
Unfortunatly no, I''m doing about 25 textures.

heres the scene, and I''m swapping textures about 250 times total in this Screenshot. I''d hate to have to go through every single object on the screen and render each model that is common with all the others before moving on to the next model.


Share this post


Link to post
Share on other sites
>> Its hard to organize every single triangle according to the texture on it, and it seems rediculous that I have to do so. <<

u dont have to BUT if u want better performance u do have to.
think of drawing a picture with 3 coloured pens which ways gonna be quicker
A/ pick up the first pen draw all what needs to be done with that pen put it down + then pick up the next + repeat
B/ pick up a pen draw a line, the line next to it is in a different colour so put down that pen + pick up the other colour pen draw the line put that pen down + pick up the original pen etc

Share this post


Link to post
Share on other sites
that is an awesome way of explaining it zed (the pen thing)

Unfortunately he is very right Xanthen... you will get a massive speedup from minimizing your texture state changes.
Your screenshot does look quite nice though


btw zed, how is gotterdamung coming along? (or are you still busy with other shit?)

Edited by - Bad Monkey on January 16, 2002 2:38:13 AM

Share this post


Link to post
Share on other sites
As funny as it seems, it would take you less time to sort by texture per frame than to do 300 texture changes. Man thats a lot!! Sorting by texture is actually a really standard practice. Texture changes are extremely slow and should always be minimized as much as possible. If you do a radix sort on the draw order of your polys for each frame so that texture changes are minimized, I would say its a safe bet that you'll see speed improvements of at the VERY least 5 to 10 times what you're running at now (probably quite a bit more). As it is now you're doing it in the absolute least efficient way possible.

Edited by - lunarss on January 16, 2002 3:45:24 AM

Share this post


Link to post
Share on other sites
heh, well, i wouldn't quite say LEAST effecient. I did go through the work of minimizing most of the texture swaps while rendering the ground. Which improved the ground rendering speed from like 20 fps up to about 60.

Most of the texture swaps come from rendering the objects on screen, as right now I just swap the texture to the object I want to render, render it and then move on to the next object.

What is the maximum sized texture I can load into a single texture space on todays cards? I was thinking the limit was 256x256 so thats the highest we have, but I would be able to get rid of a lot of texture swaps if we went to 512x512 and then only had 1 texture per object.

Additionally is there any performance difference between swapping out large textures vs small textures?
So would 300 512x512 texture swaps be slower than 300 128x128 texture swaps?

And another performance question: I have all the triangle normals precalculated in order to perform my own lighting, is there any way to pass this information to the OpenGL system so that it doesn't have to calculate all new ones?

Edited by - Xanthen on January 16, 2002 10:13:55 AM

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!