diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp index b863dea9d84..c21f94e6ec9 100644 --- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp +++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp @@ -294,7 +294,7 @@ void OpenGLSdlGraphics3dManager::createOrUpdateScreen() { _screenChangeCount++; -#if !defined(AMIGAOS) +#if !defined(AMIGAOS) && !defined(__MORPHOS__) if (renderToFrameBuffer) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); _frameBuffer = createFramebuffer(_engineRequestedWidth, _engineRequestedHeight); @@ -537,7 +537,7 @@ void OpenGLSdlGraphics3dManager::drawOverlay() { _surfaceRenderer->restorePreviousState(); } -#ifndef AMIGAOS +#if !defined(AMIGAOS) && !defined(__MORPHOS__) OpenGL::FrameBuffer *OpenGLSdlGraphics3dManager::createFramebuffer(uint width, uint height) { #if !defined(USE_GLES2) if (_antialiasing && OpenGLContext.framebufferObjectMultisampleSupported) { diff --git a/engines/grim/gfx_opengl.cpp b/engines/grim/gfx_opengl.cpp index 59438d7d5df..3ede494b83e 100644 --- a/engines/grim/gfx_opengl.cpp +++ b/engines/grim/gfx_opengl.cpp @@ -1900,7 +1900,9 @@ void GfxOpenGL::drawEmergString(int x, int y, const char *text, const Color &fgC glColor3f(1.0f, 1.0f, 1.0f); glListBase(_emergFont); - glCallLists(strlen(text), GL_UNSIGNED_BYTE, (const GLubyte *)text); + + char *list = const_cast(text); + glCallLists(strlen(text), GL_UNSIGNED_BYTE, (void *)text); glEnable(GL_LIGHTING); diff --git a/engines/myst3/gfx_opengl_texture.cpp b/engines/myst3/gfx_opengl_texture.cpp index e33c37f483c..9be83e28662 100644 --- a/engines/myst3/gfx_opengl_texture.cpp +++ b/engines/myst3/gfx_opengl_texture.cpp @@ -109,11 +109,12 @@ void OpenGLTexture::updateTexture(const Graphics::Surface *surface, const Common const Graphics::Surface subArea = surface->getSubArea(rect); glPixelStorei(GL_UNPACK_ROW_LENGTH, surface->pitch / surface->format.bytesPerPixel); - glTexSubImage2D(GL_TEXTURE_2D, 0, rect.left, rect.top, subArea.w, subArea.h, internalFormat, sourceFormat, subArea.getPixels()); + + glTexSubImage2D(GL_TEXTURE_2D, 0, rect.left, rect.top, subArea.w, subArea.h, internalFormat, sourceFormat, const_cast(subArea.getPixels())); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } else { // GL_UNPACK_ROW_LENGTH is not supported, don't bother and do a full texture update - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, internalFormat, sourceFormat, surface->getPixels()); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, internalFormat, sourceFormat, const_cast(surface->getPixels())); } } diff --git a/engines/wintermute/ad/ad_actor_3dx.cpp b/engines/wintermute/ad/ad_actor_3dx.cpp index ba4f01e4269..b167e4b2adc 100644 --- a/engines/wintermute/ad/ad_actor_3dx.cpp +++ b/engines/wintermute/ad/ad_actor_3dx.cpp @@ -191,7 +191,7 @@ bool AdActor3DX::update() { Math::Matrix4 newWorldMat; getMatrix(&newWorldMat, &newPos); - int newX, newY; + int32 newX, newY; convert3DTo2D(&newWorldMat, &newX, &newY); canWalk = !scene->isBlockedAt(newX, newY, false, this); } else { @@ -2441,7 +2441,7 @@ bool AdActor3DX::updatePartEmitter() { Math::Vector3d bonePos; getBonePosition3D(_partBone.c_str(), &bonePos, &_partOffset); - int x = 0, y = 0; + int32 x = 0, y = 0; static_cast(_gameRef)->_scene->_sceneGeometry->convert3Dto2D(&bonePos, &x, &y); _partEmitter->_posX = x - _gameRef->_renderer->_drawOffsetX; diff --git a/engines/wintermute/base/gfx/base_renderer3d.h b/engines/wintermute/base/gfx/base_renderer3d.h index 6a7a7612191..c3d8d7c9507 100644 --- a/engines/wintermute/base/gfx/base_renderer3d.h +++ b/engines/wintermute/base/gfx/base_renderer3d.h @@ -88,7 +88,7 @@ public: virtual void resetModelViewTransform() = 0; virtual void setWorldTransform(const Math::Matrix4 &transform) = 0; - void project(const Math::Matrix4 &worldMatrix, const Math::Vector3d &point, int &x, int &y); + void project(const Math::Matrix4 &worldMatrix, const Math::Vector3d &point, int32 &x, int32 &y); Math::Ray rayIntoScene(int x, int y); Math::Matrix4 lastProjectionMatrix() { diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp index 2e5dbb540c6..a7ba20dcb39 100644 --- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp +++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp @@ -213,8 +213,10 @@ void BaseRenderOpenGL3D::displayShadow(BaseObject *object, const Math::Vector3d glEnable(GL_TEXTURE_2D); static_cast(shadowImage)->setTexture(); + #ifndef __MORPHOS__ glInterleavedArrays(GL_T2F_N3F_V3F, 0, _simpleShadow); - + #endif + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDepthMask(true); @@ -476,7 +478,7 @@ bool BaseRenderOpenGL3D::setup2D(bool force) { #if defined(__MINGW32__) && defined (SDL_BACKEND) && !defined(USE_GLEW) glActiveTexturePtr(GL_TEXTURE0); #else - glActiveTexture(GL_TEXTURE0); + glActiveTextureARB(GL_TEXTURE0); #endif glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); @@ -489,16 +491,16 @@ bool BaseRenderOpenGL3D::setup2D(bool force) { #if defined(__MINGW32__) && defined (SDL_BACKEND) && !defined(USE_GLEW) glActiveTexturePtr(GL_TEXTURE1); #else - glActiveTexture(GL_TEXTURE1); + glActiveTextureARB(GL_TEXTURE1); #endif glDisable(GL_TEXTURE_2D); #if defined(__MINGW32__) && defined (SDL_BACKEND) && !defined(USE_GLEW) glActiveTexturePtr(GL_TEXTURE0); #else - glActiveTexture(GL_TEXTURE0); - + glActiveTextureARB(GL_TEXTURE0); #endif + glViewport(0, 0, _width, _height); setProjection2D(); } @@ -722,7 +724,10 @@ bool BaseRenderOpenGL3D::drawSpriteEx(BaseSurfaceOpenGL3D &tex, const Wintermute glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); +#ifndef __MORPHOS__ glInterleavedArrays(GL_T2F_C4UB_V3F, 0, vertices); +#endif + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); if (alphaDisable) { diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp index d7686278218..867110b88a7 100644 --- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp +++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp @@ -243,7 +243,7 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _texWidth, _texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, surface.getPixels()); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, const_cast(surface.getPixels())); glBindTexture(GL_TEXTURE_2D, 0); _valid = true; diff --git a/engines/wintermute/base/gfx/opengl/meshx_opengl.cpp b/engines/wintermute/base/gfx/opengl/meshx_opengl.cpp index af7368ad492..3acc8dd65d1 100644 --- a/engines/wintermute/base/gfx/opengl/meshx_opengl.cpp +++ b/engines/wintermute/base/gfx/opengl/meshx_opengl.cpp @@ -69,8 +69,9 @@ bool MeshXOpenGL::render(ModelX *model) { glDisable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 0); } - +#ifndef __MORPHOS__ glInterleavedArrays(GL_T2F_N3F_V3F, 0, _vertexData); +#endif glDrawElements(GL_TRIANGLES, _indexRanges[i + 1] - _indexRanges[i], GL_UNSIGNED_SHORT, _indexData.data() + _indexRanges[i]); } diff --git a/engines/wintermute/base/gfx/opengl/shadow_volume_opengl.cpp b/engines/wintermute/base/gfx/opengl/shadow_volume_opengl.cpp index 250ec868b86..26a72eeaa4a 100644 --- a/engines/wintermute/base/gfx/opengl/shadow_volume_opengl.cpp +++ b/engines/wintermute/base/gfx/opengl/shadow_volume_opengl.cpp @@ -135,7 +135,9 @@ bool ShadowVolumeOpenGL::renderToScene() { glDisableClientState(GL_TEXTURE_COORD_ARRAY); // Draw a big, gray square +#ifndef __MORPHOS__ glInterleavedArrays(GL_C4UB_V3F, 0, _shadowMask); +#endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // Restore render states diff --git a/engines/wintermute/base/gfx/x/modelx.cpp b/engines/wintermute/base/gfx/x/modelx.cpp index b77fd0b3c31..b2aaccc900d 100644 --- a/engines/wintermute/base/gfx/x/modelx.cpp +++ b/engines/wintermute/base/gfx/x/modelx.cpp @@ -588,7 +588,7 @@ void ModelX::updateBoundingRect() { } ////////////////////////////////////////////////////////////////////////// -void ModelX::updateRect(Rect32 *rc, int x, int y) { +void ModelX::updateRect(Rect32 *rc, int32 x, int32 y) { rc->left = MIN(rc->left, x); rc->right = MAX(rc->right, x); rc->top = MIN(rc->top, y); diff --git a/engines/wintermute/base/gfx/x/modelx.h b/engines/wintermute/base/gfx/x/modelx.h index ea1db982ad7..674ad8a4ea2 100644 --- a/engines/wintermute/base/gfx/x/modelx.h +++ b/engines/wintermute/base/gfx/x/modelx.h @@ -193,7 +193,7 @@ private: void parseFrameDuringMerge(XFileLexer &lexer, const Common::String &filename); void updateBoundingRect(); - void static inline updateRect(Rect32 *rc, int x, int y); + void static inline updateRect(Rect32 *rc, int32 x, int32 y); Rect32 _drawingViewport; Math::Matrix4 _lastViewMat; Math::Matrix4 _lastProjMat; diff --git a/graphics/opengl/framebuffer.cpp b/graphics/opengl/framebuffer.cpp index 5cbd8b6f7b6..939fc2a21f8 100644 --- a/graphics/opengl/framebuffer.cpp +++ b/graphics/opengl/framebuffer.cpp @@ -23,7 +23,7 @@ #include "common/textconsole.h" #include "common/util.h" -#if defined(USE_OPENGL_GAME) && !defined(AMIGAOS) +#if defined(USE_OPENGL_GAME) && !defined(AMIGAOS) && !defined(__MORPHOS__) #if defined(SDL_BACKEND) && !defined(USE_GLEW) && !defined(USE_GLES2) #define GL_GLEXT_PROTOTYPES // For the GL_EXT_framebuffer_object extension @@ -188,7 +188,7 @@ void FrameBuffer::detach() { glBindFramebuffer(GL_FRAMEBUFFER, 0); } -#if !defined(USE_GLES2) && !defined(AMIGAOS) +#if !defined(USE_GLES2) && !defined(AMIGAOS) && !defined(__MORPHOS__) MultiSampleFrameBuffer::MultiSampleFrameBuffer(uint width, uint height, int samples) : FrameBuffer(width,height) { if (!OpenGLContext.framebufferObjectMultisampleSupported) { @@ -251,7 +251,7 @@ void MultiSampleFrameBuffer::detach() { glBindFramebuffer(GL_FRAMEBUFFER, 0); } -#endif // !defined(USE_GLES2) && !defined(AMIGAOS) +#endif // !defined(USE_GLES2) && !defined(AMIGAOS) && !defined(__MORPHOS__) } // End of namespace OpenGL diff --git a/graphics/opengl/framebuffer.h b/graphics/opengl/framebuffer.h index 8f516d438fd..0f8383b1c71 100644 --- a/graphics/opengl/framebuffer.h +++ b/graphics/opengl/framebuffer.h @@ -32,7 +32,7 @@ class FrameBuffer : public TextureGL { public: FrameBuffer(uint width, uint height); FrameBuffer(GLuint texture_name, uint width, uint height, uint texture_width, uint texture_height); -#ifdef AMIGAOS +#if defined(AMIGAOS) || defined(__MORPHOS__) virtual ~FrameBuffer() {} void attach() {} @@ -53,7 +53,7 @@ private: GLuint _frameBuffer; }; -#if !defined(USE_GLES2) && !defined(AMIGAOS) +#if !defined(USE_GLES2) && !defined(AMIGAOS) && !defined(__MORPHOS__) class MultiSampleFrameBuffer : public FrameBuffer { public: MultiSampleFrameBuffer(uint width, uint height, int samples); diff --git a/graphics/opengl/texture.cpp b/graphics/opengl/texture.cpp index 89cac50a20b..0ea8d17cbef 100644 --- a/graphics/opengl/texture.cpp +++ b/graphics/opengl/texture.cpp @@ -103,7 +103,7 @@ TextureGL::TextureGL(const Graphics::Surface &srf) : glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, format, _texWidth, _texHeight, 0, format, type, 0); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, format, type, surfaceToUpload->getPixels()); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, format, type, const_cast(surfaceToUpload->getPixels())); if (OpenGLContext.unpackSubImageSupported) { glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);