Jump to content
  • Advertisement
Sign in to follow this  
vbbartlett

OpenGL glDrawPixels Problem

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

trying to render a scene that has vector data ie lines and polygons then render a picture, and then render some more vector data. The problem is that the picture isn't a 2^n size, Thus I can't use textures... (at least that is my understanding) My solution is to glReadPixels into a hbitmap, blit the picture onto the hbitmap, then glDrawPixels and then continue drawing. However the process lags everyonce in a while. most of the time it can draw do the glDrawPixels pretty fast but every once in a while it takes about 2 secs for it to render and I was wondering if anyone as a solution for either this or how to render a picture in opengl when the size is not 2^n*2^m? If there is a better algorithm please suggest it! basically im drawing glLines and then want to render a jpg on top of those lines and then draw some more lines on top of the picture...

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by vbbartlett
trying to render a scene that has vector data ie lines and polygons then render a picture, and then render some more vector data. The problem is that the picture isn't a 2^n size, Thus I can't use textures... (at least that is my understanding)

There are extensions for using non-power-of-two textures (NV_texture_rectangle, and theres a newer ARB version as well IIRC). Failing that you could always just pad your image up to the next size and ignore the excess.

Share this post


Link to post
Share on other sites
You can allocate a power-of-two texture which is larger than your actual image, and then use TexSubImage() or CopyTexSubImage() to only fill the part of the texture you care about. Adjust texture coordinates as appropriate.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!