No auxiliary buffers?

Hi,

I used gl.getIntegerv(GL.AUX_BUFFERS, p) in LWJGL and I got 0 as the number of available auxiliary buffers and I was wondering why. Is it a lack of my graphics card (GeForce 2 MX)? Or is it a problem with the opengl/nvidia driver? Or maybe LWJGL just doesn’t create any? Is it possible to specifically ask for one at opengl/window initialization?

Here’s what I need an auxiliary buffer for:

I have a 3d scene at the background and a UI (with windows, menus, buttons etc.) at the foreground. Because I don’t want to redraw the UI every frame, as it updates infrequently, I would like to be able to draw it on an auxiliary buffer, every time a change occurs and it needs to be repainted. Then, every frame, I would just have to copy the contents of the auxiliary buffer on top of the scene, saving me a lot of rerendering. As it is now, just copying a whole buffer is much faster than repainting the whole interface (I tested it using the back buffer).

So it would go like this:

  • Render 3d scene
  • Render UI -IF NECESSARY-
  • Copy aux -> back
  • Render cursor
  • Swap buffers

What do you guys think? Is there another approach you could suggest?

Spasi

Unfortunatly the Geforce 2 doesn’t support any aux buffers :frowning: In fact I’m not aware of any consumer-level hardware that does.

Try looking into render-to-texture or p-buffers instead. But this also looks like being more than a tad tricky to achieve in a platform independant and speedy way last time I looked… >:(

Yeah, that’s what I thought. I’m just wondering why such a feature hasn’t been implemented yet by anyone. Memory consumption maybe? Anyway, thanks for your answer.

Spasi

OK, I decided to have a try with p-buffers, so naturally I downloaded some nice tutorials that describe how to use them. This is what I found:


There are five major steps required to create a pbuffer:

  1. Get a valid device context
  2. Find a pbuffer-capable pixel format
  3. Create a pbuffer of the chosen pixel format
  4. Create a device context for the pbuffer
  5. Create an OpenGL rendering context associated with the pbuffer

Step 1.
Getting a valid device context amounts to getting an ID or handle to the device that’s going to be doing all the rendering work. In this case (and most cases in general), the device we want to get is the graphics accelerator device. If a window (capable of displaying OpenGL graphics on the screen) has just been created, this process is straightforward:

HDC hdc = wglGetCurrentDC();

This call gives you the handle to the graphics accelerator device.

First, there is no wglGetCurrentDC() in LWJGL, but there is a wglGetCurrentReadDCARB(), which I suppose returns the device context. The problem is that uppon calling this method I get this:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x0
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error just occurred. Please refer to release documentation for possible reason and solutions.

Current Java thread:
at org.lwjgl.opengl.GL.wglGetCurrentReadDCARB(Native Method)


Is this a LWJGL problem, or am I doing something wrong? In the BaseGL class there is an int field called handle. And it’s protected. So I created a subclass of GL with a method:

public int getHandle() {
return handle;
}

This way I can retrieve it. Is this the handle to the current rendering context? Cas, some help?

Spasi

argh, hold your horses etc.
First a quick point - even if the GF2 did have aux buffers we don’t ask for any when we init the LWJGL window (not really a game requirement). If you want to fiddle around with such things perhaps you want to check out the dll source code and tweak display init for now.

As for p-buffers - whoops, you’ve found a bug I think, because it seems like we’ve forgotten to initialise handle with a value… (otherwise I don’t know anything about p-buffers much but in all honesty I’d avoid them like the plague and use ARB_render_texture instead which is far easier to use and understand.

Cas :slight_smile:

I don’t like messing with p-buffers either, but render-to-texture requires the use of p-buffers. When is the next version of LWJGL coming out…? :wink: