Skip navigation.
 
mlHow to get current renderer for an NSOpenGLView?
FROM : Duncan Champney
DATE : Wed Mar 26 22:54:00 2008

I need to find out the amount of total VRAM and available VRAM in the 
current renderer before creating a large renderbuffer object, to make 
sure I don't choke the system in doing it.

I know how to find the current renderer for a given display, but I 
want the current renderer for my NSOpenGLView. I can get to the core 
graphics context like this:

    //code is from my NSOpenGLView object, so self refers to an 
NSOpenGLView
    NSOpenGLContext* theContext = [self openGLContext];
    void* the_CGLContext = [theContext CGLContextObj];

But that still doesn't get me to the renderer. What I want to to is 
get a handle to the current renderer's CGLRendererInfoObj, then use 
the call:

            CGLDescribeRenderer (theRendererInfoObj, theRendererInex, 
kCGLRPVideoMemory,
                                  &deviceVRAM);

But I can't for the life of me figure out how to get from my 
NSOpenGLView to the renderer's CGLRendererInfoObj. I don't want to 
assume that the openGL view is on the main display, as all the example 
code I can find does.

Can somebody help me here? I'm going in circles with the 
documentation, and can't find an answer to this.



Thanks,

Duncan C

Related mailsAuthorDate
mlHow to get current renderer for an NSOpenGLView? Duncan Champney Mar 26, 22:54
mlRe: How to get current renderer for an NSOpenGLView? Troy Stephens Mar 27, 22:09