Jump to content
  • Advertisement
Sign in to follow this  
Nairb

Crazy Anomaly

This topic is 3943 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
Advertisement
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
Sign in to follow this  

  • 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!