-
2d orthographic projection bug???
Hello everyone I know that claiming a bug is the last thing that a serious programmer should do... but anyway I would like you to have a look at this function that draws a simple square:
static void draw_screen( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
GLint viewport[] = {0,0,0,0};
glGetIntegerv(GL_VIEWPORT, viewport);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D( 0, viewport[2]-1, 0, viewport[3]-1 );
// float eps = 0.001937f;
float eps = 0.0f;
glBegin(GL_LINE_LOOP);
glColor3f(1,1,0);
glVertex2f(eps, eps);
glVertex2f(100, eps);
glVertex2f(100, 100);
glVertex2f(eps, 100);
glEnd();
SDL_GL_SwapBuffers();
}
The function above simply draws a 100x100 square with the bottom/left corner set to 0,0 that is the bottom/left of the screen. With my NVIDIA 8600 GT driver the bottom and left edge of the square are not visible unless you add a little "epsilon" as in the example. Instead with the Microsoft GDI driver the square is correctly drawn even without the "epsilon".
If you cut and past the function in the SDL OpenGL sample from the SDL documentation you can immadiately try it out.
What do you think? it's a bug or it's a feature?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules