omegalib  13.1
omega::GpuContext Class Reference

A class managing all resources associated with a single GPU context. More...

#include <GpuResource.h>

Public Types

enum  TextureUnit {
  TextureUnitInvalid = 0, TextureUnit0 = GL_TEXTURE0, TextureUnit1 = GL_TEXTURE1, TextureUnit2 = GL_TEXTURE2,
  TextureUnit3 = GL_TEXTURE3
}
 

Public Member Functions

 GpuContext (GLEWContext *ctx=NULL)
 Initializes a GPU context. More...
 
 ~GpuContext ()
 
uint getId () const
 
GLEWContextgetGlewContext ()
 
void makeCurrent ()
 
void garbageCollect ()
 Destroys all GPU resources that are not referenced anywhere. More...
 
TexturecreateTexture ()
 Resource management. More...
 
RenderTargetcreateRenderTarget (uint type)
 
GpuProgramcreateProgram ()
 
VertexBuffercreateVertexBuffer ()
 
VertexArraycreateVertexArray ()
 
- Public Member Functions inherited from omicron::ReferenceType
 ReferenceType ()
 
virtual ~ReferenceType ()
 
void ref ()
 
void unref ()
 
long refCount ()
 

Static Public Attributes

static const unsigned int MaxContexts = 64
 

Additional Inherited Members

- Static Public Member Functions inherited from omicron::ReferenceType
static void printObjCounts ()
 
- Static Protected Attributes inherited from omicron::ReferenceType
static List< ReferenceType * > mysObjList
 

Detailed Description

A class managing all resources associated with a single GPU context.

+ Inheritance diagram for omega::GpuContext:

Member Enumeration Documentation

Enumerator
TextureUnitInvalid 
TextureUnit0 
TextureUnit1 
TextureUnit2 
TextureUnit3 

Constructor & Destructor Documentation

omega::GpuContext::GpuContext ( GLEWContext ctx = NULL)

Initializes a GPU context.

If the passed GLEW context is null, a glew context will be created internally and GLEW will be initialized by this contstructor.

Remarks
This method needs to be called from within a valid OpenGL context.
omega::GpuContext::~GpuContext ( )

Member Function Documentation

GpuProgram* omega::GpuContext::createProgram ( )
RenderTarget* omega::GpuContext::createRenderTarget ( uint  type)
Texture* omega::GpuContext::createTexture ( )

Resource management.

VertexArray* omega::GpuContext::createVertexArray ( )
VertexBuffer* omega::GpuContext::createVertexBuffer ( )
void omega::GpuContext::garbageCollect ( )

Destroys all GPU resources that are not referenced anywhere.

Remarks
This method is typically called by the Renderer at the end of each frame but can be invoked anywhere from the rendering thread associated with this context.
GLEWContext* omega::GpuContext::getGlewContext ( )
inline
uint omega::GpuContext::getId ( ) const
inline
void omega::GpuContext::makeCurrent ( )

Member Data Documentation

const unsigned int omega::GpuContext::MaxContexts = 64
static

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