Commit 878c280c authored by hybrid's avatar hybrid

Some driver cleanup. Fixed the issues with external window usage under OpenGL...

Some driver cleanup. Fixed the issues with external window usage under OpenGL and Linux. Added error checking for VBO usage.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1443 dfc29bdd-3216-0410-991c-e03cc46cb475
parent c270bd99
...@@ -216,6 +216,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -216,6 +216,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
ExposedData.OpenGLLinux.X11Context = glXGetCurrentContext(); ExposedData.OpenGLLinux.X11Context = glXGetCurrentContext();
ExposedData.OpenGLLinux.X11Display = glXGetCurrentDisplay(); ExposedData.OpenGLLinux.X11Display = glXGetCurrentDisplay();
ExposedData.OpenGLLinux.X11Window = (unsigned long)params.WindowId; ExposedData.OpenGLLinux.X11Window = (unsigned long)params.WindowId;
Drawable = glXGetCurrentDrawable();
genericDriverInit(params.WindowSize, params.Stencilbuffer); genericDriverInit(params.WindowSize, params.Stencilbuffer);
...@@ -368,7 +369,6 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<s32>& screenSize, ...@@ -368,7 +369,6 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<s32>& screenSize,
createMaterialRenderers(); createMaterialRenderers();
// set the renderstates // set the renderstates
ResetRenderStates = true;
setRenderStates3DMode(); setRenderStates3DMode();
// set fog mode // set fog mode
...@@ -433,7 +433,7 @@ void COpenGLDriver::createMaterialRenderers() ...@@ -433,7 +433,7 @@ void COpenGLDriver::createMaterialRenderers()
//! presents the rendered scene on the screen, returns false if failed //! presents the rendered scene on the screen, returns false if failed
bool COpenGLDriver::endScene( void* windowId, core::rect<s32>* sourceRect ) bool COpenGLDriver::endScene(void* windowId, core::rect<s32>* sourceRect)
{ {
CNullDriver::endScene(); CNullDriver::endScene();
...@@ -442,7 +442,7 @@ bool COpenGLDriver::endScene( void* windowId, core::rect<s32>* sourceRect ) ...@@ -442,7 +442,7 @@ bool COpenGLDriver::endScene( void* windowId, core::rect<s32>* sourceRect )
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_USE_WINDOWS_DEVICE_
return SwapBuffers(HDc) == TRUE; return SwapBuffers(HDc) == TRUE;
#elif defined(_IRR_USE_LINUX_DEVICE_) #elif defined(_IRR_USE_LINUX_DEVICE_)
glXSwapBuffers((Display*)ExposedData.OpenGLLinux.X11Display, ExposedData.OpenGLLinux.X11Window); glXSwapBuffers((Display*)ExposedData.OpenGLLinux.X11Display, Drawable);
return true; return true;
#elif defined(_IRR_USE_OSX_DEVICE_) #elif defined(_IRR_USE_OSX_DEVICE_)
_device->flush(); _device->flush();
...@@ -563,7 +563,6 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -563,7 +563,6 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
return false; return false;
#if defined(GL_ARB_vertex_buffer_object) #if defined(GL_ARB_vertex_buffer_object)
const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer; const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer;
const void* vertices=mb->getVertices(); const void* vertices=mb->getVertices();
const u32 vertexCount=mb->getVertexCount(); const u32 vertexCount=mb->getVertexCount();
...@@ -580,7 +579,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -580,7 +579,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
case EVT_STANDARD: case EVT_STANDARD:
{ {
S3DVertex* pb = reinterpret_cast<S3DVertex*>(buffer.pointer()); S3DVertex* pb = reinterpret_cast<S3DVertex*>(buffer.pointer());
const S3DVertex* po = reinterpret_cast<const S3DVertex*>(vertices); const S3DVertex* po = static_cast<const S3DVertex*>(vertices);
for (u32 i=0; i<vertexCount; i++) for (u32 i=0; i<vertexCount; i++)
{ {
po[i].Color.toOpenGLColor((u8*)&(pb[i].Color.color)); po[i].Color.toOpenGLColor((u8*)&(pb[i].Color.color));
...@@ -590,7 +589,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -590,7 +589,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
case EVT_2TCOORDS: case EVT_2TCOORDS:
{ {
S3DVertex2TCoords* pb = reinterpret_cast<S3DVertex2TCoords*>(buffer.pointer()); S3DVertex2TCoords* pb = reinterpret_cast<S3DVertex2TCoords*>(buffer.pointer());
const S3DVertex2TCoords* po = reinterpret_cast<const S3DVertex2TCoords*>(vertices); const S3DVertex2TCoords* po = static_cast<const S3DVertex2TCoords*>(vertices);
for (u32 i=0; i<vertexCount; i++) for (u32 i=0; i<vertexCount; i++)
{ {
po[i].Color.toOpenGLColor((u8*)&(pb[i].Color.color)); po[i].Color.toOpenGLColor((u8*)&(pb[i].Color.color));
...@@ -600,7 +599,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -600,7 +599,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
case EVT_TANGENTS: case EVT_TANGENTS:
{ {
S3DVertexTangents* pb = reinterpret_cast<S3DVertexTangents*>(buffer.pointer()); S3DVertexTangents* pb = reinterpret_cast<S3DVertexTangents*>(buffer.pointer());
const S3DVertexTangents* po = reinterpret_cast<const S3DVertexTangents*>(vertices); const S3DVertexTangents* po = static_cast<const S3DVertexTangents*>(vertices);
for (u32 i=0; i<vertexCount; i++) for (u32 i=0; i<vertexCount; i++)
{ {
po[i].Color.toOpenGLColor((u8*)&(pb[i].Color.color)); po[i].Color.toOpenGLColor((u8*)&(pb[i].Color.color));
...@@ -629,6 +628,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -629,6 +628,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID ); extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID );
//copy data to graphics card //copy data to graphics card
glGetError(); // clear error storage
if (!newBuffer) if (!newBuffer)
extGlBufferSubData(GL_ARRAY_BUFFER, 0, vertexCount * vertexSize, buffer.const_pointer()); extGlBufferSubData(GL_ARRAY_BUFFER, 0, vertexCount * vertexSize, buffer.const_pointer());
else else
...@@ -645,8 +645,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -645,8 +645,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
extGlBindBuffer(GL_ARRAY_BUFFER, 0); extGlBindBuffer(GL_ARRAY_BUFFER, 0);
return true; return (glGetError() == GL_NO_ERROR);
#else #else
return false; return false;
#endif #endif
...@@ -662,7 +661,6 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -662,7 +661,6 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
return false; return false;
#if defined(GL_ARB_vertex_buffer_object) #if defined(GL_ARB_vertex_buffer_object)
const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer; const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer;
const u16* indices=mb->getIndices(); const u16* indices=mb->getIndices();
...@@ -685,6 +683,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -685,6 +683,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, HWBuffer->vbo_indicesID); extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, HWBuffer->vbo_indicesID);
//copy data to graphics card //copy data to graphics card
glGetError(); // clear error storage
if (!newBuffer) if (!newBuffer)
extGlBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, indexCount * indexSize, indices); extGlBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, indexCount * indexSize, indices);
else else
...@@ -701,7 +700,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -701,7 +700,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
return true; return (glGetError() == GL_NO_ERROR);
#else #else
return false; return false;
#endif #endif
...@@ -742,7 +741,6 @@ bool COpenGLDriver::updateHardwareBuffer(SHWBufferLink *HWBuffer) ...@@ -742,7 +741,6 @@ bool COpenGLDriver::updateHardwareBuffer(SHWBufferLink *HWBuffer)
COpenGLDriver::SHWBufferLink *COpenGLDriver::createHardwareBuffer(const scene::IMeshBuffer* mb) COpenGLDriver::SHWBufferLink *COpenGLDriver::createHardwareBuffer(const scene::IMeshBuffer* mb)
{ {
#if defined(GL_ARB_vertex_buffer_object) #if defined(GL_ARB_vertex_buffer_object)
if (!mb || (mb->getHardwareMappingHint()==scene::EHM_NEVER)) if (!mb || (mb->getHardwareMappingHint()==scene::EHM_NEVER))
return 0; return 0;
...@@ -854,7 +852,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -854,7 +852,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
{ {
case EVT_STANDARD: case EVT_STANDARD:
{ {
const S3DVertex* p = reinterpret_cast<const S3DVertex*>(vertices); const S3DVertex* p = static_cast<const S3DVertex*>(vertices);
for ( i=0; i<vertexCount; i+=4) for ( i=0; i<vertexCount; i+=4)
{ {
p->Color.toOpenGLColor(&ColorBuffer[i]); p->Color.toOpenGLColor(&ColorBuffer[i]);
...@@ -864,7 +862,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -864,7 +862,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
break; break;
case EVT_2TCOORDS: case EVT_2TCOORDS:
{ {
const S3DVertex2TCoords* p = reinterpret_cast<const S3DVertex2TCoords*>(vertices); const S3DVertex2TCoords* p = static_cast<const S3DVertex2TCoords*>(vertices);
for ( i=0; i<vertexCount; i+=4) for ( i=0; i<vertexCount; i+=4)
{ {
p->Color.toOpenGLColor(&ColorBuffer[i]); p->Color.toOpenGLColor(&ColorBuffer[i]);
...@@ -874,7 +872,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -874,7 +872,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
break; break;
case EVT_TANGENTS: case EVT_TANGENTS:
{ {
const S3DVertexTangents* p = reinterpret_cast<const S3DVertexTangents*>(vertices); const S3DVertexTangents* p = static_cast<const S3DVertexTangents*>(vertices);
for ( i=0; i<vertexCount; i+=4) for ( i=0; i<vertexCount; i+=4)
{ {
p->Color.toOpenGLColor(&ColorBuffer[i]); p->Color.toOpenGLColor(&ColorBuffer[i]);
...@@ -906,9 +904,9 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -906,9 +904,9 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
case EVT_STANDARD: case EVT_STANDARD:
if (vertices) if (vertices)
{ {
glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast<const S3DVertex*>(vertices))[0].Normal); glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].Normal);
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast<const S3DVertex*>(vertices))[0].TCoords); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].TCoords);
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast<const S3DVertex*>(vertices))[0].Pos); glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].Pos);
} }
else else
{ {
...@@ -923,7 +921,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -923,7 +921,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
extGlClientActiveTexture(GL_TEXTURE1_ARB); extGlClientActiveTexture(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (vertices) if (vertices)
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(reinterpret_cast<const S3DVertex*>(vertices))[0].TCoords); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].TCoords);
else else
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), buffer_offset(28)); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), buffer_offset(28));
} }
...@@ -931,9 +929,9 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -931,9 +929,9 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
case EVT_2TCOORDS: case EVT_2TCOORDS:
if (vertices) if (vertices)
{ {
glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast<const S3DVertex2TCoords*>(vertices))[0].Normal); glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].Normal);
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords);
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast<const S3DVertex2TCoords*>(vertices))[0].Pos); glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].Pos);
} }
else else
{ {
...@@ -949,7 +947,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -949,7 +947,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
extGlClientActiveTexture(GL_TEXTURE1_ARB); extGlClientActiveTexture(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (vertices) if (vertices)
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &(reinterpret_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords2); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords2);
else else
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), buffer_offset(36)); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), buffer_offset(36));
} }
...@@ -957,9 +955,9 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -957,9 +955,9 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
case EVT_TANGENTS: case EVT_TANGENTS:
if (vertices) if (vertices)
{ {
glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast<const S3DVertexTangents*>(vertices))[0].Normal); glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast<const S3DVertexTangents*>(vertices))[0].Normal);
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast<const S3DVertexTangents*>(vertices))[0].TCoords); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast<const S3DVertexTangents*>(vertices))[0].TCoords);
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast<const S3DVertexTangents*>(vertices))[0].Pos); glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast<const S3DVertexTangents*>(vertices))[0].Pos);
} }
else else
{ {
...@@ -974,14 +972,14 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -974,14 +972,14 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
extGlClientActiveTexture(GL_TEXTURE1_ARB); extGlClientActiveTexture(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (vertices) if (vertices)
glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast<const S3DVertexTangents*>(vertices))[0].Tangent); glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast<const S3DVertexTangents*>(vertices))[0].Tangent);
else else
glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(36)); glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(36));
extGlClientActiveTexture(GL_TEXTURE2_ARB); extGlClientActiveTexture(GL_TEXTURE2_ARB);
glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
if (vertices) if (vertices)
glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(reinterpret_cast<const S3DVertexTangents*>(vertices))[0].Binormal); glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast<const S3DVertexTangents*>(vertices))[0].Binormal);
else else
glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(48)); glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(48));
} }
...@@ -1274,7 +1272,6 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture, const core::rect ...@@ -1274,7 +1272,6 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture, const core::rect
} }
//! draws a set of 2d images, using a color and the alpha channel of the //! draws a set of 2d images, using a color and the alpha channel of the
//! texture if desired. The images are drawn beginning at pos and concatenated //! texture if desired. The images are drawn beginning at pos and concatenated
//! in one line. All drawings are clipped against clipRect (if != 0). //! in one line. All drawings are clipped against clipRect (if != 0).
...@@ -1350,7 +1347,6 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture, ...@@ -1350,7 +1347,6 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture,
} }
//! draw a 2d rectangle //! draw a 2d rectangle
void COpenGLDriver::draw2DRectangle(SColor color, const core::rect<s32>& position, void COpenGLDriver::draw2DRectangle(SColor color, const core::rect<s32>& position,
const core::rect<s32>* clip) const core::rect<s32>* clip)
...@@ -1372,7 +1368,6 @@ void COpenGLDriver::draw2DRectangle(SColor color, const core::rect<s32>& positio ...@@ -1372,7 +1368,6 @@ void COpenGLDriver::draw2DRectangle(SColor color, const core::rect<s32>& positio
} }
//! draw an 2d rectangle //! draw an 2d rectangle
void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position, void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position,
SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,
...@@ -1414,7 +1409,6 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position, ...@@ -1414,7 +1409,6 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position,
} }
//! Draws a 2d line. //! Draws a 2d line.
void COpenGLDriver::draw2DLine(const core::position2d<s32>& start, void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, const core::position2d<s32>& end,
...@@ -1467,7 +1461,6 @@ bool COpenGLDriver::setTexture(u32 stage, const video::ITexture* texture) ...@@ -1467,7 +1461,6 @@ bool COpenGLDriver::setTexture(u32 stage, const video::ITexture* texture)
} }
//! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled. //! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled.
//! Returns whether disabling was successful or not. //! Returns whether disabling was successful or not.
bool COpenGLDriver::disableTextures(u32 fromStage) bool COpenGLDriver::disableTextures(u32 fromStage)
...@@ -1479,7 +1472,6 @@ bool COpenGLDriver::disableTextures(u32 fromStage) ...@@ -1479,7 +1472,6 @@ bool COpenGLDriver::disableTextures(u32 fromStage)
} }
//! creates a matrix in supplied GLfloat array to pass to OpenGL //! creates a matrix in supplied GLfloat array to pass to OpenGL
inline void COpenGLDriver::createGLMatrix(GLfloat gl_matrix[16], const core::matrix4& m) inline void COpenGLDriver::createGLMatrix(GLfloat gl_matrix[16], const core::matrix4& m)
{ {
...@@ -1907,7 +1899,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh ...@@ -1907,7 +1899,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glTranslatef (0.375, 0.375, 0.0); glTranslatef(0.375, 0.375, 0.0);
glMatrixMode(GL_TEXTURE); glMatrixMode(GL_TEXTURE);
glLoadIdentity(); glLoadIdentity();
...@@ -2488,7 +2480,7 @@ ITexture* COpenGLDriver::createRenderTargetTexture(const core::dimension2d<s32>& ...@@ -2488,7 +2480,7 @@ ITexture* COpenGLDriver::createRenderTargetTexture(const core::dimension2d<s32>&
if (rtt) if (rtt)
{ {
rtt->grab(); rtt->grab();
static_cast<video::COpenGLTexture*>(rtt)->setRenderTarget(true); static_cast<video::COpenGLTexture*>(rtt)->setIsRenderTarget(true);
} }
} }
...@@ -2608,7 +2600,7 @@ IImage* COpenGLDriver::createScreenShot() ...@@ -2608,7 +2600,7 @@ IImage* COpenGLDriver::createScreenShot()
{ {
IImage* newImage = new CImage(ECF_R8G8B8, ScreenSize); IImage* newImage = new CImage(ECF_R8G8B8, ScreenSize);
u8* pPixels = reinterpret_cast<u8*>(newImage->lock()); u8* pPixels = static_cast<u8*>(newImage->lock());
if (!pPixels) if (!pPixels)
{ {
newImage->drop(); newImage->drop();
......
...@@ -393,6 +393,8 @@ namespace video ...@@ -393,6 +393,8 @@ namespace video
HDC HDc; // Private GDI Device Context HDC HDc; // Private GDI Device Context
HWND Window; HWND Window;
HGLRC HRc; // Permanent Rendering Context HGLRC HRc; // Permanent Rendering Context
#elif defined(_IRR_USE_LINUX_DEVICE_)
GLXDrawable Drawable;
#elif defined(_IRR_USE_OSX_DEVICE_) #elif defined(_IRR_USE_OSX_DEVICE_)
CIrrDeviceMacOSX *_device; CIrrDeviceMacOSX *_device;
#endif #endif
......
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
Driver->setTexture(0, material.getTexture(0)); Driver->setTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType))
{ {
// thanks to Murphy, the following line removed some // thanks to Murphy, the following line removed some
// bugs with several OpenGL implementations. // bugs with several OpenGL implementations.
......
...@@ -406,7 +406,7 @@ const core::dimension2d<s32>& COpenGLTexture::getOriginalSize() const ...@@ -406,7 +406,7 @@ const core::dimension2d<s32>& COpenGLTexture::getOriginalSize() const
} }
//! Returns of the texture. //! Returns size of the texture.
const core::dimension2d<s32>& COpenGLTexture::getSize() const const core::dimension2d<s32>& COpenGLTexture::getSize() const
{ {
if (Image) if (Image)
...@@ -501,7 +501,7 @@ bool COpenGLTexture::isRenderTarget() const ...@@ -501,7 +501,7 @@ bool COpenGLTexture::isRenderTarget() const
} }
void COpenGLTexture::setRenderTarget(bool isTarget) void COpenGLTexture::setIsRenderTarget(bool isTarget)
{ {
IsRenderTarget = isTarget; IsRenderTarget = isTarget;
} }
......
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
void unbindFrameBufferObject(); void unbindFrameBufferObject();
//! sets whether this texture is intended to be used as a render target. //! sets whether this texture is intended to be used as a render target.
void setRenderTarget(bool isTarget); void setIsRenderTarget(bool isTarget);
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment