Advertisement Jump to content


This topic is now archived and is closed to further replies.


OpenGL Help me....Weird OpenGL bug...

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

I have just loaded a bitmap and am displaying it on screen in ortho 2d mode: glOrtho(0, SCREEN_WIDTH - 1, 0, SCREEN_HEIGHT - 1, -1, 1); So I''m using the glRasterPos2i() function to place the bitmap appropriately. Now, since I want to give a coordinate for the TOP-LEFT of my bitmap and since glRasterPos2i() is the BOTTOM-LEFT of the bitmap, heres how I write my code: DrawBitmap(int x, int y) { // Set the position of the bitmap glRasterPos2i(x, (SCREEN_HEIGHT - (y + header.biHeight))); // Draw the bitmap glDrawPixels(header.biWidth, header.biHeight, GL_RGB, GL_UNSIGNED_BYTE, image); } So now to place my bitmap in the top left corner of the screen all I have to do is call DrawBitmap(0, 0). Right? Well, in my case I tested it with two bitmaps. One of size 32x32 and one with size of 256x256. When I tested them both with DrawBitmap(1, 1) I got different results. The 256x256 bitmap worked as it should. However, with the 32x32 bitmap, there was no single strip on the top of the bitmap! It was as if I had placed it with DrawBitmap(1, 0). Whats going on? If anyone can help, please do so. Thanks!

Share this post

Link to post
Share on other sites
I think you''re confused. There''s virtually no reason you should need to use glDrawPixels or glRasterPos*. See the 25th NeHe tutorial for an example of doing 2D in OpenGL.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!