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

« back to all changes in this revision

Viewing changes to NuxGraphics/IOpenGLSurface.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:
21
21
 
22
22
 
23
23
#include "GLResource.h"
 
24
#include "GraphicsDisplay.h"
24
25
#include "GpuDevice.h"
25
26
#include "GLDeviceObjects.h"
26
27
#include "IOpenGLSurface.h"
177
178
    _Rect.right   = texwidth;
178
179
 
179
180
 
180
 
    if (GetGpuDevice()->UsePixelBufferObjects() )
 
181
    if (GetGraphicsDisplay()->GetGpuDevice()->UsePixelBufferObjects() )
181
182
    {
182
 
      GetGpuDevice()->AllocateUnpackPixelBufferIndex (&_AllocatedUnpackBuffer);
 
183
      GetGraphicsDisplay()->GetGpuDevice()->AllocateUnpackPixelBufferIndex (&_AllocatedUnpackBuffer);
183
184
    }
184
185
 
185
186
    if (pRect == 0)
186
187
    {
187
 
      if (GetGpuDevice()->UsePixelBufferObjects() )
 
188
      if (GetGraphicsDisplay()->GetGpuDevice()->UsePixelBufferObjects() )
188
189
      {
189
190
        // Mapping the entire area of the surface
190
 
        _LockedRect.pBits = GetGpuDevice()->LockUnpackPixelBufferIndex (_AllocatedUnpackBuffer, surface_size);
 
191
        _LockedRect.pBits = GetGraphicsDisplay()->GetGpuDevice()->LockUnpackPixelBufferIndex (_AllocatedUnpackBuffer, surface_size);
191
192
        pLockedRect->pBits = _LockedRect.pBits;
192
193
        pLockedRect->Pitch = _LockedRect.Pitch;
193
194
      }
223
224
        return OGL_INVALID_LOCK;
224
225
      }
225
226
 
226
 
      if (GetGpuDevice()->UsePixelBufferObjects() )
 
227
      if (GetGraphicsDisplay()->GetGpuDevice()->UsePixelBufferObjects() )
227
228
      {
228
 
        _LockedRect.pBits = GetGpuDevice()->LockUnpackPixelBufferIndex (_AllocatedUnpackBuffer, RectSize);
 
229
        _LockedRect.pBits = GetGraphicsDisplay()->GetGpuDevice()->LockUnpackPixelBufferIndex (_AllocatedUnpackBuffer, RectSize);
229
230
        pLockedRect->pBits = ( (BYTE *) _LockedRect.pBits);
230
231
        pLockedRect->Pitch = ( ( (RectWidth * BytePerPixel + (unpack_alignment - 1) ) >> (halfUnpack) ) << (halfUnpack) );
231
232
      }
263
264
      int h = _Rect.bottom - _Rect.top;
264
265
      CHECKGL ( glBindTexture (_STextureTarget, _BaseTexture->_OpenGLID) );
265
266
 
266
 
      if (GetGpuDevice()->UsePixelBufferObjects() )
 
267
      if (GetGraphicsDisplay()->GetGpuDevice()->UsePixelBufferObjects() )
267
268
      {
268
269
        // Unmap the texture image buffer
269
 
        GetGpuDevice()->BindUnpackPixelBufferIndex (_AllocatedUnpackBuffer);
 
270
        GetGraphicsDisplay()->GetGpuDevice()->BindUnpackPixelBufferIndex (_AllocatedUnpackBuffer);
270
271
        CHECKGL ( glUnmapBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB) );
271
272
        DataPtr = NUX_BUFFER_OFFSET (0);
272
273
      }
410
411
      nuxDebugMsg (TEXT("[IOpenGLSurface::UnlockRect] Incorrect Texture Target."));
411
412
    }
412
413
 
413
 
    if (GetGpuDevice()->UsePixelBufferObjects() )
 
414
    if (GetGraphicsDisplay()->GetGpuDevice()->UsePixelBufferObjects() )
414
415
    {
415
416
      CHECKGL ( glBindBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0) );
416
 
      GetGpuDevice()->FreeUnpackPixelBufferIndex (_AllocatedUnpackBuffer);
 
417
      GetGraphicsDisplay()->GetGpuDevice()->FreeUnpackPixelBufferIndex (_AllocatedUnpackBuffer);
417
418
    }
418
419
    else
419
420
    {
424
425
      }
425
426
    }
426
427
 
427
 
    CHECKGL ( glPixelStorei (GL_UNPACK_ALIGNMENT, GetGpuDevice()->GetPixelStoreAlignment() ) );
 
428
    CHECKGL ( glPixelStorei (GL_UNPACK_ALIGNMENT, GetGraphicsDisplay()->GetGpuDevice()->GetPixelStoreAlignment() ) );
428
429
 
429
430
    _LockedRect.pBits = 0;
430
431
    _LockedRect.Pitch = 0;
540
541
    //        delete [] color_array;
541
542
    //    }
542
543
 
543
 
    CHECKGL (glPixelStorei (GL_UNPACK_ALIGNMENT, GetGpuDevice ()->GetPixelStoreAlignment ()));
 
544
    CHECKGL (glPixelStorei (GL_UNPACK_ALIGNMENT, GetGraphicsDisplay()->GetGpuDevice()->GetPixelStoreAlignment()));
544
545
 
545
546
    _Initialized = true;
546
547
    return OGL_OK;