MORPHOS : Fixed for int vs int32 types for AmigaOS/MorphOS (#2510)
MORPHOS : Fixed int to int32 and some functions not available on AmigaOS/MorphOS
This commit is contained in:
parent
15119e2ca0
commit
cab7cd49c4
14 changed files with 34 additions and 23 deletions
|
@ -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) {
|
||||
|
|
|
@ -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<char *>(text);
|
||||
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (void *)text);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
|
|
|
@ -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<void *>(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<void *>(surface->getPixels()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<AdGame *>(_gameRef)->_scene->_sceneGeometry->convert3Dto2D(&bonePos, &x, &y);
|
||||
|
||||
_partEmitter->_posX = x - _gameRef->_renderer->_drawOffsetX;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -213,8 +213,10 @@ void BaseRenderOpenGL3D::displayShadow(BaseObject *object, const Math::Vector3d
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
static_cast<BaseSurfaceOpenGL3D *>(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) {
|
||||
|
|
|
@ -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<void *>(surface.getPixels()));
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
_valid = true;
|
||||
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<void *>(surfaceToUpload->getPixels()));
|
||||
|
||||
if (OpenGLContext.unpackSubImageSupported) {
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue