diff options
author | Eugene Sandulenko | 2010-08-13 15:24:23 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 22:39:23 +0000 |
commit | fd40021a722956a3c37119c72b1350acb313574e (patch) | |
tree | b61dd65523d8a26a3b39cfa7fa44c36fc81982f8 /engines/sword25/gfx/opengl | |
parent | d50dcb80ad44465745a38ea42bd87db9480db949 (diff) | |
download | scummvm-rg350-fd40021a722956a3c37119c72b1350acb313574e.tar.gz scummvm-rg350-fd40021a722956a3c37119c72b1350acb313574e.tar.bz2 scummvm-rg350-fd40021a722956a3c37119c72b1350acb313574e.zip |
SWORD25: Started rewriting gfx subsystem
svn-id: r53227
Diffstat (limited to 'engines/sword25/gfx/opengl')
-rw-r--r-- | engines/sword25/gfx/opengl/glimage.cpp | 29 | ||||
-rw-r--r-- | engines/sword25/gfx/opengl/glimage.h | 2 | ||||
-rw-r--r-- | engines/sword25/gfx/opengl/openglgfx.cpp | 69 |
3 files changed, 18 insertions, 82 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index d5e1376299..3ab20016de 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -75,8 +75,7 @@ BS_GLImage::BS_GLImage(const Common::String &Filename, bool &Result) : } // Das Bild dekomprimieren - char *pUncompressedData; - if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch)) { + if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, _data, m_Width, m_Height, Pitch)) { BS_LOG_ERRORLN("Could not decode image."); return; } @@ -84,19 +83,6 @@ BS_GLImage::BS_GLImage(const Common::String &Filename, bool &Result) : // Dateidaten freigeben delete[] pFileData; - // GLS-Sprite mit den Bilddaten erstellen - GLS_Result GLSResult = GLS_NewSprite(m_Width, m_Height, - (ColorFormat == BS_GraphicEngine::CF_ARGB32) ? GLS_True : GLS_False, - pUncompressedData, - &m_Sprite); - if (Result != GLS_OK) { - BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(GLSResult)); - return; - } - - // Bilddaten freigeben - delete[] pUncompressedData; - Result = true; return; } @@ -104,20 +90,11 @@ BS_GLImage::BS_GLImage(const Common::String &Filename, bool &Result) : // ----------------------------------------------------------------------------- BS_GLImage::BS_GLImage(unsigned int Width, unsigned int Height, bool &Result) : - m_Sprite(0), m_Width(Width), m_Height(Height) { Result = false; - // GLS-Sprite mit den Bilddaten erstellen - GLS_Result GLSResult = GLS_NewSprite(m_Width, m_Height, - GLS_True, - 0, - &m_Sprite); - if (GLSResult != GLS_OK) { - BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(GLSResult)); - return; - } + _data = new byte[Width * Height * 4]; Result = true; return; @@ -126,7 +103,7 @@ BS_GLImage::BS_GLImage(unsigned int Width, unsigned int Height, bool &Result) : // ----------------------------------------------------------------------------- BS_GLImage::~BS_GLImage() { - if (m_Sprite) GLS_DeleteSprite(m_Sprite); + delete[] _data; } // ----------------------------------------------------------------------------- diff --git a/engines/sword25/gfx/opengl/glimage.h b/engines/sword25/gfx/opengl/glimage.h index 9679089cee..c1dfbdc0b9 100644 --- a/engines/sword25/gfx/opengl/glimage.h +++ b/engines/sword25/gfx/opengl/glimage.h @@ -113,7 +113,7 @@ public: return true; } private: - GLS_Sprite m_Sprite; + byte *_data; int m_Width; int m_Height; }; diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp index 6937efb813..7e6ad4d392 100644 --- a/engines/sword25/gfx/opengl/openglgfx.cpp +++ b/engines/sword25/gfx/opengl/openglgfx.cpp @@ -32,15 +32,6 @@ * */ -// ----------------------------------------------------------------------------- -// INCLUDES -// ----------------------------------------------------------------------------- - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <GL/GL.h> - -#include "sword25/util/glsprites/glsprites.h" #include "sword25/gfx/bitmapresource.h" #include "sword25/gfx/animationresource.h" #include "sword25/gfx/fontresource.h" @@ -125,13 +116,7 @@ bool BS_OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount m_ScreenRect.right = m_Width; m_ScreenRect.bottom = m_Height; - // GLsprites initialisieren - HWND hwnd = reinterpret_cast<HWND>(BS_Kernel::GetInstance()->GetWindow()->GetWindowHandle()); - GLS_Result Result = GLS_InitExternalWindow(Width, Height, Windowed ? GLS_False : GLS_True, hwnd); - if (Result != GLS_OK) { - BS_LOG_ERRORLN("Could not initialize GLsprites. Reason: %s", GLS_ResultString(Result)); - return false; - } + // We already iniitalized gfx after the engine creation m_GLspritesInitialized = true; // Standardmäßig ist Vsync an. @@ -158,13 +143,6 @@ bool BS_OpenGLGfx::StartFrame(bool UpdateAll) { // Den Layer-Manager auf den nächsten Frame vorbereiten m_RenderObjectManagerPtr->StartFrame(); - // GLsprites bescheidgeben - GLS_Result Result = GLS_StartFrame(); - if (Result != GLS_OK) { - BS_LOG_ERRORLN("Call to GLS_StartFrame() failed. Reason: %s", GLS_ResultString(Result)); - return false; - } - return true; } @@ -174,8 +152,11 @@ bool BS_OpenGLGfx::EndFrame() { // Scene zeichnen m_RenderObjectManagerPtr->Render(); + g_system->updateScreen(); + // Debug-Lines zeichnen if (!m_DebugLines.empty()) { +#if 0 glEnable(GL_LINE_SMOOTH); glBegin(GL_LINES); @@ -192,15 +173,11 @@ bool BS_OpenGLGfx::EndFrame() { glEnd(); glDisable(GL_LINE_SMOOTH); +#endif - m_DebugLines.clear(); - } + warning("STUB: Drawing debug lines"); - // Flippen - GLS_Result Result = GLS_EndFrame(); - if (Result != GLS_OK) { - BS_LOG_ERRORLN("Call to GLS_EndFrame() failed. Reason: %s", GLS_ResultString(Result)); - return false; + m_DebugLines.clear(); } // Framecounter aktualisieren @@ -218,21 +195,15 @@ BS_RenderObjectPtr<BS_Panel> BS_OpenGLGfx::GetMainPanel() { // ----------------------------------------------------------------------------- void BS_OpenGLGfx::SetVsync(bool Vsync) { - GLS_Result Result = GLS_SetVSync(Vsync ? GLS_True : GLS_False); - if (Result != GLS_OK) BS_LOG_WARNINGLN("Could not set vsync status. Reason: %s", GLS_ResultString(Result)); + warning("STUB: SetVsync(%d)", Vsync); } // ----------------------------------------------------------------------------- bool BS_OpenGLGfx::GetVsync() const { - GLS_Bool Status; - GLS_Result Result = GLS_IsVsync(&Status); - if (Result != GLS_OK) { - BS_LOG_WARNINGLN("Could not get vsync status. Returning false. Reason: %s", GLS_ResultString(Result)); - return false; - } + warning("STUB: GetVsync()"); - return Status == GLS_True ? true : false; + return true; } // ----------------------------------------------------------------------------- @@ -248,16 +219,9 @@ bool BS_OpenGLGfx::Fill(const BS_Rect *FillRectPtr, unsigned int Color) { FillRectPtr = &Rect; } - glBegin(GL_QUADS); - glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24); + warning("STUB: Fill()"); - glVertex2i(FillRectPtr->left, FillRectPtr->top); - glVertex2i(FillRectPtr->right, FillRectPtr->top); - glVertex2i(FillRectPtr->right, FillRectPtr->bottom); - glVertex2i(FillRectPtr->left, FillRectPtr->bottom); - glEnd(); - - return glGetError() == 0; + return true; } // ----------------------------------------------------------------------------- @@ -281,13 +245,8 @@ bool BS_OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, byte bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data) { *Data = (byte *)malloc(Width * Height * 4); - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, *Data); - - if (glGetError() == 0) - return true; - else { - return false; - } + + return true; } // ----------------------------------------------------------------------------- |