osg.GraphicsContext¶
-
class
osg.GraphicsContext¶ Represents: c++ class Wraps: osg::GraphicsContext Bases: osg.ObjectBase class for providing Windowing API agnostic access to creating and managing graphics context.
Methods:
-
:
add(osg.Operation operation)¶ Add operation to end of OperationQueue
Parameters: operation ( osg.Operation) –
-
:
remove(osg.Operation operation)¶ Remove operation from OperationQueue.
Parameters: operation ( osg.Operation) –
-
:
remove(std.string name) Remove named operation from OperationQueue.
Parameters: name ( std.string) –
-
:
removeAllOperations()¶ Remove all operations from OperationQueue.
-
:
runOperations()¶ Run the operations.
-
:
getCurrentOperation()¶ Get the current operations that is being run.
Return type: osg.Operation
-
:
getTraits()¶ Get the traits of the GraphicsContext.
Return type: osg.GraphicsContext.Traits
-
:
setState(osg.State state)¶ Set the
osg.Stateobject which tracks the current OpenGL state for this graphics context.Parameters: state ( osg.State) –
-
:
getState()¶ Get the
osg.Stateobject which tracks the current OpenGL state for this graphics context.Return type: osg.State
-
:
setClearMask(unsigned mask)¶ Set the clear mask used in
glClear(..)(https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glClear.xml). Defaults to0- so no clear is done by default by theosg.GraphicsContext, instead the Cameras attached to theosg.GraphicsContextwill do the clear.osg.GraphicsContext.setClearMask()is useful for when the Camera Viewports don’t cover the whole context, so the context will fill in the gaps.Parameters: mask ( unsigned) –
-
:
getClearMask()¶ Get the clear mask.
Return type: unsigned
-
:
clear()¶ Do an OpenGL clear of the full graphics context/window. Note, must only be called from a thread with this context current.
-
:
getTimeSinceLastClear()¶ -
Return type: double
-
:
realize()¶ Realize the
osg.GraphicsContext.Return type: bool
-
:
isRealized()¶ Return
trueif theosg.GraphicsContexthas been realized and is ready to use.Return type: bool
-
:
close()¶ Short version.
close()call with callCloseImplementation equal totrue.
-
:
close(bool callCloseImplementation) Close the
osg.GraphicsContext.osg.GraphicsContext.close(bool)()stops any associated graphics threads, releases the contextID for the GraphicsContext then optional callsosg.GraphicsContext.closeImplementation()to do the actual deletion of the graphics. This call is made optional as there are times when theosg.GraphicsContexthas already been deleted externally and only the OSG side of the its data need to be closed down.Parameters: callCloseImplementation ( bool) –
-
:
swapBuffers()¶ Swap the front and back buffers.
-
:
makeCurrent()¶ Make this graphics context current. Implemented by calling
osg.GraphicsContext.makeCurrentImplementation(). Returnstrueon success.
-
:
makeContextCurrent(osg.GraphicsContext context)¶ Make this graphics context current with specified read context. Implemented by calling
osg.GraphicsContext.makeCurrentImplementation(). Returnstrueon success.Parameters: context ( osg.GraphicsContext) –
-
:
releaseContext()¶ Release the graphics context. Returns
trueon success.Return type: bool
-
:
isCurrent()¶ Return
trueif the current thread has this OpenGL graphics context.Return type: bool
-
:
bindPBufferToTexture(unsigned buffer)¶ Bind the graphics context to associated texture.
Parameters: buffer ( unsigned) –
-
:
createGraphicsThread()¶ Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
-
:
realizeImplementation()¶ Realize the GraphicsContext implementation. Pure virtual - must be implemented by concrete implementations of
osg.GraphicsContext.Return type: bool
-
:
isRealizedImplementation()¶ Return
trueif the graphics context has been realized, and is ready to use, implementation. Pure virtual - must be implemented by concrete implementations ofosg.GraphicsContext.Return type: bool
-
:
closeImplementation()¶
-
:
makeCurrentImplementation()¶ Make this graphics context current implementation. Pure virtual - must be implemented by concrete implementations of
osg.GraphicsContext.Return type: bool
-
:
makeContextCurrentImplementation(osg.GraphicsContext readContext)¶ Make this graphics context current with specified read context implementation. Pure virtual - must be implemented by concrete implementations of
osg.GraphicsContext.Parameters: readContext ( osg.GraphicsContext) –Return type: bool
-
:
releaseContextImplementation()¶ Release the graphics context implementation. Pure virtual - must be implemented by concrete implementations of
osg.GraphicsContext.Return type: bool
-
:
bindPBufferToTextureImplementation(unsigned buffer)¶ Pure virtual, Bind the graphics context to associated texture implementation. Pure virtual - must be implemented by concrete implementations of
osg.GraphicsContext.Parameters: buffer ( unsigned) –
-
:
setSwapCallback(osg.GraphicsContext.SwapCallback cb)¶ Set the swap callback which overrides the
osg.GraphicsContext.swapBuffersImplementation(), allowing developers to provide custom behavior for swap. The callback must callosg.GraphicsContext.swapBuffersImplementation().Parameters: cb ( osg.GraphicsContext.SwapCallback) –
-
:
getSwapCallback()¶ Get the
osg.GraphicsContext.SwapCallbackcallback which overrides theosg.GraphicsContext.swapBuffersImplementation().Return type: osg.GraphicsContext.SwapCallback
-
:
swapBuffersImplementation()¶ Swap the front and back buffers implementation. Pure virtual - must be implemented by concrete implementations of
osg.GraphicsContext.
-
:
resized(int x, int y, int width, int height)¶ Resized method should be called when the underlying window has been resized and the
osgViewer.GraphicsWindowand associated Cameras must be updated to keep in sync with the new size.Parameters: - x (
int) – - y (
int) – - width (
int) – - height (
int) –
- x (
-
:
setResizedCallback(osg.GraphicsContext.ResizedCallback cb)¶ Set the resized callback which overrides the
osg.GraphicsConext.resizedImplementation(), allow developers to provide custom behavior in response to a window being resized.Parameters: cb ( osg.GraphicsContext.ResizedCallback) –
-
:
getResizedCallback()¶ Get the resized callback which overrides the
osg.GraphicsConext.resizedImplementation().Return type: osg.GraphicsContext.ResizedCallback
-
:
resizedImplementation(int x, int y, int width, int height)¶ Resized implementation, by default resizes the viewports and aspect ratios the cameras associated with the
osgViewer.GraphicsWindow.Parameters: - x (
int) – - y (
int) – - width (
int) – - height (
int) –
- x (
Static Methods:
-
.
createGraphicsContext(osg.GraphicsContext.Traits traits)¶ Create a graphics context for a specified set of
osg.GraphicsContext.Traits.Parameters: traits ( osg.GraphicsContext.Traits) –Return type: osg.GraphicsContext
-
: