~unity-team/nux/nux-remove-glew-mx

« back to all changes in this revision

Viewing changes to NuxGraphics/GLSh_DrawFunction.cpp

  • Committer: Jay Taoko
  • Date: 2011-05-30 02:54:31 UTC
  • mfrom: (353.1.1 nux)
  • Revision ID: jay.taoko@canonical.com-20110530025431-kpqcnbcq3apsfz92
* Object::Dispose() now does the same thing as Object::UnReference()
* Fixed memory leak in UXTheme::Load2DTextureFile
* Mesh Resource manager
    - Fixed mesh Resource manager pipeline
    - See example ProgObjMeshLoader

* Fixed GLSL Shaders in FontRendering.cpp
    - removed global variable USE_ARB_SHADERS and replaced with GraphicsEngine::UsingGLSLCodePath()

* Removing files IniFile.cpp/.h
* Removing files UIColorTheme.cpp/.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
namespace nux
33
33
{
34
34
 
35
 
  extern bool USE_ARB_SHADERS;
36
 
 
37
35
  static NString VtxShader = TEXT ("#version 110   \n\
38
36
        uniform mat4 ViewProjectionMatrix;      \n\
39
37
        attribute vec4 AVertex;                 \n\
101
99
    :   _ScreenOffsetX (0)
102
100
    ,   _ScreenOffsetY (0)
103
101
  {
104
 
    if (!USE_ARB_SHADERS && (GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL) )
 
102
    if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath() && (GetGraphicsDisplay()->GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL) )
105
103
    {
106
 
      sprog = GetGpuDevice()->CreateShaderProgram();
 
104
      sprog = GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram();
107
105
      sprog->LoadVertexShader (VtxShader.GetTCharPtr(), NULL);
108
106
      sprog->LoadPixelShader (FrgShader.GetTCharPtr(), NULL);
109
107
      sprog->Link();
110
108
    }
111
109
    else
112
110
    {
113
 
      m_AsmProg = GetGpuDevice()->CreateAsmShaderProgram();
 
111
      m_AsmProg = GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram();
114
112
      m_AsmProg->LoadVertexShader (AsmVtxShader.GetTCharPtr() );
115
113
      m_AsmProg->LoadPixelShader (AsmFrgShader.GetTCharPtr() );
116
114
      m_AsmProg->Link();
137
135
      x + width,  y,          0.0f, 1.0f,
138
136
    };
139
137
 
140
 
    if (!USE_ARB_SHADERS && (GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL) )
 
138
    if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath() && (GetGraphicsDisplay()->GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL) )
141
139
    {
142
140
      CHECKGL (glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0) );
143
141
      CHECKGL (glBindBufferARB (GL_ELEMENT_ARRAY_BUFFER_ARB, 0) );
146
144
      int VertexLocation = sprog->GetAttributeLocation ("AVertex");
147
145
 
148
146
      int VPMatrixLocation = sprog->GetUniformLocationARB ("ViewProjectionMatrix");
149
 
      sprog->SetUniformLocMatrix4fv ( (GLint) VPMatrixLocation, 1, false, (GLfloat *) & (GetThreadGraphicsContext()->GetOpenGLModelViewProjectionMatrix().m) );
 
147
      sprog->SetUniformLocMatrix4fv ( (GLint) VPMatrixLocation, 1, false, (GLfloat *) & (GetGraphicsDisplay()->GetGraphicsEngine()->GetOpenGLModelViewProjectionMatrix().m) );
150
148
 
151
 
      GetThreadGraphicsContext()->SetTexture (GL_TEXTURE0, m_device_texture);
 
149
      GetGraphicsDisplay()->GetGraphicsEngine()->SetTexture (GL_TEXTURE0, m_device_texture);
152
150
 
153
151
      int ColorBase       = sprog->GetUniformLocationARB ("Color");
154
152
      int RectPosition    = sprog->GetUniformLocationARB ("RectPosition");
185
183
 
186
184
      CHECKGL ( glMatrixMode (GL_MODELVIEW) );
187
185
      CHECKGL ( glLoadIdentity() );
188
 
      CHECKGL ( glLoadMatrixf ( (FLOAT *) GetThreadGraphicsContext()->GetOpenGLModelViewMatrix().m) );
 
186
      CHECKGL ( glLoadMatrixf ( (FLOAT *) GetGraphicsDisplay()->GetGraphicsEngine()->GetOpenGLModelViewMatrix().m) );
189
187
      CHECKGL ( glMatrixMode (GL_PROJECTION) );
190
188
      CHECKGL ( glLoadIdentity() );
191
 
      CHECKGL ( glLoadMatrixf ( (FLOAT *) GetThreadGraphicsContext()->GetOpenGLProjectionMatrix().m) );
 
189
      CHECKGL ( glLoadMatrixf ( (FLOAT *) GetGraphicsDisplay()->GetGraphicsEngine()->GetOpenGLProjectionMatrix().m) );
192
190
 
193
191
      int VertexLocation          = VTXATTRIB_POSITION;
194
192
 
195
 
      GetThreadGraphicsContext()->SetTexture (GL_TEXTURE0, m_device_texture);
 
193
      GetGraphicsDisplay()->GetGraphicsEngine()->SetTexture (GL_TEXTURE0, m_device_texture);
196
194
 
197
195
      CHECKGL ( glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 0, x + _ScreenOffsetX, WindowHeight - y - height - _ScreenOffsetY, z, 0.0f) );
198
196
      CHECKGL ( glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 1, width, height, 0.0f, 0.0f) );