Sign in to follow this  

Crazy Anomaly

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

Take a look at this code:
void Display()
{
	UseFixedFunction();
	RestoreDefaultFramebuffer();
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	if (gGlow)
	{
		gFBO->Bind();
	}

	RenderScene();

	if (gGlow)
	{
		UseFixedFunction();
		RestoreDefaultFramebuffer();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		Blur();

		RestoreDefaultFramebuffer();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		RenderScene();

		UseFixedFunction();

		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
		glColor4f(1,1,1,0.9);
		
		SetupOrtho();
		if (gBigGlow) glScalef(1.05, 1.05, 1.0);
		glBindTexture(GL_TEXTURE_2D, gFBOTex);
		glEnable(GL_TEXTURE_2D);
		glBegin(GL_QUADS);
			glTexCoord2f(0,0);
			glVertex3f(-1,-1,0);
			glTexCoord2f(1,0);
			glVertex3f(1,-1,0);
			glTexCoord2f(1,1);
			glVertex3f(1,1,0);
			glTexCoord2f(0,1);
			glVertex3f(-1,1,0);
		glEnd();
		glDisable(GL_TEXTURE_2D);
		glDisable(GL_BLEND);
	}

	glutSwapBuffers();
}

When gGlow is false (that is, there is no glow), the scene renders at a little less than 60 FPS (which already confuses me, since the scene is really simple). When gGlow is true the FPS nearly doubles. As in, it's a noticeable difference (my scene rotates a lot faster). Mind you, my Blur function uses a shader to blur a full-screen quad 30 times. This... doesn't seem possible to me. Does anyone have any clue what's going on?

Share this post


Link to post
Share on other sites
Is RenderScene() truly invariant? If it increases the time, does incremental stuff or other, the rendering will look twice as fast as it is called twice during one frame.

The 60fps is probably because you wait on the VSync during the SwapBuffers.

Share this post


Link to post
Share on other sites
Wow, don't I feel silly. Turns out my FPS counter and my rotation code both happened in RenderScene.

Sorry for the wasted time. ^_^

Cheers,
--Brian

Share this post


Link to post
Share on other sites

This topic is 3729 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this