Jump to content
  • Advertisement
Sign in to follow this  
teslaa66

Full screen stretching image

This topic is 3603 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 currently use 950 by 950 resolution and i get a nice even shape to things but if i use the fullscreen mode.....
	glutGameModeString("1680x1050:32@60"); 
	glutEnterGameMode(); 

everything becomes stretched and a sphere in my scene no longer looks like a sphere, do i need to increase the viewport size rather than the image or something like that? Here is my reshape function.
void reshape(int w1, int h1)
{
	//Prevents a divide by zero when the windows too short
	if(h1 == 0)
	{
		h1 = 1;
	}

	w = w1;
	h = h1;
	ratio = 1.0f * w / h;

	// Reset the coordinate system before modifying
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	// Set the viewport to be the entire window
    glViewport(0, 0, w, h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(55, 1.0, 0.1, 1030);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

Many Thanks.

Share this post


Link to post
Share on other sites
Advertisement
gluPerspective expects an apsect ratio for the second parameter. You have 1.0, which means that the width of the window will have the same field of view as the height. You most likely want 'ratio' there.

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!