PDA

View Full Version : Weird fullscreen behavior



rsp91
09-25-2008, 12:29 PM
Does anyone know how to resolve this fullscreen problem?

Bad: http://img33.picoodle.com/data/img33/3/9/25/f_Skrmbildgltm_7bd8591.png

Good: http://img29.picoodle.com/data/img29/3/9/25/f_Skrmbildgltm_62b6140.png

I'm using SDL, the problem only occurrs when a non-native resolution is used as fullscreen resolution.


void RenderResize() {
glViewport(0,0,r_width,r_height);
GLfloat ratio=GLfloat(r_width)/GLfloat(r_height==0?1:r_height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,ratio,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
}

void RenderInit() {
glEnable(GL_TEXTURE_2D);

glShadeModel(GL_SMOOTH);

glClearColor(0.4f,0.4f,0.4f,1.0f);

glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.5);
glDepthFunc(GL_LEQUAL);
}

void RenderUpdate() {
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

glRotatef(GLfloat(CamPitch),1.0f,0.0f,0.0f);
glRotatef(GLfloat(CamYaw),0.0f,1.0f,0.0f);
gluLookAt(CamX,CamY,CamZ,CamX,CamY,CamZ-1,0.0,1.0,0.0);

Shield.Relocate();
m_shield.render();
m_shield.render_box();
Shield.Return();

Goat.Relocate();
m_goat.render();
m_goat.render_box();
Goat.Return();

SDL_GL_SwapBuffers();
}