# Looping picture problems...

This topic is 4918 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey, im trying to make a screen saver that "loop" though a buch oh pictures that all connect, like so it seems like your going down a tunnel, but heres my problem as i keep going though more and more, it seems to slow down alot. Heres my code for the drawing.
void DrawFaceOffset(float scale,bool firstcall)
{
//glScalef(scale,scale,0);
if(firstcall)
{
glColor3f(1.0f,0.0f,0.0f);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,BlankTxt);
}
else
{
glColor3f(1.0f,1.0f,1.0f);
glBindTexture(GL_TEXTURE_2D,0);
}
//glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );

float width,height;
width=scale;
height=scale;
glTexCoord2f(0,0);
glVertex2f(-width,-height);
glTexCoord2f(1,0);
glVertex2f(+width,-height);
glTexCoord2f(1,1);
glVertex2f(+width,+height);
glTexCoord2f(0,1);
glVertex2f(-width,+height);
glEnd();
glDisable(GL_TEXTURE_2D);
if(scale>0)
DrawFaceOffset(scale*0.1f,1);
} 
That is called in the draw function, and scale is set to "zoom" which is a float that keeps geting larger as time goes on(it goes up by time, so its not because of the framerate) And you can download the .exe here http://mindcasterstudios.com/kc/picloop1.zip For an Eg of the problem Thanks in advanced. [Edited by - kc_0045 on August 3, 2005 8:50:08 PM]

##### Share on other sites
Well, your rendering function is recursive (for some reason) and the number of times it recurses is proportional to the value of scale, so if you increase scale as time goes, it's not strange that it takes longer and longer to execute.
I'm not sure exactly what that is supposed to do, but I'd say that using a float*0.1<=0 to stop recursion might be a bad idea..
You should also look out for enabling/disabling texturing too often, as well as re-binding the same texture over and over again.

##### Share on other sites
Quote:
 Original post by TomasHWell, your rendering function is recursive (for some reason) and the number of times it recurses is proportional to the value of scale, so if you increase scale as time goes, it's not strange that it takes longer and longer to execute.I'm not sure exactly what that is supposed to do, but I'd say that using a float*0.1<=0 to stop recursion might be a bad idea.. You should also look out for enabling/disabling texturing too often, as well as re-binding the same texture over and over again.

Ya i know, i plan on adding/fixing things like that, but it olny renders about, 4 on the screen and it starts to slow down, but im not talking about fps wise, it just seems to "grow" at a slower rate, while the fps stays the same(around 1500)

##### Share on other sites
Any ideas? or any ideas on how to get the same effect, a differnt way?

##### Share on other sites
Id hate to just keep bumping...but i cant figure it out :S Any ideas Please?

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634135
• Total Posts
3015754
×