Pixel Buffers

How would one go about creating a pixel cache in VRAM, similar to VolatileImages, in LWJGL? I suppose I could create a texture, but I see two problems with that:

  1. Many cards are limited to textures of no larger than 512x512
  2. Textures have to be powers of 2. A 640x480 background image for a game would need a texture of 1024x1024.

There is a WGL extention for PixelBuffers, but that only works on Windows. Any ideas?

I don’t know what the best approach would be right now (considering platforms other than Windows), but I heard that a standard extension is prepared for OpenGL, that will give pixel buffer functionality in a clean and standard way for all platforms. Don’t know when it’s gonna be ready though…

Oh, at GDC they announced another standard extension, vertex buffers (the equivalent of NV vertex array range and ATI vertex array object). The new nVidia drivers support this extension already. LWJGL team? When will this be added to the api?

Theres an extension for non-power-of-2 textures (GL_NV_texture_rectangle), not sure if theres an ARB or EXT version of it though, maybe ati cards just support it directly…

Other than that, packing lots of data into several large textures would be a better way of doing things. Its been done for ages for lightmap packing etc. so there should be plenty of info.

Thanks guys. Guess it’s back to segmented memory for me. :slight_smile:

We’re right on their trails - the extension in question is ARB_vertex_buffer_object and it has been added to lwjgl cvs as of yesterday. In fact, I’m already porting my own vertex buffer code to the new extension as we speak.

EDIT: that is, expect to be able to use it in lwjgl 0.6.

  • elias

For a background image either use a 512x512 texture and blow it up to the correct size (fastest, easiest way and probably very similar in appearance to 640x480), or use glDrawPixels which blits rectangles straight from client memory. If this memory happens to be in AGP RAM on nvidia cards it’s somewhat faster. Make sure it’s in the same format as the framebuffer though or it’s dreadfully slow.

Cas :slight_smile:

Hi Cas,

Thanks for your answer. It just leaves me with one question. How do I get ahold of the AGP memory without using textures?

FWIW, Pixel Buffers are in cvs now, using WGL_pixel_buffer on win32 and GLX 1.3 pixel buffers on linux. Render to texture through pixel buffers has not yet been implemented, because only a win32 extention exists for now (expecting that to change soon though, GLX_render_to_texture is in the workings).

Expect to see the functionality along with native cursors in 0.7. Hopefully the macosx port will be included too!

  • elias