Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 14th, 2012  |  syntax: Objective C  |  size: 0.55 KB  |  hits: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. - (void) drawView
  2. {        
  3.         [[self openGLContext] makeCurrentContext];
  4.    
  5.         // We draw on a secondary thread through the display link
  6.         // When resizing the view, -reshape is called automatically on the main thread
  7.         // Add a mutex around to avoid the threads accessing the context simultaneously when resizing
  8.         CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
  9.  
  10.         g_Render();
  11.  
  12.         CGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);
  13.         CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
  14.    
  15. }