Back to index

nux  3.0.0
Public Member Functions | Public Attributes | Private Attributes
nux::GLSh_Fill Class Reference

#include <GLSh_Fill.h>

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

List of all members.

Public Member Functions

 GLSh_Fill ()
 ~GLSh_Fill ()
void CacheShader ()
void SetColor (FLOAT R, FLOAT G, FLOAT B, FLOAT A)
void Render (INT x, INT y, INT z, INT width, INT height)
void SetTransformMatrix (const Matrix4 &TransformMatrix)

Public Attributes

GLShaderParameterColor
GLShaderParameterViewProjectionMatrix
GLShaderParameterScale
GLShaderParameterOffset

Private Attributes

FLOAT _R
FLOAT _G
FLOAT _B
FLOAT _A
ObjectPtr< IOpenGLVertexShadervs
ObjectPtr< IOpenGLPixelShaderps
ObjectPtr< IOpenGLShaderProgramsprog
Matrix4 m_TransformMatrix
TemplateQuadBufferm_QuadBuffer

Detailed Description

Definition at line 35 of file GLSh_Fill.h.


Constructor & Destructor Documentation

Definition at line 36 of file GLSh_Fill.cpp.

  {
//     Color                 = new GLShaderParameter(0,  "ColorFill",                  eFRAGMENTUNIFORMTYPE, TRUE);
//     ViewProjectionMatrix  = new GLShaderParameter(0,  "ViewProjectionMatrix",       eVERTEXUNIFORMTYPE, TRUE);
//     Scale                 = new GLShaderParameter(0,  "Scale",                      eVERTEXUNIFORMTYPE, TRUE);
//     Offset                = new GLShaderParameter(0,  "Offset",                     eVERTEXUNIFORMTYPE, TRUE);
//
//     vs = GetGpuDevice()->CreateVertexShader();
//     ps = GetGpuDevice()->CreatePixelShader();
//     sprog = GetGpuDevice()->CreateShaderProgram();
//
//     sprog->AddShaderParameter(Color);
//     sprog->AddShaderParameter(ViewProjectionMatrix);
//     sprog->AddShaderParameter(Scale);
//     sprog->AddShaderParameter(Offset);
//
//     NString SourceCode;
//     LoadFileToString(SourceCode, "..//Shaders//Fill.glsl");
//     NString VertexShaderSource;
//     ExtractShaderString3("[Vertex Shader]", SourceCode, VertexShaderSource);
//     NString PixelShaderSource;
//     ExtractShaderString3("[Fragment Shader]", SourceCode, PixelShaderSource);
//
//     vs->SetShaderCode(VertexShaderSource.GetTCharPtr());
//     ps->SetShaderCode(PixelShaderSource.GetTCharPtr());
//     vs->Compile();
//     ps->Compile();
//
//     sprog->AddShaderObject(vs);
//     sprog->AddShaderObject(ps);
//     sprog->Link();
//
//     m_QuadBuffer = new TemplateQuadBuffer(GetGpuDevice());
// //     Vector4 v[] =
// //     {
// //         Vector4(1, 0, 0, 0),
// //         Vector4(1, 0, 0, 0),
// //         Vector4(0, 0, 1, 0),
// //         Vector4(0, 0, 1, 0),
// //     };
// //     m_QuadBuffer->SetPerVertexAttribute(1, 4, v);
  }

Member Function Documentation

Definition at line 131 of file GLSh_Fill.cpp.

  {

  }
void nux::GLSh_Fill::Render ( INT  x,
INT  y,
INT  z,
INT  width,
INT  height 
)

Definition at line 101 of file GLSh_Fill.cpp.

  {
    return;
    CHECKGL(glDisable(GL_CULL_FACE));
    sprog->Begin();

    //Matrix4 ProjectionMatrix;
    //ProjectionMatrix.Orthographic(0, 640, 480, 0, 0.0, 10000.0);
    //ProjectionMatrix.Transpose();
    ViewProjectionMatrix->SetUniformMatrix4fv(1, (GLfloat *) m_TransformMatrix.m, GL_FALSE);

    Scale->SetUniform4f(width, height, 1, 1);
    Offset->SetUniform4f(x, y, 0, 0);
    Color->SetUniform4f(_R, _G, _B, _A);

    INT VertexLocation = sprog->GetAttributeLocation("Vertex");
    m_QuadBuffer->BindAttribute(VertexLocation, 0);

//     INT VertexColorLocation = sprog->GetAttributeLocation("VertexColor");
//     m_QuadBuffer->BindAttribute(VertexColorLocation, 1);

    m_QuadBuffer->Render(1);

    m_QuadBuffer->UnBindAttribute(VertexLocation);
//     m_QuadBuffer->UnBindAttribute(VertexColorLocation);
    m_QuadBuffer->UnBind(); // Unbind the vertex and index buffer.

    sprog->End();
  }

Here is the call graph for this function:

void nux::GLSh_Fill::SetColor ( FLOAT  R,
FLOAT  G,
FLOAT  B,
FLOAT  A 
)

Definition at line 88 of file GLSh_Fill.cpp.

  {
    _R = R;
    _G = G;
    _B = B;
    _A = A;
  }
void nux::GLSh_Fill::SetTransformMatrix ( const Matrix4 TransformMatrix)

Definition at line 96 of file GLSh_Fill.cpp.

  {
    m_TransformMatrix = TransformMatrix;
  }

Member Data Documentation

Definition at line 53 of file GLSh_Fill.h.

Definition at line 53 of file GLSh_Fill.h.

Definition at line 53 of file GLSh_Fill.h.

Definition at line 53 of file GLSh_Fill.h.

Definition at line 38 of file GLSh_Fill.h.

Definition at line 59 of file GLSh_Fill.h.

Definition at line 58 of file GLSh_Fill.h.

Definition at line 41 of file GLSh_Fill.h.

Definition at line 56 of file GLSh_Fill.h.

Definition at line 40 of file GLSh_Fill.h.

Definition at line 57 of file GLSh_Fill.h.

Definition at line 39 of file GLSh_Fill.h.

Definition at line 55 of file GLSh_Fill.h.


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