Jump to content
  • Advertisement

Archived

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

brendon

glDrawPixels and big bitmaps

This topic is 5655 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 trying to use a bitmap as the background to a game I am making. I''ve got the bitmap to display as a background properly but it goes extremely slow. This is the code I am using to load the bitmap.
HBMP = (HBITMAP)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);

GetObject(HBMP,sizeof(BMP), &BMP);
And this is the code I have used to display it.
glDrawPixels(BMP.bmWidth, BMP.bmHeight,GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits);
I can''t see why it runs so slow and the only other way I can think of doing this is using textures but that would require resizing the picture to a power of 2 the sizing it back when I draw it but that would make a mess of my background picture. Any advice would be appreciated, thank, Brendon

Share this post


Link to post
Share on other sites
Advertisement
The texture option is not not as bad as you think.

You can create a dummy texture which is the nearest power of two larger than the background image, and use glTexSubImage to load the image in a part of the texture. Then draw a quad with proper texture coordinates so only the background part shows up.

Use NV_texture_rectangle if available, it accepts textures of any size.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!