Buffer trouble

I’m using the gl_KTX_buffer_region extention, but I just can’t seem to find enough info on it.

I’m assuming that I can store multiple sets of buffer information into say,

GLuint depthBuffer[6];
GLuint colourBuffer[6];

and when I use

depthBuffer[i] = glNewBufferRegion(2);
colourBuffer[i] = glNewBufferRegion(1);

a few times it enumerates correctly, but when reading, then writing the buffers later there is no change to the output window. I can’t even tell if the data has been stored correctly on the read.


returns 1 so it should work.

I use Win98, Glut and 32 bit colour if this should make a differance.

Does anyone know of any source code available using this extention?

I have a demo of the WGL_ARB_buffer_region extension on my site: http://www.gamedeveloper.org/delphi3d/download/bufferregion.zip

It should do the same thing as KTX_buffer_region, although I’m not sure exactly how different the semantics are - as you said, the KTX extension isn’t exactly well-documented.

  • Tom

In toms example he reads and writes the colour and depth buffer at the same time, can this be done with GL_KTX_buffer_region in C and is there any performance increase.

I can’t see much difference between the above implementation and mine, in concept anyway, but the above code seems to put a link to the actual buffers (the DC part) whereas I don’t I just assume it knows how to read and write using the glut buffers. Could this be where I’m going wrong. Then again I could be miss understanding the code as I’ve never used delphi.

When I finally get this demo working would anyone be interested in a tutorial (in C) as it seems like a good extention with almost no support. If not I won’t bother, please say if someone has done one.

The WGL extension relies on a DC that you give it, whereas the KTX one should just use the DC that your current rendering context is attached to.

I would try modifying my demo to use the KTX extension, but I seem to be unable to dig up the full KTX_buffer_region spec. I know which new functions it introduces, but I can’t find the values of the enumerants (i.e. GL_KTX_*_REGION). Where did you get those?

  • Tom

I got the enumerates from
http://www.west.net/~brittain/3dsmax2.htm#OpenGL Buffer Region Extension

The type parameter can be one of GL_KTX_FRONT_REGION, GL_KTX_BACK_REGION, GL_KTX_Z_REGION or GL_KTX_STENCIL_REGION. They are simply mapped to 0 through 3 in the order given above.

I found out what my problem was, and its because the extention doesn’t work as I expected. I read the buffers with a window size of 128x128 and a viewport size of 128x128, but when I write the buffers the window size has to be widthxheight and the viewport size 128x128. I thought as the origin should be from the lower left corner this should not make a difference, but if I want to be able to change the dimensions of the window the command I have to use is

glDrawBufferRegion(depthBuffer[i], 0, 0, 128, 128, 0, 128-height);

This is for dynamically rendering to textures, if your wondering why my window is a different size to my viewport.

Although this code now works it doesn’t seem right that I should have to do this, can anyone explain. I have a Geforce 2 MX and I am using the latest Detonator 3 drivers, could be an implementation error or am I being stupid (I’m very tired at the moment).