mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
(R): Remove use of __LINUX__ in OpenGL.h and OpenGL.cpp
This commit is contained in:
parent
d7e775959e
commit
a5cdb4480c
46
OpenGL.cpp
46
OpenGL.cpp
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
GLInfo OGL;
|
GLInfo OGL;
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
// GLSL functions
|
// GLSL functions
|
||||||
PFNGLCREATESHADERPROC glCreateShader;
|
PFNGLCREATESHADERPROC glCreateShader;
|
||||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||||
|
@ -101,7 +101,7 @@ PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
|
||||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||||
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
||||||
PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT;
|
PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT;
|
||||||
#endif // !__LINUX__
|
#endif // _WINDOWS
|
||||||
|
|
||||||
BOOL isExtensionSupported( const char *extension )
|
BOOL isExtensionSupported( const char *extension )
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ void OGL_InitExtensions()
|
||||||
const char *version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
|
const char *version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
|
||||||
u32 uVersion = atol(version);
|
u32 uVersion = atol(version);
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
glCreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader");
|
glCreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader");
|
||||||
glCompileShader = (PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader");
|
glCompileShader = (PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader");
|
||||||
glShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource");
|
glShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource");
|
||||||
|
@ -159,31 +159,31 @@ void OGL_InitExtensions()
|
||||||
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)wglGetProcAddress("glGetProgramiv");
|
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)wglGetProcAddress("glGetProgramiv");
|
||||||
|
|
||||||
glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)wglGetProcAddress("glSecondaryColor3f");
|
glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)wglGetProcAddress("glSecondaryColor3f");
|
||||||
#endif // __LINUX__
|
#endif // _WINDOWS
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
glActiveTexture = (PFNGLACTIVETEXTUREPROC)wglGetProcAddress( "glActiveTexture" );
|
glActiveTexture = (PFNGLACTIVETEXTUREPROC)wglGetProcAddress( "glActiveTexture" );
|
||||||
glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)wglGetProcAddress( "glClientActiveTexture" );
|
glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)wglGetProcAddress( "glClientActiveTexture" );
|
||||||
glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)wglGetProcAddress( "glMultiTexCoord2f" );
|
glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)wglGetProcAddress( "glMultiTexCoord2f" );
|
||||||
#endif // !__LINUX__
|
#endif //
|
||||||
|
|
||||||
glGetIntegerv( GL_MAX_TEXTURE_UNITS, &OGL.maxTextureUnits );
|
glGetIntegerv( GL_MAX_TEXTURE_UNITS, &OGL.maxTextureUnits );
|
||||||
OGL.maxTextureUnits = min( 8, OGL.maxTextureUnits ); // The plugin only supports 8, and 4 is really enough
|
OGL.maxTextureUnits = min( 8, OGL.maxTextureUnits ); // The plugin only supports 8, and 4 is really enough
|
||||||
|
|
||||||
if (OGL.EXT_fog_coord = isExtensionSupported( "GL_EXT_fog_coord" ))
|
if (OGL.EXT_fog_coord = isExtensionSupported( "GL_EXT_fog_coord" ))
|
||||||
{
|
{
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)wglGetProcAddress( "glFogCoordfEXT" );
|
glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)wglGetProcAddress( "glFogCoordfEXT" );
|
||||||
glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)wglGetProcAddress( "glFogCoordfvEXT" );
|
glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)wglGetProcAddress( "glFogCoordfvEXT" );
|
||||||
glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)wglGetProcAddress( "glFogCoorddEXT" );
|
glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)wglGetProcAddress( "glFogCoorddEXT" );
|
||||||
glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)wglGetProcAddress( "glFogCoorddvEXT" );
|
glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)wglGetProcAddress( "glFogCoorddvEXT" );
|
||||||
glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)wglGetProcAddress( "glFogCoordPointerEXT" );
|
glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)wglGetProcAddress( "glFogCoordPointerEXT" );
|
||||||
#endif // !__LINUX__
|
#endif // _WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OGL.EXT_secondary_color = isExtensionSupported( "GL_EXT_secondary_color" ))
|
if (OGL.EXT_secondary_color = isExtensionSupported( "GL_EXT_secondary_color" ))
|
||||||
{
|
{
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)wglGetProcAddress( "glSecondaryColor3bEXT" );
|
glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)wglGetProcAddress( "glSecondaryColor3bEXT" );
|
||||||
glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)wglGetProcAddress( "glSecondaryColor3bvEXT" );
|
glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)wglGetProcAddress( "glSecondaryColor3bvEXT" );
|
||||||
glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)wglGetProcAddress( "glSecondaryColor3dEXT" );
|
glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)wglGetProcAddress( "glSecondaryColor3dEXT" );
|
||||||
|
@ -201,10 +201,10 @@ void OGL_InitExtensions()
|
||||||
glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)wglGetProcAddress( "glSecondaryColor3usEXT" );
|
glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)wglGetProcAddress( "glSecondaryColor3usEXT" );
|
||||||
glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)wglGetProcAddress( "glSecondaryColor3usvEXT" );
|
glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)wglGetProcAddress( "glSecondaryColor3usvEXT" );
|
||||||
glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)wglGetProcAddress( "glSecondaryColorPointerEXT" );
|
glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)wglGetProcAddress( "glSecondaryColorPointerEXT" );
|
||||||
#endif // !__LINUX__
|
#endif // _WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
glDrawBuffers = (PFNGLDRAWBUFFERSPROC)wglGetProcAddress( "glDrawBuffers" );
|
glDrawBuffers = (PFNGLDRAWBUFFERSPROC)wglGetProcAddress( "glDrawBuffers" );
|
||||||
glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)wglGetProcAddress( "glBindFramebuffer" );
|
glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)wglGetProcAddress( "glBindFramebuffer" );
|
||||||
glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)wglGetProcAddress( "glDeleteFramebuffers" );
|
glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)wglGetProcAddress( "glDeleteFramebuffers" );
|
||||||
|
@ -238,7 +238,7 @@ void OGL_InitExtensions()
|
||||||
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
|
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
|
||||||
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
|
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
|
||||||
glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)wglGetProcAddress("glBlitFramebufferEXT");
|
glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)wglGetProcAddress("glBlitFramebufferEXT");
|
||||||
#endif // !__LINUX__
|
#endif // _WINDOWS
|
||||||
|
|
||||||
if (glGenFramebuffers != NULL)
|
if (glGenFramebuffers != NULL)
|
||||||
OGL.framebuffer_mode = GLInfo::fbFBO;
|
OGL.framebuffer_mode = GLInfo::fbFBO;
|
||||||
|
@ -321,7 +321,7 @@ void OGL_UpdateScale()
|
||||||
|
|
||||||
void OGL_ResizeWindow()
|
void OGL_ResizeWindow()
|
||||||
{
|
{
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
RECT windowRect, statusRect, toolRect;
|
RECT windowRect, statusRect, toolRect;
|
||||||
|
|
||||||
if (OGL.fullscreen)
|
if (OGL.fullscreen)
|
||||||
|
@ -354,13 +354,12 @@ void OGL_ResizeWindow()
|
||||||
SetWindowPos( hWnd, NULL, 0, 0, windowRect.right - windowRect.left + 1,
|
SetWindowPos( hWnd, NULL, 0, 0, windowRect.right - windowRect.left + 1,
|
||||||
windowRect.bottom - windowRect.top + 1 + toolRect.bottom - toolRect.top + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE );
|
windowRect.bottom - windowRect.top + 1 + toolRect.bottom - toolRect.top + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE );
|
||||||
}
|
}
|
||||||
#else // !__LINUX__
|
#endif // _WINDOWS
|
||||||
#endif // __LINUX__
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OGL_Start()
|
bool OGL_Start()
|
||||||
{
|
{
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
int pixelFormat;
|
int pixelFormat;
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR pfd = {
|
PIXELFORMATDESCRIPTOR pfd = {
|
||||||
|
@ -417,7 +416,7 @@ bool OGL_Start()
|
||||||
OGL_Stop();
|
OGL_Stop();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#else // !__LINUX__
|
#else // _WINDOWS
|
||||||
// init sdl & gl
|
// init sdl & gl
|
||||||
const SDL_VideoInfo *videoInfo;
|
const SDL_VideoInfo *videoInfo;
|
||||||
Uint32 videoFlags = 0;
|
Uint32 videoFlags = 0;
|
||||||
|
@ -477,7 +476,7 @@ bool OGL_Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_WM_SetCaption( pluginName, pluginName );
|
SDL_WM_SetCaption( pluginName, pluginName );
|
||||||
#endif // __LINUX__
|
#endif // _WINDOWS
|
||||||
|
|
||||||
OGL_InitExtensions();
|
OGL_InitExtensions();
|
||||||
OGL_InitStates();
|
OGL_InitStates();
|
||||||
|
@ -499,7 +498,7 @@ void OGL_Stop()
|
||||||
FrameBuffer_Destroy();
|
FrameBuffer_Destroy();
|
||||||
TextureCache_Destroy();
|
TextureCache_Destroy();
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
wglMakeCurrent( NULL, NULL );
|
wglMakeCurrent( NULL, NULL );
|
||||||
|
|
||||||
if (OGL.hRC)
|
if (OGL.hRC)
|
||||||
|
@ -513,10 +512,10 @@ void OGL_Stop()
|
||||||
ReleaseDC( hWnd, OGL.hDC );
|
ReleaseDC( hWnd, OGL.hDC );
|
||||||
OGL.hDC = NULL;
|
OGL.hDC = NULL;
|
||||||
}
|
}
|
||||||
#else // !__LINUX__
|
#else // _WINDOWS
|
||||||
SDL_QuitSubSystem( SDL_INIT_VIDEO );
|
SDL_QuitSubSystem( SDL_INIT_VIDEO );
|
||||||
OGL.hScreen = NULL;
|
OGL.hScreen = NULL;
|
||||||
#endif // __LINUX__
|
#endif // _WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGL_UpdateCullFace()
|
void OGL_UpdateCullFace()
|
||||||
|
@ -1078,7 +1077,7 @@ void OGL_ClearColorBuffer( float *color )
|
||||||
|
|
||||||
void OGL_SaveScreenshot()
|
void OGL_SaveScreenshot()
|
||||||
{
|
{
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
BITMAPFILEHEADER fileHeader;
|
BITMAPFILEHEADER fileHeader;
|
||||||
BITMAPINFOHEADER infoHeader;
|
BITMAPINFOHEADER infoHeader;
|
||||||
HANDLE hBitmapFile;
|
HANDLE hBitmapFile;
|
||||||
|
@ -1133,8 +1132,7 @@ void OGL_SaveScreenshot()
|
||||||
|
|
||||||
CloseHandle( hBitmapFile );
|
CloseHandle( hBitmapFile );
|
||||||
free( pixelData );
|
free( pixelData );
|
||||||
#else // !__LINUX__
|
#endif // _WINDOWS
|
||||||
#endif // __LINUX__
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGL_ReadScreen( void **dest, long *width, long *height )
|
void OGL_ReadScreen( void **dest, long *width, long *height )
|
||||||
|
|
14
OpenGL.h
14
OpenGL.h
|
@ -1,7 +1,7 @@
|
||||||
#ifndef OPENGL_H
|
#ifndef OPENGL_H
|
||||||
#define OPENGL_H
|
#define OPENGL_H
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include "glext.h"
|
#include "glext.h"
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#endif // __LINUX__
|
#endif // _WINDOWS
|
||||||
|
|
||||||
#include "gSP.h"
|
#include "gSP.h"
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ struct GLVertex
|
||||||
|
|
||||||
struct GLInfo
|
struct GLInfo
|
||||||
{
|
{
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
HGLRC hRC;
|
HGLRC hRC;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
#else
|
#else
|
||||||
SDL_Surface *hScreen;
|
SDL_Surface *hScreen;
|
||||||
#endif // __LINUX__
|
#endif // _WINDOWS
|
||||||
|
|
||||||
DWORD fullscreenWidth, fullscreenHeight, fullscreenBits, fullscreenRefresh;
|
DWORD fullscreenWidth, fullscreenHeight, fullscreenBits, fullscreenRefresh;
|
||||||
DWORD width, height, windowedWidth, windowedHeight, heightOffset;
|
DWORD width, height, windowedWidth, windowedHeight, heightOffset;
|
||||||
|
@ -57,7 +57,7 @@ struct GLInfo
|
||||||
BYTE triangles[80][3];
|
BYTE triangles[80][3];
|
||||||
BYTE numTriangles;
|
BYTE numTriangles;
|
||||||
BYTE numVertices;
|
BYTE numVertices;
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
HWND hFullscreenWnd;
|
HWND hFullscreenWnd;
|
||||||
#endif
|
#endif
|
||||||
GLubyte stipplePattern[32][8][128];
|
GLubyte stipplePattern[32][8][128];
|
||||||
|
@ -81,7 +81,7 @@ struct GLcolor
|
||||||
float r, g, b, a;
|
float r, g, b, a;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef __LINUX__
|
#ifdef _WINDOWS
|
||||||
extern PFNGLCREATESHADERPROC glCreateShader;
|
extern PFNGLCREATESHADERPROC glCreateShader;
|
||||||
extern PFNGLCOMPILESHADERPROC glCompileShader;
|
extern PFNGLCOMPILESHADERPROC glCompileShader;
|
||||||
extern PFNGLSHADERSOURCEPROC glShaderSource;
|
extern PFNGLSHADERSOURCEPROC glShaderSource;
|
||||||
|
@ -173,7 +173,7 @@ extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
|
||||||
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||||
extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
||||||
extern PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT;
|
extern PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT;
|
||||||
#endif // !__LINUX__
|
#endif // !_WINDOWS
|
||||||
|
|
||||||
bool OGL_Start();
|
bool OGL_Start();
|
||||||
void OGL_Stop();
|
void OGL_Stop();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user