glDrawPixels Problem

Started by
2 comments, last by vbbartlett 19 years, 7 months ago
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...
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.
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.
enum Bool { True, False, FileNotFound };
how do i detect the extentions and is there any good tutorial or information about using those extentions?

This topic is closed to new replies.

Advertisement