Vuo  1.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Instance Methods | Protected Attributes | Properties | List of all members
VuoWindowOpenGLView Class Reference

Description

Helper for VuoWindowOpenGLInternal.

Instance Methods

(id) - initWithFrame:initCallback:updateBackingCallback:resizeCallback:drawCallback:drawContext:
 Creates an OpenGL view that calls the given callbacks for rendering.
 
(void) - setFullScreen:onScreen:
 Switches between full-screen and windowed mode.
 
(BOOL) - isFullScreen
 Returns YES if this window is currently fullscreen.
 
(void) - scheduleRedraw
 Schedules the OpenGL view to be redrawn.
 

Protected Attributes

void(* initCallback )(VuoGlContext glContext, float backingScaleFactor, void *)
 Initializes the OpenGL context.
 
bool initCallbackCalled
 Has the init callback already been called?
 
void(* updateBackingCallback )(VuoGlContext glContext, void *, float backingScaleFactor)
 Called when the screen changes.
 
void(* resizeCallback )(VuoGlContext glContext, void *, unsigned int width, unsigned int height)
 Updates the OpenGL context when the view is resized.
 
void(* drawCallback )(VuoGlContext glContext, void *)
 Draws onto the OpenGL context.
 
void * drawContext
 Argument to pass to callbacks (e.g. node instance data).
 
bool callerRequestedRedraw
 True if an external caller (i.e., not resize or setFullScreen) requested that the GL view be redrawn.
 
NSImage * circleImage
 The touch-circle mouse cursor.
 
NSRect circleRect
 The bounding box of circleImage.
 

Properties

VuoWindowOpenGLInternalglWindow
 The parent window; allows the view to access it while full-screen.
 
NSOpenGLContext * windowedGlContext
 The OpenGL context from Vuo's context pool; allows the windw to access it while the view is full-screen.
 
dispatch_queue_t drawQueue
 Queue to ensure that multiple threads don't attempt to draw to the same window simultaneously.
 
NSRect viewport
 The viewport in which we're rendering (it might not match the view's dimensions), relative to the parent view. In points (not pixels).
 
bool reshapeNeeded
 True if the view needs to recalculate the glViewport before drawing.
 
bool skipDrawRect
 True if drawRect should be temporarily ignored (e.g., during resizing).
 

Method Documentation

- (id) initWithFrame: (NSRect)  frame
initCallback: (VuoGlContext glContext, float backingScaleFactor, void *)  _initCallback
updateBackingCallback: (VuoGlContext glContext, void *, float backingScaleFactor)  _updateBackingCallback
resizeCallback: (VuoGlContext glContext, void *, unsigned int width, unsigned int height)  _resizeCallback
drawCallback: (VuoGlContext glContext, void *)  _drawCallback
drawContext: (void *)  _drawContext 

Creates an OpenGL view that calls the given callbacks for rendering.

This function may only be called on the main thread.

- (BOOL) isFullScreen

Returns YES if this window is currently fullscreen.

- (void) scheduleRedraw

Schedules the OpenGL view to be redrawn.

This can be used in both windowed and full-screen mode.

This function may be called from any thread.

- (void) setFullScreen: (BOOL)  wantsFullScreen
onScreen: (NSScreen *)  screen 

Switches between full-screen and windowed mode.

"Fullscreen" can mean 3 different things:

  1. -[NSView enterFullScreenMode:withOptions:]
    • 10.5+
    • we don't use this at all
  2. Vuo's custom fullscreen mode —
    • instant (no transition animation)
    • achieved by removing the titlebar and resizing the window
    • can go fullscreen on any user-specified VuoScreen
    • can have multiple windows fullscreen simultaneously
  3. -[NSWindow toggleFullScreen:]
    • optional in 10.7 – 10.10, mandatory in 10.11+
    • painfully slow transition animation
    • can only have one window fullscreen when System Preferences > Mission Control > Displays have separate Spaces is unchecked

Vuo uses #2 whenever possible (when triggered by ⌘F or a node), and since #3 is now mandatory, Vuo supports it where needed — when the user presses the green button in the titlebar:

  • the window goes fullscreen (#3)
  • Vuo applies aspect-locking to the interior GL viewport
  • pressing ⌘F or ESC, or using the Change Fullscreen Status node, initiates the painfully-slow transition back to windowed mode, symmetric to how the user entered fullscreen mode

This function may only be called on the main thread.

Member Data Documentation

- (bool) callerRequestedRedraw
protected

True if an external caller (i.e., not resize or setFullScreen) requested that the GL view be redrawn.

- (NSImage*) circleImage
protected

The touch-circle mouse cursor.

- (NSRect) circleRect
protected

The bounding box of circleImage.

- (void(* drawCallback)(VuoGlContext glContext, void *))
protected

Draws onto the OpenGL context.

- (void*) drawContext
protected

Argument to pass to callbacks (e.g. node instance data).

- (void(* initCallback)(VuoGlContext glContext, float backingScaleFactor, void *))
protected

Initializes the OpenGL context.

- (bool) initCallbackCalled
protected

Has the init callback already been called?

- (void(* resizeCallback)(VuoGlContext glContext, void *, unsigned int width, unsigned int height))
protected

Updates the OpenGL context when the view is resized.

- (void(* updateBackingCallback)(VuoGlContext glContext, void *, float backingScaleFactor))
protected

Called when the screen changes.

Property Documentation

- (dispatch_queue_t) drawQueue
readwriteatomicassign

Queue to ensure that multiple threads don't attempt to draw to the same window simultaneously.

- (VuoWindowOpenGLInternal*) glWindow
readwriteatomicassign

The parent window; allows the view to access it while full-screen.

- (bool) reshapeNeeded
readwriteatomic

True if the view needs to recalculate the glViewport before drawing.

- (bool) skipDrawRect
readwriteatomic

True if drawRect should be temporarily ignored (e.g., during resizing).

- (NSRect) viewport
readwriteatomic

The viewport in which we're rendering (it might not match the view's dimensions), relative to the parent view. In points (not pixels).

- (NSOpenGLContext*) windowedGlContext
readwriteatomicretain

The OpenGL context from Vuo's context pool; allows the windw to access it while the view is full-screen.


The documentation for this class was generated from the following files: