[Hdrflow-svn] SF.net SVN: hdrflow: [211] trunk/app/HDRFlow
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2007-07-28 14:32:42
|
Revision: 211 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=211&view=rev Author: glslang Date: 2007-07-28 07:32:36 -0700 (Sat, 28 Jul 2007) Log Message: ----------- +OpenGL fullscreen with context sharing Modified Paths: -------------- trunk/app/HDRFlow/CustomOpenGLView.m trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib trunk/app/HDRFlow/English.lproj/Preferences.nib/keyedobjects.nib trunk/app/HDRFlow/ViewportOpenGLView.h trunk/app/HDRFlow/ViewportOpenGLView.m Modified: trunk/app/HDRFlow/CustomOpenGLView.m =================================================================== --- trunk/app/HDRFlow/CustomOpenGLView.m 2007-07-28 13:44:32 UTC (rev 210) +++ trunk/app/HDRFlow/CustomOpenGLView.m 2007-07-28 14:32:36 UTC (rev 211) @@ -44,7 +44,7 @@ - ( NSOpenGLContext* ) openGLContext { - if( context_ == NULL ) + if( context_ == nil ) { context_ = [ [ NSOpenGLContext alloc ] initWithFormat: pixelFormat_ != nil ? pixelFormat_ : [ [ self class ] defaultPixelFormat ] shareContext: nil ]; [ context_ makeCurrentContext ]; Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib 2007-07-28 13:44:32 UTC (rev 210) +++ trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib 2007-07-28 14:32:36 UTC (rev 211) @@ -17,10 +17,10 @@ <string>446.1</string> <key>IBOpenObjects</key> <array> - <integer>33</integer> <integer>12</integer> <integer>5</integer> <integer>10</integer> + <integer>33</integer> </array> <key>IBSystem Version</key> <string>8R2218</string> Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/app/HDRFlow/ViewportOpenGLView.h =================================================================== --- trunk/app/HDRFlow/ViewportOpenGLView.h 2007-07-28 13:44:32 UTC (rev 210) +++ trunk/app/HDRFlow/ViewportOpenGLView.h 2007-07-28 14:32:36 UTC (rev 211) @@ -11,7 +11,7 @@ { } -+ ( NSOpenGLPixelFormat* ) pixelFormat; ++ ( NSOpenGLPixelFormat* ) viewportPixelFormat; - ( id ) initWithFrame: ( NSRect ) theFrame; - ( void ) awakeFromNib; Modified: trunk/app/HDRFlow/ViewportOpenGLView.m =================================================================== --- trunk/app/HDRFlow/ViewportOpenGLView.m 2007-07-28 13:44:32 UTC (rev 210) +++ trunk/app/HDRFlow/ViewportOpenGLView.m 2007-07-28 14:32:36 UTC (rev 211) @@ -12,13 +12,15 @@ @implementation ViewportOpenGLView -+ ( NSOpenGLPixelFormat* ) pixelFormat ++ ( NSOpenGLPixelFormat* ) viewportPixelFormat { NSOpenGLPixelFormatAttribute attribs[ ] = { + NSOpenGLPFANoRecovery, NSOpenGLPFADoubleBuffer, - NSOpenGLPFADepthSize, 24, - NSOpenGLPFAStencilSize, 8, + NSOpenGLPFAAccelerated, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFADepthSize, 16, 0 }; @@ -27,7 +29,7 @@ - ( id ) initWithFrame: ( NSRect ) theFrame { - [ super initWithFrame: theFrame pixelFormat: [ self pixelFormat ] ]; + [ super initWithFrame: theFrame pixelFormat: [ ViewportOpenGLView viewportPixelFormat ] ]; [ [ super openGLContext ] makeCurrentContext ]; return self; @@ -59,7 +61,10 @@ glViewport( 0, 0, NSWidth( bounds ), NSHeight( bounds ) ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); - glFlush( ); + if( [ self inLiveResize ] ) + glFlush( ); + else + [ [ self openGLContext ] flushBuffer ]; } - ( void ) prepareOpenGL @@ -83,16 +88,17 @@ NSOpenGLPixelFormatAttribute attribs[ ] = { NSOpenGLPFAFullScreen, + NSOpenGLPFAAccelerated, NSOpenGLPFAScreenMask, CGDisplayIDToOpenGLDisplayMask( kCGDirectMainDisplay ), NSOpenGLPFADoubleBuffer, - NSOpenGLPFADepthSize, 24, - NSOpenGLPFAStencilSize, 8, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFADepthSize, 16, 0 }; NSOpenGLPixelFormat* pixelFormat = [ [ [ NSOpenGLPixelFormat alloc ] initWithAttributes: attribs ] autorelease ]; - NSOpenGLContext* fullScreenContext = [ [ NSOpenGLContext alloc ] initWithFormat: pixelFormat shareContext: nil ]; + NSOpenGLContext* fullScreenContext = [ [ NSOpenGLContext alloc ] initWithFormat: pixelFormat shareContext: [ self openGLContext ] ]; if( fullScreenContext == nil ) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |