osg.GraphicsContext¶
- class osg.GraphicsContext¶
- Represents
c++ class
- Wraps
osg::GraphicsContext
- Bases
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.
- Тип результата
- :getTraits()¶
Get the traits of the GraphicsContext.
- Тип результата
- :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.- Тип результата
- :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.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 theosg.GraphicsContext
has been realized and is ready to use.- Тип результата
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.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()
. Returnstrue
on success.
- :makeContextCurrent(osg.GraphicsContext context)¶
Make this graphics context current with specified read context. Implemented by calling
osg.GraphicsContext.makeCurrentImplementation()
. Returnstrue
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 ofosg.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 callosg.GraphicsContext.swapBuffersImplementation()
.- Параметры
- :getSwapCallback()¶
Get the
osg.GraphicsContext.SwapCallback
callback which overrides theosg.GraphicsContext.swapBuffersImplementation()
.- Тип результата
- :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.- Параметры
- :getResizedCallback()¶
Get the resized callback which overrides the
osg.GraphicsConext.resizedImplementation()
.- Тип результата
- :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
) –- Тип результата