Jump to content
  • Advertisement
Sign in to follow this  
Antonym

fullscreen image shifted

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

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.

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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!