diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-08-12 10:45:04 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-08-12 10:45:04 +0200 |
commit | b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed (patch) | |
tree | e22269066699afbd3e3464f0b69db08a610f57ef /src/graphics/opengl/gldevice.cpp | |
parent | 1996507fd3d4d9de90de99845b71a6bf3fbe62da (diff) | |
download | colobot-b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed.tar.gz colobot-b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed.tar.bz2 colobot-b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed.zip |
Fixes & testing in CEngine
- fixed bugs in settings modes, etc.
- some additions and minor refactoring
Diffstat (limited to 'src/graphics/opengl/gldevice.cpp')
-rw-r--r-- | src/graphics/opengl/gldevice.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 4c36053..caa79ee 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -73,6 +73,13 @@ Gfx::CGLDevice::~CGLDevice() { } +void Gfx::CGLDevice::DebugHook() +{ + /* This function is only called here, so it can be used + * as a breakpoint when debugging using gDEBugger */ + glColor3i(0, 0, 0); +} + std::string Gfx::CGLDevice::GetError() { return m_error; @@ -1172,17 +1179,19 @@ void Gfx::CGLDevice::GetFogParams(Gfx::FogMode &mode, Gfx::Color &color, float & void Gfx::CGLDevice::SetCullMode(Gfx::CullMode mode) { - if (mode == Gfx::CULL_CW) glCullFace(GL_CW); - else if (mode == Gfx::CULL_CCW) glCullFace(GL_CCW); + // Cull clockwise back faces, so front face is the opposite + // (assuming GL_CULL_FACE is GL_BACK) + if (mode == Gfx::CULL_CW ) glFrontFace(GL_CCW); + else if (mode == Gfx::CULL_CCW) glFrontFace(GL_CW); else assert(false); } Gfx::CullMode Gfx::CGLDevice::GetCullMode() { GLint flag = 0; - glGetIntegerv(GL_CULL_FACE, &flag); - if (flag == GL_CW) return Gfx::CULL_CW; - else if (flag == GL_CCW) return Gfx::CULL_CCW; + glGetIntegerv(GL_FRONT_FACE, &flag); + if (flag == GL_CW) return Gfx::CULL_CCW; + else if (flag == GL_CCW) return Gfx::CULL_CW; else assert(false); return Gfx::CULL_CW; } |