Back to index

nux  3.0.0
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends
nux::GpuDevice Class Reference

The interface to the GPU. More...

#include <GpuDevice.h>

Collaboration diagram for nux::GpuDevice:
Collaboration graph
[legend]

List of all members.

Classes

struct  PixelBufferObject

Public Member Functions

ObjectPtr< IOpenGLTexture2DCreateTexture (int Width, int Height, int Levels, BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO)
ObjectPtr< IOpenGLTexture2DCreateTexture2DFromID (int id, int Width, int Height, int Levels, BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO)
ObjectPtr
< IOpenGLRectangleTexture
CreateRectangleTexture (int Width, int Height, int Levels, BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO)
ObjectPtr< IOpenGLCubeTextureCreateCubeTexture (int EdgeLength, int Levels, BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO)
ObjectPtr< IOpenGLVolumeTextureCreateVolumeTexture (int Width, int Height, int Depth, int Levels, BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO)
ObjectPtr< IOpenGLAnimatedTextureCreateAnimatedTexture (int Width, int Height, int Depth, BitmapFormat PixelFormat)
ObjectPtr< IOpenGLVertexBufferCreateVertexBuffer (int Length, VBO_USAGE Usage)
ObjectPtr< IOpenGLIndexBufferCreateIndexBuffer (int Length, VBO_USAGE Usage, INDEX_FORMAT Format)
ObjectPtr
< IOpenGLPixelBufferObject
CreatePixelBufferObject (int Size, VBO_USAGE Usage)
ObjectPtr< IOpenGLQueryCreateQuery (QUERY_TYPE Type)
ObjectPtr
< IOpenGLVertexDeclaration
CreateVertexDeclaration (const VERTEXELEMENT *pVertexElements)
ObjectPtr
< IOpenGLFrameBufferObject
CreateFrameBufferObject ()
ObjectPtr< IOpenGLShaderProgramCreateShaderProgram ()
ObjectPtr< IOpenGLVertexShaderCreateVertexShader ()
ObjectPtr< IOpenGLPixelShaderCreatePixelShader ()
ObjectPtr
< IOpenGLAsmShaderProgram
CreateAsmShaderProgram ()
ObjectPtr< IOpenGLAsmVertexShaderCreateAsmVertexShader ()
ObjectPtr< IOpenGLAsmPixelShaderCreateAsmPixelShader ()
int SetTexture (unsigned int TextureUnit, IOpenGLBaseTexture *texture)
int DrawIndexedPrimitive (ObjectPtr< IOpenGLIndexBuffer > IndexBuffer, ObjectPtr< IOpenGLVertexDeclaration > VertexDeclaration, PRIMITIVE_TYPE PrimitiveType, int PrimitiveCount)
int DrawPrimitive (ObjectPtr< IOpenGLVertexDeclaration > VertexDeclaration, PRIMITIVE_TYPE pt_, unsigned vtx_start_, unsigned num_prims_)
int DrawPrimitiveUP (ObjectPtr< IOpenGLVertexDeclaration > VertexDeclaration, PRIMITIVE_TYPE PrimitiveType, unsigned int PrimitiveCount, const void *pVertexStreamZeroData, unsigned int VertexStreamZeroStride)
int SetStreamSource (unsigned int StreamNumber, ObjectPtr< IOpenGLVertexBuffer > pStreamData, unsigned int OffsetInBytes, unsigned int Stride)
void InvalidateVertexBuffer ()
 Setup a NULL vertex buffer.
void InvalidateIndexBuffer ()
 Setup a NULL index buffer.
void InvalidateTextureUnit (int TextureUnitIndex)
 Setup a NULL texture.
unsigned int GetPixelStoreAlignment ()
int AllocateUnpackPixelBufferIndex (int *index)
int FreeUnpackPixelBufferIndex (const int index)
int BindUnpackPixelBufferIndex (const int index)
int BindPackPixelBufferIndex (const int index)
void * LockUnpackPixelBufferIndex (const int index, const int Size)
void * LockPackPixelBufferIndex (const int index, const int Size)
void UnlockUnpackPixelBufferIndex (const int index)
void UnlockPackPixelBufferIndex (const int index)
int FormatFrameBufferObject (unsigned int Width, unsigned int Height, BitmapFormat PixelFormat)
int SetColorRenderTargetSurface (unsigned int ColorAttachmentIndex, ObjectPtr< IOpenGLSurface > pRenderTargetSurface)
int SetDepthRenderTargetSurface (ObjectPtr< IOpenGLSurface > pDepthSurface)
ObjectPtr< IOpenGLSurfaceGetColorRenderTargetSurface (unsigned int ColorAttachmentIndex)
ObjectPtr< IOpenGLSurfaceGetDepthRenderTargetSurface ()
void ActivateFrameBuffer ()
void DeactivateFrameBuffer ()
 Restore the backbuffer as the render target.
void SetCurrentFrameBufferObject (ObjectPtr< IOpenGLFrameBufferObject > fbo)
ObjectPtr
< IOpenGLFrameBufferObject
GetCurrentFrameBufferObject ()
int GetOpenGLMajorVersion () const
int GetOpenGLMinorVersion () const
bool UsePixelBufferObjects () const
GpuBrand GetGPUBrand () const
GpuRenderStatesGetRenderStates ()
GpuInfoGetGpuInfo ()
void ResetRenderStates ()
void VerifyRenderStates ()
ObjectPtr< IOpenGLBaseTextureCreateSystemCapableDeviceTexture (int Width, int Height, int Levels, BitmapFormat PixelFormat, NUX_FILE_LINE_PROTO)
 Create a texture that the system supports. Rectangle texture or 2D texture.
BaseTextureCreateSystemCapableTexture (NUX_FILE_LINE_PROTO)
 Created a cached texture.
bool SUPPORT_GL_ARB_TEXTURE_NON_POWER_OF_TWO () const
bool SUPPORT_GL_EXT_TEXTURE_RECTANGLE () const
bool SUPPORT_GL_ARB_TEXTURE_RECTANGLE () const
 ~GpuDevice ()

Public Attributes

ObjectPtr< IOpenGLTexture2Dbackup_texture0_

Private Member Functions

int CreateTexture (unsigned int Width, unsigned int Height, unsigned int Levels, BitmapFormat PixelFormat, IOpenGLTexture2D **ppTexture, NUX_FILE_LINE_PROTO)
int CreateRectangleTexture (unsigned int Width, unsigned int Height, unsigned int Levels, BitmapFormat PixelFormat, IOpenGLRectangleTexture **ppTexture, NUX_FILE_LINE_PROTO)
int CreateCubeTexture (unsigned int EdgeLength, unsigned int Levels, BitmapFormat PixelFormat, IOpenGLCubeTexture **ppCubeTexture, NUX_FILE_LINE_PROTO)
int CreateVolumeTexture (unsigned int Width, unsigned int Height, unsigned int Depth, unsigned int Levels, BitmapFormat PixelFormat, IOpenGLVolumeTexture **ppVolumeTexture, NUX_FILE_LINE_PROTO)
int CreateAnimatedTexture (unsigned int Width, unsigned int Height, unsigned int Depth, BitmapFormat PixelFormat, IOpenGLAnimatedTexture **ppAnimatedTexture)
int CreateVertexBuffer (unsigned int Length, VBO_USAGE Usage, IOpenGLVertexBuffer **ppVertexBuffer)
int CreateIndexBuffer (unsigned int Length, VBO_USAGE Usage, INDEX_FORMAT Format, IOpenGLIndexBuffer **ppIndexBuffer)
int CreatePixelBufferObject (int Size, VBO_USAGE Usage, IOpenGLPixelBufferObject **ppPixelBufferObject)
int CreateQuery (QUERY_TYPE Type, IOpenGLQuery **ppQuery)
int CreateVertexDeclaration (const VERTEXELEMENT *pVertexElements, IOpenGLVertexDeclaration **ppDecl)
int CreateFrameBufferObject (IOpenGLFrameBufferObject **ppFrameBufferObject)
int CreateShaderProgram (IOpenGLShaderProgram **ppShaderProgram)
int CreateVertexShader (IOpenGLVertexShader **ppVertexShader)
int CreatePixelShader (IOpenGLPixelShader **ppPixelShader)
int CreateAsmShaderProgram (IOpenGLAsmShaderProgram **ppAsmShaderProgram)
int CreateAsmVertexShader (IOpenGLAsmVertexShader **ppAsmVertexShader)
int CreateAsmPixelShader (IOpenGLAsmPixelShader **ppAsmPixelShader)

Private Attributes

ObjectPtr
< IOpenGLFrameBufferObject
_FrameBufferObject
ObjectPtr
< IOpenGLFrameBufferObject
_CurrentFrameBufferObject
unsigned int _PixelStoreAlignment
std::vector< PixelBufferObject_PixelBufferArray
int _opengl_major
 OpenGL major version.
int _opengl_minor
 OpenGL minor version.
int _glsl_version_major
 GLSL major version.
int _glsl_version_minor
 GLSL major version.
NString _board_vendor_string
 GPU vendor sting.
NString _board_renderer_string
 GPU renderer sting.
NString _openGL_version_string
 OpenGL version string.
NString _glsl_version_string
 GLSL version string.
GpuBrand _gpu_brand
 GPU brand.
bool _UsePixelBufferObject
bool OGL_EXT_SWAP_CONTROL
bool GL_ARB_VERTEX_PROGRAM
bool GL_ARB_FRAGMENT_PROGRAM
bool GL_ARB_SHADER_OBJECTS
bool GL_ARB_VERTEX_SHADER
bool GL_ARB_FRAGMENT_SHADER
bool GL_ARB_VERTEX_BUFFER_OBJECT
bool GL_ARB_TEXTURE_NON_POWER_OF_TWO
bool GL_EXT_FRAMEBUFFER_OBJECT
bool GL_EXT_DRAW_RANGE_ELEMENTS
bool GL_EXT_STENCIL_TWO_SIDE
bool GL_EXT_TEXTURE_RECTANGLE
bool GL_ARB_TEXTURE_RECTANGLE
 Promoted from GL_EXT_TEXTURE_RECTANGLE to ARB.
bool GL_NV_TEXTURE_RECTANGLE
GpuRenderStates_gpu_render_states
GpuInfo_gpu_info

Static Private Attributes

static STREAMSOURCE _StreamSource [MAX_NUM_STREAM]

Friends

class IOpenGLSurface
class GraphicsEngine

Detailed Description

The interface to the GPU.

This is the object that serves as the interface between the program and the GPU device. The GpuDevice creates the opengl primitives used for rendering.

Definition at line 174 of file GpuDevice.h.


Class Documentation

struct nux::GpuDevice::PixelBufferObject

Definition at line 423 of file GpuDevice.h.

Collaboration diagram for nux::GpuDevice::PixelBufferObject:
Class Members
bool IsReserved
ObjectPtr
< IOpenGLPixelBufferObject >
PBO

Constructor & Destructor Documentation


Member Function Documentation

Here is the caller graph for this function:

int nux::GpuDevice::BindPackPixelBufferIndex ( const int  index)

Here is the caller graph for this function:

int nux::GpuDevice::CreateAnimatedTexture ( unsigned int  Width,
unsigned int  Height,
unsigned int  Depth,
BitmapFormat  PixelFormat,
IOpenGLAnimatedTexture **  ppAnimatedTexture 
) [private]

Definition at line 291 of file GpuDeviceTexture.cpp.

  {
    *ppAnimatedTexture = new IOpenGLAnimatedTexture(Width, Height, Depth, PixelFormat);

    return OGL_OK;
  }

Here is the caller graph for this function:

ObjectPtr< IOpenGLAnimatedTexture > nux::GpuDevice::CreateAnimatedTexture ( int  Width,
int  Height,
int  Depth,
BitmapFormat  PixelFormat 
)

Definition at line 278 of file GpuDeviceTexture.cpp.

  {
    IOpenGLAnimatedTexture *ptr;
    CreateAnimatedTexture(Width, Height, Depth, PixelFormat, (IOpenGLAnimatedTexture **) &ptr);
    ObjectPtr<IOpenGLAnimatedTexture> h = ObjectPtr<IOpenGLAnimatedTexture> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateAsmPixelShader ( IOpenGLAsmPixelShader **  ppAsmPixelShader) [private]

Definition at line 125 of file GpuDeviceShader.cpp.

  {
    *ppAsmPixelShader = new IOpenGLAsmPixelShader();

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 116 of file GpuDeviceShader.cpp.

  {
    IOpenGLAsmPixelShader *ptr;
    CreateAsmPixelShader((IOpenGLAsmPixelShader **) &ptr);
    ObjectPtr<IOpenGLAsmPixelShader> h = ObjectPtr<IOpenGLAsmPixelShader> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateAsmShaderProgram ( IOpenGLAsmShaderProgram **  ppAsmShaderProgram) [private]

Definition at line 93 of file GpuDeviceShader.cpp.

  {
    *ppAsmShaderProgram = new IOpenGLAsmShaderProgram();

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 84 of file GpuDeviceShader.cpp.

  {
    IOpenGLAsmShaderProgram *ptr;
    CreateAsmShaderProgram((IOpenGLAsmShaderProgram **) &ptr);
    ObjectPtr<IOpenGLAsmShaderProgram> h = ObjectPtr<IOpenGLAsmShaderProgram> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateAsmVertexShader ( IOpenGLAsmVertexShader **  ppAsmVertexShader) [private]

Definition at line 109 of file GpuDeviceShader.cpp.

  {
    *ppAsmVertexShader = new IOpenGLAsmVertexShader();

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 100 of file GpuDeviceShader.cpp.

  {
    IOpenGLAsmVertexShader *ptr;
    CreateAsmVertexShader((IOpenGLAsmVertexShader **) &ptr);
    ObjectPtr<IOpenGLAsmVertexShader> h = ObjectPtr<IOpenGLAsmVertexShader> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateCubeTexture ( unsigned int  EdgeLength,
unsigned int  Levels,
BitmapFormat  PixelFormat,
IOpenGLCubeTexture **  ppCubeTexture,
NUX_FILE_LINE_PROTO   
) [private]

Here is the caller graph for this function:

ObjectPtr<IOpenGLCubeTexture> nux::GpuDevice::CreateCubeTexture ( int  EdgeLength,
int  Levels,
BitmapFormat  PixelFormat,
NUX_FILE_LINE_PROTO   
)
int nux::GpuDevice::CreateFrameBufferObject ( IOpenGLFrameBufferObject **  ppFrameBufferObject) [private]

Here is the caller graph for this function:

int nux::GpuDevice::CreateIndexBuffer ( unsigned int  Length,
VBO_USAGE  Usage,
INDEX_FORMAT  Format,
IOpenGLIndexBuffer **  ppIndexBuffer 
) [private]

Definition at line 70 of file GpuDeviceVertex.cpp.

  {
    *ppIndexBuffer = new IOpenGLIndexBuffer(Length, Usage, Format, NUX_TRACKER_LOCATION);

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 58 of file GpuDeviceVertex.cpp.

  {
    IOpenGLIndexBuffer *ptr;
    CreateIndexBuffer(Length, Usage, Format, (IOpenGLIndexBuffer **) &ptr);
    ObjectPtr<IOpenGLIndexBuffer> h = ObjectPtr<IOpenGLIndexBuffer> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreatePixelBufferObject ( int  Size,
VBO_USAGE  Usage,
IOpenGLPixelBufferObject **  ppPixelBufferObject 
) [private]

Definition at line 89 of file GpuDeviceVertex.cpp.

  {
    *ppPixelBufferObject = new IOpenGLPixelBufferObject(Size, Usage, NUX_TRACKER_LOCATION);

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 80 of file GpuDeviceVertex.cpp.

  {
    IOpenGLPixelBufferObject *ptr;
    CreatePixelBufferObject(Size, Usage, (IOpenGLPixelBufferObject **) &ptr);
    ObjectPtr<IOpenGLPixelBufferObject> h = ObjectPtr<IOpenGLPixelBufferObject> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreatePixelShader ( IOpenGLPixelShader **  ppPixelShader) [private]

Definition at line 77 of file GpuDeviceShader.cpp.

  {
    *ppPixelShader = new IOpenGLPixelShader();

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 68 of file GpuDeviceShader.cpp.

  {
    IOpenGLPixelShader *ptr;
    CreatePixelShader((IOpenGLPixelShader **) &ptr);
    ObjectPtr<IOpenGLPixelShader> h = ObjectPtr<IOpenGLPixelShader> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateQuery ( QUERY_TYPE  Type,
IOpenGLQuery **  ppQuery 
) [private]

Definition at line 311 of file GpuDeviceTexture.cpp.

  {
    *ppQuery = new IOpenGLQuery(Type);

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 302 of file GpuDeviceTexture.cpp.

  {
    IOpenGLQuery *ptr;
    CreateQuery(Type, (IOpenGLQuery **) &ptr);
    ObjectPtr<IOpenGLQuery> h = ObjectPtr<IOpenGLQuery> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateRectangleTexture ( unsigned int  Width,
unsigned int  Height,
unsigned int  Levels,
BitmapFormat  PixelFormat,
IOpenGLRectangleTexture **  ppTexture,
NUX_FILE_LINE_PROTO   
) [private]

Here is the caller graph for this function:

ObjectPtr<IOpenGLRectangleTexture> nux::GpuDevice::CreateRectangleTexture ( int  Width,
int  Height,
int  Levels,
BitmapFormat  PixelFormat,
NUX_FILE_LINE_PROTO   
)
int nux::GpuDevice::CreateShaderProgram ( IOpenGLShaderProgram **  ppShaderProgram) [private]

Definition at line 45 of file GpuDeviceShader.cpp.

  {
    *ppShaderProgram = new IOpenGLShaderProgram();

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 36 of file GpuDeviceShader.cpp.

  {
    IOpenGLShaderProgram *ptr;
    CreateShaderProgram((IOpenGLShaderProgram **) &ptr);
    ObjectPtr<IOpenGLShaderProgram> h = ObjectPtr<IOpenGLShaderProgram> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

ObjectPtr<IOpenGLBaseTexture> nux::GpuDevice::CreateSystemCapableDeviceTexture ( int  Width,
int  Height,
int  Levels,
BitmapFormat  PixelFormat,
NUX_FILE_LINE_PROTO   
)

Create a texture that the system supports. Rectangle texture or 2D texture.

Texture width. Texture height. Texture number of mipmaps. If 0, all the mipmaps levels are created Texture format.

Returns:
A device texture. Depending on the system capabilities returns a ObjectPtr<IOpenGLTexture2D> or ObjectPtr<IOpenGLRectangleTexture>.

Here is the caller graph for this function:

Created a cached texture.

Returns:
A cached texture. Depending on the system capabilities, returns a Texture2D or TextureRectangle.

Here is the caller graph for this function:

int nux::GpuDevice::CreateTexture ( unsigned int  Width,
unsigned int  Height,
unsigned int  Levels,
BitmapFormat  PixelFormat,
IOpenGLTexture2D **  ppTexture,
NUX_FILE_LINE_PROTO   
) [private]

Here is the caller graph for this function:

ObjectPtr<IOpenGLTexture2D> nux::GpuDevice::CreateTexture ( int  Width,
int  Height,
int  Levels,
BitmapFormat  PixelFormat,
NUX_FILE_LINE_PROTO   
)
ObjectPtr< IOpenGLTexture2D > nux::GpuDevice::CreateTexture2DFromID ( int  id,
int  Width,
int  Height,
int  Levels,
BitmapFormat  PixelFormat,
NUX_FILE_LINE_PROTO   
)

Definition at line 100 of file GpuDeviceTexture.cpp.

  {
    IOpenGLTexture2D *ptr;
    ptr = new IOpenGLTexture2D(width, height, levels, pixel_format, true, NUX_FILE_LINE_PARAM); // ref count = 1;
    ptr->_OpenGLID = id;
    ObjectPtr<IOpenGLTexture2D> h = ObjectPtr<IOpenGLTexture2D> (ptr); // ref count = 2
    ptr->UnReference(); // ref count = 1
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateVertexBuffer ( unsigned int  Length,
VBO_USAGE  Usage,
IOpenGLVertexBuffer **  ppVertexBuffer 
) [private]

Definition at line 49 of file GpuDeviceVertex.cpp.

  {
    *ppVertexBuffer = new IOpenGLVertexBuffer(Length, Usage, NUX_TRACKER_LOCATION);

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 39 of file GpuDeviceVertex.cpp.

  {
    IOpenGLVertexBuffer *ptr;
    CreateVertexBuffer(Length, Usage, (IOpenGLVertexBuffer **) &ptr);
    ObjectPtr<IOpenGLVertexBuffer> h = ObjectPtr<IOpenGLVertexBuffer> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateVertexDeclaration ( const VERTEXELEMENT pVertexElements,
IOpenGLVertexDeclaration **  ppDecl 
) [private]

Definition at line 107 of file GpuDeviceVertex.cpp.

  {
    *ppDecl = new IOpenGLVertexDeclaration(pVertexElements);

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 97 of file GpuDeviceVertex.cpp.

  {
    IOpenGLVertexDeclaration *ptr;
    CreateVertexDeclaration(pVertexElements, (IOpenGLVertexDeclaration **) &ptr);
    ObjectPtr<IOpenGLVertexDeclaration> h = ObjectPtr<IOpenGLVertexDeclaration> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateVertexShader ( IOpenGLVertexShader **  ppVertexShader) [private]

Definition at line 61 of file GpuDeviceShader.cpp.

  {
    *ppVertexShader = new IOpenGLVertexShader();

    return OGL_OK;
  }

Here is the caller graph for this function:

Definition at line 52 of file GpuDeviceShader.cpp.

  {
    IOpenGLVertexShader *ptr;
    CreateVertexShader((IOpenGLVertexShader **) &ptr);
    ObjectPtr<IOpenGLVertexShader> h = ObjectPtr<IOpenGLVertexShader> (ptr);
    ptr->UnReference();
    return h;
  }

Here is the call graph for this function:

int nux::GpuDevice::CreateVolumeTexture ( unsigned int  Width,
unsigned int  Height,
unsigned int  Depth,
unsigned int  Levels,
BitmapFormat  PixelFormat,
IOpenGLVolumeTexture **  ppVolumeTexture,
NUX_FILE_LINE_PROTO   
) [private]

Here is the caller graph for this function:

ObjectPtr<IOpenGLVolumeTexture> nux::GpuDevice::CreateVolumeTexture ( int  Width,
int  Height,
int  Depth,
int  Levels,
BitmapFormat  PixelFormat,
NUX_FILE_LINE_PROTO   
)

Restore the backbuffer as the render target.

Here is the caller graph for this function:

int nux::GpuDevice::DrawIndexedPrimitive ( ObjectPtr< IOpenGLIndexBuffer IndexBuffer,
ObjectPtr< IOpenGLVertexDeclaration VertexDeclaration,
PRIMITIVE_TYPE  PrimitiveType,
int  PrimitiveCount 
)

Definition at line 125 of file GpuDeviceVertex.cpp.

  {
    nuxAssert(VertexDeclaration.IsValid());

    if (!VertexDeclaration.IsValid())
      return OGL_ERROR;

    int decl = 0;

    for (int i = 0; i < 16; i++)
    {
      VertexDeclaration->_valid_vertex_input[i] = 0;
    }

    while (VertexDeclaration->_declarations_array[decl].Stream != 0xFF)
    {
      VERTEXELEMENT vtxelement = VertexDeclaration->_declarations_array[decl];

      int shader_attribute_location = VertexDeclaration->GetVertexShaderAttributeLocation(decl);
      
      if (shader_attribute_location == -1)
      {
        ++decl;
        continue;
      }

      VertexDeclaration->GetVertexBuffer(vtxelement.Stream)->BindVertexBuffer();

      glEnableVertexAttribArrayARB(shader_attribute_location);
      
      CHECKGL(glVertexAttribPointer(shader_attribute_location,
        vtxelement.NumComponent,
        vtxelement.Type,
        GL_FALSE,
        vtxelement.stride_,
        (void*)vtxelement.Offset));

      VertexDeclaration->_valid_vertex_input[shader_attribute_location] = 1;
      ++decl;
    }

    {
      IndexBuffer->BindIndexBuffer();

      GLenum primitive = PrimitiveType;
      GLenum index_format = GL_UNSIGNED_SHORT;

      if (IndexBuffer->GetStride() == 4)
        index_format = GL_UNSIGNED_INT;

//       switch(PrimitiveType)
//       {
//         case PRIMITIVE_TYPE_POINTLIST:
//           ElementCount = PrimitiveCount;
//           break;
// 
//         case PRIMITIVE_TYPE_LINELIST:
//           ElementCount = PrimitiveCount * 2;
//           break;
// 
//         case PRIMITIVE_TYPE_LINESTRIP:
//           ElementCount = PrimitiveCount + 1;
//           break;
// 
//         case PRIMITIVE_TYPE_TRIANGLELIST:
//           ElementCount = PrimitiveCount * 3;
//           break;
// 
//         case PRIMITIVE_TYPE_TRIANGLEFAN:
//         case PRIMITIVE_TYPE_TRIANGLESTRIP:
//           ElementCount = PrimitiveCount + 2;
//           break;
//         default:
//           // Unknown primitive type. This should not happen.
//           nuxAssertMsg(0, "[GpuDevice::DrawIndexedPrimitive] Unknown Primitive Type.");
//       }

      CHECKGL(glDrawElements(primitive,
                                index_count,
                                index_format,
                                0));
    }

    {
      for (int index = 0; index < 16; index++)
      {
        if (VertexDeclaration->_valid_vertex_input[index])
          glDisableVertexAttribArrayARB(index);
      }

      InvalidateVertexBuffer();
      InvalidateIndexBuffer();
    }

    //    for (int i = 0; i < 8; i++)
    //    {
    //        CHECKGL(glClientActiveTexture(GL_TEXTURE0 + i));
    //        CHECKGL(glDisable(GL_TEXTURE_3D));
    //        CHECKGL(glDisable(GL_TEXTURE_2D));
    //        CHECKGL(glDisable(GL_TEXTURE_1D));
    //        CHECKGL(glDisable(GL_TEXTURE_CUBE_MAP_ARB));
    //        CHECKGL(glEnable(GL_TEXTURE_2D));
    //        CHECKGL(glBindTexture(GL_TEXTURE_2D, 0));
    //    }
    return OGL_OK;
  }

Here is the call graph for this function:

int nux::GpuDevice::DrawPrimitive ( ObjectPtr< IOpenGLVertexDeclaration VertexDeclaration,
PRIMITIVE_TYPE  pt_,
unsigned  vtx_start_,
unsigned  num_prims_ 
)

Definition at line 238 of file GpuDeviceVertex.cpp.

  {
//     return OGL_OK;
//     glDisable(GL_CULL_FACE);
//     glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// 
//     // Maps a vertex declaration usage to a vertex shader input index.
//     // I want to make this a static array defined outside of this function but their seems to be a problem
//     // with initialization...
//     /*static*/
//     int sVertexInputMap[] =
//     {
//       0,   // ATTRIB_USAGE_DECL_POSITION
//       14,  // ATTRIB_USAGE_DECL_BLENDWEIGHT
//       15,  // ATTRIB_USAGE_DECL_BLENDINDICES
//       1,   // ATTRIB_USAGE_DECL_NORMAL
//       4,   // ATTRIB_USAGE_DECL_COLOR, ATTRIB_USAGE_DECL_COLOR0
//       5,   // ATTRIB_USAGE_DECL_COLOR1
//       6,   // ATTRIB_USAGE_DECL_FOGCOORD
//       7,   // ATTRIB_USAGE_DECL_PSIZE
//       8,   // ATTRIB_USAGE_DECL_TEXCOORD, ATTRIB_USAGE_DECL_TEXCOORD0
//       9,   // ATTRIB_USAGE_DECL_TEXCOORD1
//       10,  // ATTRIB_USAGE_DECL_TEXCOORD2
//       11,  // ATTRIB_USAGE_DECL_TEXCOORD3
//       12,  // ATTRIB_USAGE_DECL_TEXCOORD4
//       13,  // ATTRIB_USAGE_DECL_TEXCOORD5
//       14,  // ATTRIB_USAGE_DECL_TEXCOORD6
//       15,  // ATTRIB_USAGE_DECL_TEXCOORD7
//       2,   // ATTRIB_USAGE_DECL_TANGENT
//       3,   // ATTRIB_USAGE_DECL_BINORMAL
//     };
// 
//     nuxAssert(VertexDeclaration.IsValid());
// 
//     if (!VertexDeclaration.IsValid())
//       return OGL_ERROR;
// 
//     int decl = 0;
// 
//     for (int i = 0; i < 16; i++)
//       VertexDeclaration->_valid_vertex_input[i] = 0;
// 
//     while (VertexDeclaration->_declarations_array[decl].Stream != 0xFF)
//     {
//       VERTEXELEMENT vtxelement = VertexDeclaration->_declarations_array[decl];
//       int vtxInput = sVertexInputMap[vtxelement.Usage + vtxelement.UsageIndex];
// 
//       nuxAssert(vtxInput < GetGpuInfo().GetMaxFboAttachment());
//       // Eneble the vertex attribute(0 to 10)
//       glEnableVertexAttribArrayARB( vtxInput );
//       // Bind the vertex buffer
//       _StreamSource[vtxelement.Stream].VertexBuffer->BindVertexBuffer();
// 
//       CHECKGL(glVertexAttribPointer(vtxInput,
//                                        vtxelement.NumComponent,
//                                        vtxelement.Type,
//                                        GL_FALSE,
//                                        _StreamSource[vtxelement.Stream].StreamStride,
//                                        (GLvoid *) (&_StreamSource[vtxelement.Stream].StreamOffset + vtxelement.Offset)));
// 
//       VertexDeclaration->_valid_vertex_input[sVertexInputMap[vtxelement.Usage + vtxelement.UsageIndex]] = 1;
//       decl++;
//     }
// 
//     {
//       InvalidateIndexBuffer();
// 
//       GLenum primitive = PrimitiveType;
//       int ElementCount = 0;
// 
//       switch(PrimitiveType)
//       {
//         case PRIMITIVE_TYPE_POINTLIST:
//           ElementCount = PrimitiveCount;
//           break;
// 
//         case PRIMITIVE_TYPE_LINELIST:
//           ElementCount = PrimitiveCount * 2;
//           break;
// 
//         case PRIMITIVE_TYPE_LINESTRIP:
//           ElementCount = PrimitiveCount + 1;
//           break;
// 
//         case PRIMITIVE_TYPE_TRIANGLELIST:
//           ElementCount = PrimitiveCount * 3;
//           break;
// 
//         case PRIMITIVE_TYPE_TRIANGLEFAN:
//         case PRIMITIVE_TYPE_TRIANGLESTRIP:
//           ElementCount = PrimitiveCount + 2;
//           break;
//         default:
//           // Unknown primitive type. This should not happen.
//           nuxAssertMsg(0, "[GpuDevice::DrawPrimitive] Unknown Primitive Type.");
//           return OGL_ERROR;
//       }
// 
//       CHECKGL(glDrawArrays(primitive,
//                               ElementCount,
//                               vtx_start_));
//     }
// 
//     {
//       for (int index = 0; index < 16; index++)
//       {
//         if (VertexDeclaration->_valid_vertex_input[index])
//           glDisableVertexAttribArrayARB( index );
//       }
// 
//       InvalidateVertexBuffer();
//       InvalidateIndexBuffer();
//     }
// 
//     //    for (int i = 0; i < 8; i++)
//     //    {
//     //        CHECKGL(glClientActiveTexture(GL_TEXTURE0 + i));
//     //        CHECKGL(glDisable(GL_TEXTURE_3D));
//     //        CHECKGL(glDisable(GL_TEXTURE_2D));
//     //        CHECKGL(glDisable(GL_TEXTURE_1D));
//     //        CHECKGL(glDisable(GL_TEXTURE_CUBE_MAP_ARB));
//     //        CHECKGL(glEnable(GL_TEXTURE_2D));
//     //        CHECKGL(glBindTexture(GL_TEXTURE_2D, 0));
//     //    }
    return OGL_OK;
  }
int nux::GpuDevice::DrawPrimitiveUP ( ObjectPtr< IOpenGLVertexDeclaration VertexDeclaration,
PRIMITIVE_TYPE  PrimitiveType,
unsigned int  PrimitiveCount,
const void *  pVertexStreamZeroData,
unsigned int  VertexStreamZeroStride 
)

Definition at line 369 of file GpuDeviceVertex.cpp.

  {
//     nuxAssertMsg(VertexDeclaration->IsUsingMoreThanStreamZero(), "[GpuDevice::DrawPrimitiveUP] Declaration is using more than stream 0.");
//     VERTEXELEMENT vtxelement = VertexDeclaration->GetUsage(ATTRIB_USAGE_DECL_POSITION);
//     int Stream = vtxelement.Stream;
// 
//     if (Stream != 0xFF)
//     {
//       glDisable(GL_CULL_FACE);
//       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// 
//       InvalidateVertexBuffer();
//       InvalidateVertexBuffer();
// 
//       size_t ptr = * (size_t *) pVertexStreamZeroData + _StreamSource[vtxelement.Stream].StreamOffset;
//       CHECKGL(glEnableClientState(GL_VERTEX_ARRAY));
//       CHECKGL(glVertexPointer( vtxelement.NumComponent,
//                                   vtxelement.Type,
//                                   VertexStreamZeroStride,
//                                   (GLvoid *) &ptr));
// 
//       InvalidateIndexBuffer();
// 
//       GLenum primitive = PrimitiveType;
//       int ElementCount = 0;
// 
//       switch(PrimitiveType)
//       {
//         case PRIMITIVE_TYPE_POINTLIST:
//           ElementCount = PrimitiveCount;
//           break;
// 
//         case PRIMITIVE_TYPE_LINELIST:
//           ElementCount = PrimitiveCount * 2;
//           break;
// 
//         case PRIMITIVE_TYPE_LINESTRIP:
//           ElementCount = PrimitiveCount + 1;
//           break;
// 
//         case PRIMITIVE_TYPE_TRIANGLELIST:
//           ElementCount = PrimitiveCount * 3;
//           break;
// 
//         case PRIMITIVE_TYPE_TRIANGLEFAN:
//         case PRIMITIVE_TYPE_TRIANGLESTRIP:
//           ElementCount = PrimitiveCount + 2;
//           break;
//         default:
//           // Unknown primitive type. This should not happen.
//           nuxAssertMsg(0, "[GpuDevice::DrawPrimitiveUP] Unknown Primitive Type.");
//           return OGL_ERROR;
//       }
// 
//       CHECKGL(glDrawArrays(primitive,
//                               ElementCount,
//                               0));
// 
//       CHECKGL(glDisableClientState(GL_VERTEX_ARRAY));
// 
//     }
// 
//     //    for (int i = 0; i < 8; i++)
//     //    {
//     //        CHECKGL(glClientActiveTexture(GL_TEXTURE0 + i));
//     //        CHECKGL(glDisable(GL_TEXTURE_3D));
//     //        CHECKGL(glDisable(GL_TEXTURE_2D));
//     //        CHECKGL(glDisable(GL_TEXTURE_1D));
//     //        CHECKGL(glDisable(GL_TEXTURE_CUBE_MAP_ARB));
//     //        CHECKGL(glEnable(GL_TEXTURE_2D));
//     //        CHECKGL(glBindTexture(GL_TEXTURE_2D, 0));
//     //    }
    return OGL_OK;
  }
int nux::GpuDevice::FormatFrameBufferObject ( unsigned int  Width,
unsigned int  Height,
BitmapFormat  PixelFormat 
)

Here is the caller graph for this function:

ObjectPtr<IOpenGLSurface> nux::GpuDevice::GetColorRenderTargetSurface ( unsigned int  ColorAttachmentIndex)

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

unsigned int nux::GpuDevice::GetPixelStoreAlignment ( ) [inline]

Definition at line 385 of file GpuDevice.h.

    {
      return _PixelStoreAlignment;
    }

Setup a NULL index buffer.

Definition at line 120 of file GpuDeviceVertex.cpp.

Here is the caller graph for this function:

void nux::GpuDevice::InvalidateTextureUnit ( int  TextureUnitIndex)

Setup a NULL texture.

Here is the caller graph for this function:

Setup a NULL vertex buffer.

Definition at line 115 of file GpuDeviceVertex.cpp.

Here is the caller graph for this function:

void* nux::GpuDevice::LockPackPixelBufferIndex ( const int  index,
const int  Size 
)
void* nux::GpuDevice::LockUnpackPixelBufferIndex ( const int  index,
const int  Size 
)

Here is the caller graph for this function:

int nux::GpuDevice::SetColorRenderTargetSurface ( unsigned int  ColorAttachmentIndex,
ObjectPtr< IOpenGLSurface pRenderTargetSurface 
)

Here is the caller graph for this function:

int nux::GpuDevice::SetStreamSource ( unsigned int  StreamNumber,
ObjectPtr< IOpenGLVertexBuffer pStreamData,
unsigned int  OffsetInBytes,
unsigned int  Stride 
)

Definition at line 483 of file GpuDeviceVertex.cpp.

  {
    nuxAssert(StreamNumber < MAX_NUM_STREAM);

    _StreamSource[StreamNumber].Stream = StreamNumber;
    _StreamSource[StreamNumber].StreamOffset = OffsetInBytes;
    _StreamSource[StreamNumber].VertexBuffer = pStreamData;
    _StreamSource[StreamNumber].StreamStride = Stride;

    return OGL_OK;
  }
int nux::GpuDevice::SetTexture ( unsigned int  TextureUnit,
IOpenGLBaseTexture texture 
)

Definition at line 478 of file GpuDevice.h.

Here is the call graph for this function:

Definition at line 488 of file GpuDevice.h.

Here is the call graph for this function:

Definition at line 483 of file GpuDevice.h.

Here is the call graph for this function:

void nux::GpuDevice::UnlockPackPixelBufferIndex ( const int  index)
bool nux::GpuDevice::UsePixelBufferObjects ( ) const [inline]

Definition at line 443 of file GpuDevice.h.

    {
      return _UsePixelBufferObject;
    }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class GraphicsEngine [friend]

Definition at line 567 of file GpuDevice.h.

friend class IOpenGLSurface [friend]

Definition at line 566 of file GpuDevice.h.


Member Data Documentation

GPU renderer sting.

Definition at line 502 of file GpuDevice.h.

GPU vendor sting.

Definition at line 501 of file GpuDevice.h.

Definition at line 421 of file GpuDevice.h.

Definition at line 420 of file GpuDevice.h.

GLSL major version.

Definition at line 498 of file GpuDevice.h.

GLSL major version.

Definition at line 499 of file GpuDevice.h.

GLSL version string.

Definition at line 504 of file GpuDevice.h.

GPU brand.

Definition at line 505 of file GpuDevice.h.

Definition at line 525 of file GpuDevice.h.

Definition at line 524 of file GpuDevice.h.

OpenGL major version.

Definition at line 496 of file GpuDevice.h.

OpenGL minor version.

Definition at line 497 of file GpuDevice.h.

OpenGL version string.

Definition at line 503 of file GpuDevice.h.

Definition at line 431 of file GpuDevice.h.

unsigned int nux::GpuDevice::_PixelStoreAlignment [private]

Definition at line 429 of file GpuDevice.h.

Definition at line 177 of file GpuDevice.h.

Definition at line 507 of file GpuDevice.h.

Definition at line 529 of file GpuDevice.h.

Definition at line 511 of file GpuDevice.h.

Definition at line 514 of file GpuDevice.h.

Definition at line 512 of file GpuDevice.h.

Definition at line 516 of file GpuDevice.h.

Promoted from GL_EXT_TEXTURE_RECTANGLE to ARB.

Definition at line 521 of file GpuDevice.h.

Definition at line 515 of file GpuDevice.h.

Definition at line 510 of file GpuDevice.h.

Definition at line 513 of file GpuDevice.h.

Definition at line 518 of file GpuDevice.h.

Definition at line 517 of file GpuDevice.h.

Definition at line 519 of file GpuDevice.h.

Definition at line 520 of file GpuDevice.h.

Definition at line 522 of file GpuDevice.h.

Definition at line 509 of file GpuDevice.h.


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