Buffer clip rects

Hi,
I’m porting some Mac code to Windows, and in the Mac version the gl context only covered a certain part of the window.
This was achieved by clipping the gl buffer as follows:

GLint bufferRect[4];
bufferRect[0]=left;
bufferRect[1]=bottom;
bufferRect[2]=width;
bufferRect[3]=height;
aglSetInteger(glContext,AGL_BUFFER_RECT,bufferRect);
aglEnable(glContext,AGL_BUFFER_RECT);

I cannot for the life of me find any Windows equivalents of these Mac specific agl calls.

Does anyone have any advice on how to clip the gl buffer to a specified region in the window?

TIA
Ian

Originally posted by ian:
[b]Hi,
I’m porting some Mac code to Windows, and in the Mac version the gl context only covered a certain part of the window.
This was achieved by clipping the gl buffer as follows:

GLint bufferRect[4];
bufferRect[0]=left;
bufferRect[1]=bottom;
bufferRect[2]=width;
bufferRect[3]=height;
aglSetInteger(glContext,AGL_BUFFER_RECT,bufferRect);
aglEnable(glContext,AGL_BUFFER_RECT);

I cannot for the life of me find any Windows equivalents of these Mac specific agl calls.

Does anyone have any advice on how to clip the gl buffer to a specified region in the window?

TIA
Ian[/b]
I’m not familiar with the AGL functions, but from what I understand, you could achieve the same functionality using OpenGL scissoring :?
Although that won’t work if you want to scissor SwapBuffers (scissor doesn’t affect swapbuffers, you could use WIN_SWAP_HINT, but that’s just a hint and it may be disregarded by the driver).

I believe that the best solution is to use a child window as OpenGL window and change the size so it matches your desired buffer size.

Originally posted by evanGLizr:
[b]I’m not familiar with the AGL functions, but from what I understand, you could achieve the same functionality using OpenGL scissoring :?
Although that won’t work if you want to scissor SwapBuffers (scissor doesn’t affect swapbuffers, you could use WIN_SWAP_HINT, but that’s just a hint and it may be disregarded by the driver).

I believe that the best solution is to use a child window as OpenGL window and change the size so it matches your desired buffer size.[/b]
Unfortunately I do need a double buffered context.

I’m not familiar with child windows, at first I hoped they could be ‘attached’ to the parent window and would automagically be moved around when the parent window is moved/resized.
I couldn’t find anything like this in the MSDN docs though?

I’ve noticed a post on Overlays which look like an area to investigate further :slight_smile:

UPDATE:

I’m now using a child window as you suggested, fixed into the required position on the main window.

Everything works a treat now in this respect - I’m having some strange rendering behaviour that I’ll start a new topic about though.

Many thanks evanGLizr for your help.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.