Re: How to get current renderer for an NSOpenGLView?
Re: How to get current renderer for an NSOpenGLView?
- Subject: Re: How to get current renderer for an NSOpenGLView?
- From: Troy Stephens <email@hidden>
- Date: Thu, 27 Mar 2008 14:09:38 -0700
On Mar 26, 2008, at 2:54 PM, Duncan Champney wrote:
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.
On 10.5, you can get the CGLContext's CGLPixelFormat using
CGLGetPixelFormat(), and get the CGLPixelFormat's kCGLPFARendererID
using CGLDescribePixelFormat(). From that I think you should be able
to identify the applicable renderer from among those available.
That's the most direct route that I'm aware of, but you may be able to
get a better recommendation from the experts on the Mac-OpenGL list.
--
Troy Stephens
Cocoa Frameworks
Apple, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden