Keeps track of current OpenGL state, one instance is shared between all *GL -classes in the same rendering context. More...
#include <Luminous/StateGL.hpp>
Public Types | |
|
typedef std::map< GLuint, BufferMapping > | BufferMaps |
| Cache to keep track of mapped buffers. | |
Public Member Functions | |
| int64_t | availableUploadBytes () const |
| Get the number of bytes available for uploading content to the GPU. More... | |
| BufferMaps & | bufferMaps () |
| Get the cache for active buffer mappings. More... | |
| void | clearUploadedBytes () |
| Sets the number of available upload bytes to zero. More... | |
| void | consumeUploadBytes (int64_t bytes) |
| Consume the given amount of bytes from the upload budget. More... | |
| GLuint | drawFramebuffer () const |
| Get the handle to the current draw framebuffer. More... | |
| RenderDriverGL & | driver () |
| Get the render driver associated with this state. More... | |
| Radiant::TimeStamp | frameTime () const |
| Get the current frame time. More... | |
| GLuint | program () const |
| Get the current program object handle. More... | |
| GLuint | readFramebuffer () const |
| Get the handle to the current read framebuffer. More... | |
| bool | setFramebuffer (GLenum target, GLuint handle) |
| Set the current framebuffer. More... | |
| void | setFrameTime (Radiant::TimeStamp t) |
| Set the frame time. More... | |
| bool | setProgram (GLuint handle) |
| Sets the current program object. More... | |
| bool | setTextureUnit (int index) |
| Set the current active texture unit. More... | |
| void | setUpdateFrequency (int64_t fps) |
| Set the target update frequency. More... | |
| void | setUploadLimits (int64_t limit, int64_t margin) |
| Set the maximum and minimum number of bytes per second for uploading content to the GPU. More... | |
| bool | setVertexArray (GLuint handle) |
| Set the current vertex array. More... | |
| StateGL (unsigned int threadIndex, RenderDriverGL &driver) | |
| Constructor. More... | |
| int | textureUnit () const |
| Get the current active texture unit. More... | |
| unsigned int | threadIndex () const |
| Get the render thread index this state object was associated with. More... | |
| int64_t | uploadLimit () const |
| Get the maximum number of bytes per second used for uploading content to the GPU. More... | |
| int64_t | uploadMargin () const |
| Get the minimum number of bytes per second used for uploading content to the GPU. More... | |
| GLuint | vertexArray () const |
| Get the current vertex array. More... | |
Keeps track of current OpenGL state, one instance is shared between all *GL -classes in the same rendering context.
None of these functions actually modify any OpenGL state. This class is used to minimize OpenGL state changes to improve rendering performance.
|
inline |
Constructor.
| threadIndex | render thread index |
| driver | render driver to use |
|
inline |
Get the number of bytes available for uploading content to the GPU.
This limit is used to spread heavy upload operations across multiple rendering frames to avoid stalling the application.
|
inline |
Get the cache for active buffer mappings.
|
inline |
Sets the number of available upload bytes to zero.
|
inline |
Consume the given amount of bytes from the upload budget.
This function decreases the upload budget by the given amount.
| bytes | number of bytes to consume |
|
inline |
Get the handle to the current draw framebuffer.
|
inline |
Get the render driver associated with this state.
|
inline |
Get the current frame time.
|
inline |
Get the current program object handle.
|
inline |
Get the handle to the current read framebuffer.
|
inline |
Set the current framebuffer.
| target | framebuffer target (GL_READ_FRAMEBUFFER, GL_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER) |
| handle | handle to the framebuffer |
|
inline |
Set the frame time.
The frame time is used to keep track of resource expiration.
| t | frame time |
|
inline |
Sets the current program object.
| handle | handle to the program object |
|
inline |
Set the current active texture unit.
Indexing starts from zero.
| index | texture unit index |
|
inline |
Set the target update frequency.
This is only used to calculate frame-based upload limits
| fps | target frames per second |
|
inline |
Set the maximum and minimum number of bytes per second for uploading content to the GPU.
| limit | maximum number of bytes to upload per second |
| margin | minimum number of bytes to upload per second |
|
inline |
Set the current vertex array.
| handle | vertex array handle |
|
inline |
Get the current active texture unit.
|
inline |
Get the render thread index this state object was associated with.
|
inline |
Get the maximum number of bytes per second used for uploading content to the GPU.
|
inline |
Get the minimum number of bytes per second used for uploading content to the GPU.
|
inline |
Get the current vertex array.