osg.GraphicsContext

class osg.GraphicsContext
Represents

c++ class

Wraps

osg::GraphicsContext

Bases

osg.Object

Base class for providing Windowing API agnostic access to creating and managing graphics context.

Methods:

:add(osg.Operation operation)

Add operation to end of OperationQueue

Параметры

operation (osg.Operation) –

:remove(osg.Operation operation)

Remove operation from OperationQueue.

Параметры

operation (osg.Operation) –

:remove(std.string name)

Remove named operation from OperationQueue.

Параметры

name (std.string) –

:removeAllOperations()

Remove all operations from OperationQueue.

:runOperations()

Run the operations.

:getCurrentOperation()

Get the current operations that is being run.

Тип результата

osg.Operation

:getTraits()

Get the traits of the GraphicsContext.

Тип результата

osg.GraphicsContext.Traits

:setState(osg.State state)

Set the osg.State object which tracks the current OpenGL state for this graphics context.

Параметры

state (osg.State) –

:getState()

Get the osg.State object which tracks the current OpenGL state for this graphics context.

Тип результата

osg.State

:setClearColor(osg.Vec4 color)

Sets the clear color.

Параметры

color (osg.Vec4) –

:getClearColor()

Returns the clear color.

Тип результата

osg.Vec4

:setClearMask(unsigned mask)

Set the clear mask used in glClear(..) (https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glClear.xml). Defaults to 0 - so no clear is done by default by the osg.GraphicsContext, instead the Cameras attached to the osg.GraphicsContext will 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.

Параметры

mask (unsigned) –

:getClearMask()

Get the clear mask.

Тип результата

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()

Тип результата

double

:realize()

Realize the osg.GraphicsContext.

Тип результата

bool

:isRealized()

Return true if the osg.GraphicsContext has been realized and is ready to use.

Тип результата

bool

:close()

Short version. close() call with callCloseImplementation equal to true.

:close(bool callCloseImplementation)

Close the osg.GraphicsContext. osg.GraphicsContext.close(bool)() stops any associated graphics threads, releases the contextID for the GraphicsContext then optional calls osg.GraphicsContext.closeImplementation() to do the actual deletion of the graphics. This call is made optional as there are times when the osg.GraphicsContext has already been deleted externally and only the OSG side of the its data need to be closed down.

Параметры

callCloseImplementation (bool) –

:swapBuffers()

Swap the front and back buffers.

:makeCurrent()

Make this graphics context current. Implemented by calling osg.GraphicsContext.makeCurrentImplementation(). Returns true on success.

:makeContextCurrent(osg.GraphicsContext context)

Make this graphics context current with specified read context. Implemented by calling osg.GraphicsContext.makeCurrentImplementation(). Returns true on success.

Параметры

context (osg.GraphicsContext) –

:releaseContext()

Release the graphics context. Returns true on success.

Тип результата

bool

:isCurrent()

Return true if the current thread has this OpenGL graphics context.

Тип результата

bool

:bindPBufferToTexture(unsigned buffer)

Bind the graphics context to associated texture.

Параметры

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.

Тип результата

bool

:isRealizedImplementation()

Return true if the graphics context has been realized, and is ready to use, implementation. Pure virtual - must be implemented by concrete implementations of osg.GraphicsContext.

Тип результата

bool

:closeImplementation()

:makeCurrentImplementation()

Make this graphics context current implementation. Pure virtual - must be implemented by concrete implementations of osg.GraphicsContext.

Тип результата

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.

Параметры

readContext (osg.GraphicsContext) –

Тип результата

bool

:releaseContextImplementation()

Release the graphics context implementation. Pure virtual - must be implemented by concrete implementations of osg.GraphicsContext.

Тип результата

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.

Параметры

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 call osg.GraphicsContext.swapBuffersImplementation().

Параметры

cb (osg.GraphicsContext.SwapCallback) –

:getSwapCallback()

Get the osg.GraphicsContext.SwapCallback callback which overrides the osg.GraphicsContext.swapBuffersImplementation().

Тип результата

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.GraphicsWindow and associated Cameras must be updated to keep in sync with the new size.

Параметры
  • x (int) –

  • y (int) –

  • width (int) –

  • height (int) –

: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.

Параметры

cb (osg.GraphicsContext.ResizedCallback) –

:getResizedCallback()

Get the resized callback which overrides the osg.GraphicsConext.resizedImplementation().

Тип результата

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.

Параметры
  • x (int) –

  • y (int) –

  • width (int) –

  • height (int) –

Static Methods:

.createGraphicsContext(osg.GraphicsContext.Traits traits)

Create a graphics context for a specified set of osg.GraphicsContext.Traits.

Параметры

traits (osg.GraphicsContext.Traits) –

Тип результата

osg.GraphicsContext