Hello,
I am writing some OpenGL Applications with SDL as WindowManager. I have a Problem with the resolution of 1280x1024. When i start the Program (Not Fullscreen) it looks fine like here:
http://data.whosme.de/denginewindow.PNG
But as soon as i move the Window by click and hold the mouse on the window title and move the whole window, then my Viewport gets moved like that: There are 16 more pixels above, that i canno reach. But my glClearColor is reaching that area as you see:
http://data.whosme.de/denginewindow2.PNG
With other Resolutions it is working. Maybe its because that 1280/1024 = 1.25 is and 1024/768 = 1.33, 640/480 = 1.33 is and so on.
Here is my Code for the Viewport:
void init(int theWidth, int theHeight) {
myWidth = cast(float) theWidth;
myHeight = cast(float) theHeight;
glClearColor(0.3f, 0.3f, 0.5f, 1.0f);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glDepthFunc(GL_LEQUAL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
join3D();
};
void refresh() {
SDL_GL_SwapBuffers();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//refresh screen
};
void uninit() {
};
void join2D() {
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(0, myWidth, 0, myHeight,0,1);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
};
void join3D() {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0f, myWidth / myHeight, 0.1f, 1024.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
};