fullscreen image shifted

Started by
6 comments, last by Antonym 13 years, 9 months ago
Hello I am using SFML and ran into a little problem. I've been running my program on windowed mode and decided to try and make it fullscreen. When I do this the image appears shifted to a corner. I am a little bit clueless about this.

The original is commented out.

	_window.Create(sf::VideoMode::GetMode(0), "Mitashi", sf::Style::Fullscreen);//	_window.Create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32), "Mitashi", sf::Style::Close, settings);


Thanks.
Advertisement
Quote:Original post by Antonym
Hello I am using SFML and ran into a little problem. I've been running my program on windowed mode and decided to try and make it fullscreen. When I do this the image appears shifted to a corner. I am a little bit clueless about this.

In your code, it appears that fullscreen mode is being set, but that no resolution is being explicitly defined. The library you're using is probably choosing the default resolution of your desktop instead. Try the following:

_window.Create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32), "Mitashi", sf::style::Fullscreen);
Thanks for the reply.

Same problem :S. Maybe it has something to do with my resize code?

By the way SCREEN_WIDTH and SCREEN_HEIGHT aren't the actual size of the screen, they are just the size I wanted the window to be.

	handle_resize(SCREEN_WIDTH,SCREEN_HEIGHT);void GameEngine::handle_resize(int w, int h){	if (h==0)								// Prevent A Divide By Zero By	{		h=1;							// Making Height Equal One	}	glViewport(0, 0, w, h);	glMatrixMode(GL_PROJECTION); //Switch to setting the camera perspective	//Set the camera perspective	glLoadIdentity(); //Reset the camera	// Calculate The Aspect Ratio Of The Window//	gluPerspective(45.0f,(GLfloat)w/(GLfloat)h,0.1f,100.0f);	glOrtho(0.0f, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0f, 1.0f);	glMatrixMode(GL_MODELVIEW);						// Select The Modelview Matrix	glLoadIdentity();							// Reset The Modelview Matrix}


[Edited by - Antonym on July 15, 2010 11:11:31 AM]
What's the size of your image, and what's the size of your window (both windowed and fullscreen)? If you're creating a window with dimensions greater than that of the image, then when the image is drawn at the origin (top-left corner), it will produce the effect you're describing.

static int SCREEN_WIDTH = 800;
static int SCREEN_HEIGHT = 752;

Those are the width and height used for both window and fullscreen. The image appears shifted to the bottom left corner sorry.
Sounds like the video card or monitor doesn't fully support the resolution you are requesting. You won't notice this so much in windowed mode as it is probably emulated in software however I have noticed that full screen tries to do it's best but sometimes just doesn't get it right.
Evillive2
Quote:Original post by evillive2
Sounds like the video card or monitor doesn't fully support the resolution you are requesting. You won't notice this so much in windowed mode as it is probably emulated in software however I have noticed that full screen tries to do it's best but sometimes just doesn't get it right.

Agreed; 800 x 752 is an odd resolution. Try changing it to 800 x 600, or if you need the extra height then expand upward to 1024 x 768.
That worked! Thanks guys ^_^.


[Edited by - Antonym on July 19, 2010 2:05:53 AM]

This topic is closed to new replies.

Advertisement