Major slowdown of rendering textures

Started by
10 comments, last by g7tommyB 21 years, 4 months ago
Hi, I have the following problem that I am batteling with. I have a function that renders a quad and texture maps it with a "space" texture. I then render another quad on top of the first one and texture map it with a "nebula" texture. When my space ship flie over (i.e. is rendered on top of these two quads) the nebula, I notice a significant slow-down in the game and the FPS starts to drop rather quickly... What could be causing this major slow-down. Below is the snippet of the function that is responsible for rendering the space and nebula quads: glBindTexture(GL_TEXTURE_2D, Object->Textures[0]); if(strcmp(Object->type, "SPACE") == 0) { glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0, 0); glVertex3f(Object->startx, Object->starty, -5.0f); glTexCoord2f(0, 2); glVertex3f(Object->startx, Object->endy, -5.0f); glTexCoord2f(2, 0); glVertex3f(Object->endx, Object->starty, -5.0f); glTexCoord2f(2, 2); glVertex3f(Object->endx, Object->endy, -5.0f); glEnd(); } else { glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0, 0); glVertex3f(Object->startx, Object->starty, -4.99f); glTexCoord2f(0, 1); glVertex3f(Object->startx, Object->endy, -4.99f); glTexCoord2f(1, 0); glVertex3f(Object->endx, Object->starty, -4.99f); glTexCoord2f(1, 1); glVertex3f(Object->endx, Object->endy, -4.99f); glEnd(); } Any suggestions or comments would be greatly appreciated. Cheers! TommyB
g7tommyB
Advertisement
Ok if your rendering two things over one another and still seeing the original I guess you are drawing with Blending enabled Blending will kill frame rates when Used in high amounts such as drawing over the screen twice with quads useing it. Becarefull with blending like don't draw the stars with it on turn it off for that then on for the nebula.

[edited by - Xero-X2 on November 21, 2002 9:32:20 PM]
"I seek knowledge and to help those who also seek it"
Are there any alternatives to achive this multi texture effect, whereby I can draw several textures over each other (with various sizes), without using blending?

Thanks

TommyB
g7tommyB
You can Try to Use Multitextureing an extention which is very useful and good to know. you can learn it at NeHe if you don''t know how to use it but It is more restrictive on your blending options. another good alternateive is that if you only need to merge the textures once and the perspective and such doesn''t matter you can blend it once capture it and then draw that on texture as it from then on that way you can have the texture on on Quad and it won''t use blending, another thing you can do to increase speed if you are not already is if you cover the whole screen you can turn off Color Buffer Clearing. that way you save more of your Video cards power for useful activities.

hope this helps a bit.
"I seek knowledge and to help those who also seek it"
Thank You Xero-2.
Your comments are very helpfull.
I will try the suggested approach in your first response
first. I will let you know if it resolved the slow-down issue.

Cheers.

TommyB
g7tommyB
BTW, what hardware do you have? Also, hat frame rate do you have before and after doing the blending?
I have a P4 1.4 GHz, 512 MB RAM
GeForce 2 (64MB)
My frame rate is calculated dynamically so I can see it start
to drop down from 83FPS as soon as my spaceship flies directly over the nebula (the area where both quads are on top of each other).
I do not see any slow downs if I keep my space ship away from the nebula (even though it is being rendered). The problem occurs only when my spaceship flies directly over the area in question.

Cheers.

TommyB
g7tommyB
Hmm, that is a fast system, compared with mine (TB 750, 256 RAM, and a Vanta TNT 2 with 8 MB). And I get pretty decent frame rates even with belendings and such... How big are your textures? (x and y size)?
Actually the main factor that will kill his frame rate is the resalustion that his program runs.
"I seek knowledge and to help those who also seek it"
Guys,

The problem is not rendering these two quads with textures, even with blending. The space quad is one full screen and the nebula size is about a quarter of a full screen. The frame rate is fine up until a point where the spaceship needs to be rendered on top of these two quads. That just kills the frame rate(
The frame rate is good (~84FPS) up until I "fly" over the nebula, that is when I start seeing the FPS drop...

TommyB
g7tommyB

This topic is closed to new replies.

Advertisement