Full screen stretching image

Started by
1 comment, last by teslaa66 15 years, 5 months ago
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.
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.
Thanks

This topic is closed to new replies.

Advertisement