| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
The resources pointed to by others are very valuable. The bottom line is this is simply a renderer selection in your pixel format attribs. You may want to also check the extensions string (a good habit to have). These code snippets should be helpful. CGL: This is a simple GLSL init routine I use for tests... int glInit (void) { SInt32 osVersion = 0; int validEnvironment = 1; CGLPixelFormatAttribute attribs[] = { kCGLPFADisplayMask, CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID()), kCGLPFARendererID, kCGLRendererGenericFloatID, /* floating point software renderer */ 0 }; CGLPixelFormatObj pixelFormat = NULL; long numPixelFormats = 0; CGLChoosePixelFormat (attribs, &pixelFormat, &numPixelFormats); if (pixelFormat) { CGLCreateContext(pixelFormat, NULL, &cglContext); CGLDestroyPixelFormat (pixelFormat); CGLSetCurrentContext (cglContext); /* must have these 4 extensions for GLSL support */ if (!gluCheckExtension("GL_ARB_shader_objects", glGetString (GL_EXTENSIONS)) || !gluCheckExtension("GL_ARB_vertex_shader", glGetString (GL_EXTENSIONS)) || !gluCheckExtension("GL_ARB_fragment_shader", glGetString (GL_EXTENSIONS)) || !gluCheckExtension("GL_ARB_shading_language_100", glGetString (GL_EXTENSIONS))) validEnvironment = 0; } if (Gestalt(gestaltSystemVersion, &osVersion) == noErr) printf ("system: Mac OS X v10.%ld.%ld\n", (osVersion - 0x1000) / 0x10, (osVersion - 0x1000) % 0x10); return validEnvironment; } void glDispose (void) { CGLDestroyContext (cglContext); } You need a pixel format for the float renderer: // pixel format definition + (NSOpenGLPixelFormat*) floatPixelFormat { NSOpenGLPixelFormatAttribute attributes [] = { NSOpenGLPFAWindow, NSOpenGLPFADoubleBuffer, // double buffered NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)32, // 32 bit depth buffer NSOpenGLPFARendererID, kCGLRendererGenericFloatID, // software renderer (NSOpenGLPixelFormatAttribute)nil }; return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; } and a context: [[NSOpenGLContext alloc] initWithFormat: [GLSLView floatPixelFormat] shareContext:nil] Carbon: (something like...) GLint attrib[] = { AGL_RGBA, AGL_DOUBLEBUFFER, AGL_DEPTH_SIZE, 32, AGL_RENDERER_ID, AGL_RENDERER_GENERIC_FLOAT_ID, AGL_NONE }; aglPixFmt = aglChoosePixelFormat(NULL, 0, attrib); if (aglPixFmt) aglContext = aglCreateContext(aglPixFmt, NULL); if (aglContext) { aglSetDrawable(aglContext, GetWindowPort (window)); aglSetCurrentContext(pContextInfo->aglContext); } Geoff Stahl 3D Software Engineer Apple On May 17, 2005, at 4:02 PM, email@hidden wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden This email sent to email@hidden
| References: | |
| >please post GLSL software rendering example (From: email@hidden) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.