mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 07:22:05 +00:00
- replaced GLEW with GLLoadGen for GL access. This allows to have a header that only contains what's actually required, namely OpenGL 3.3 plus glBegin and glEnd which are the only compatibility functions needed for the fallback render path.
GLEW has two major problems: - it always includes everything, there is no way to restrict the header to a specific GL version - it is mostly broken with a core profile and only works if all sanity checks get switched off.
This commit is contained in:
parent
6f65bccf1c
commit
e132fc5eed
7 changed files with 3156 additions and 43 deletions
|
@ -239,33 +239,6 @@ set( ZDOOM_LIBS ${ZDOOM_LIBS} ${OPENGL_LIBRARIES} )
|
||||||
include_directories( ${OPENGL_INCLUDE_DIR} )
|
include_directories( ${OPENGL_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
|
||||||
# check for GLEW
|
|
||||||
find_path( GLEW_INCLUDE_DIR GL/glew.h
|
|
||||||
PATHS "/usr/include"
|
|
||||||
"/usr/local/include" )
|
|
||||||
|
|
||||||
if( GLEW_INCLUDE_DIR )
|
|
||||||
message( STATUS "GLEW include files found at ${GLEW_INCLUDE_DIR}" )
|
|
||||||
else( GLEW_INCLUDE_DIR )
|
|
||||||
message( SEND_ERROR "Could not find GLEW include files" )
|
|
||||||
endif( GLEW_INCLUDE_DIR )
|
|
||||||
|
|
||||||
# GLEW include directory
|
|
||||||
include_directories( "${GLEW_INCLUDE_DIR}" )
|
|
||||||
|
|
||||||
if( NOT WIN32 OR APPLE )
|
|
||||||
find_library( GLEW_LIBRARY libGLEW.so )
|
|
||||||
else( NOT WIN32 OR APPLE )
|
|
||||||
find_library( GLEW_LIBRARY glew32 )
|
|
||||||
endif( NOT WIN32 OR APPLE )
|
|
||||||
|
|
||||||
if( NOT GLEW_LIBRARY )
|
|
||||||
message( SEND_ERROR "Could not find GLEW library files" )
|
|
||||||
endif( NOT GLEW_LIBRARY )
|
|
||||||
|
|
||||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GLEW_LIBRARY} )
|
|
||||||
|
|
||||||
|
|
||||||
# Decide on the name of the FMOD library we want to use.
|
# Decide on the name of the FMOD library we want to use.
|
||||||
|
|
||||||
if( NOT FMOD_LIB_NAME AND MSVC )
|
if( NOT FMOD_LIB_NAME AND MSVC )
|
||||||
|
@ -1099,6 +1072,7 @@ add_executable( zdoom WIN32
|
||||||
gl/system/gl_framebuffer.cpp
|
gl/system/gl_framebuffer.cpp
|
||||||
gl/system/gl_menu.cpp
|
gl/system/gl_menu.cpp
|
||||||
gl/system/gl_wipe.cpp
|
gl/system/gl_wipe.cpp
|
||||||
|
gl/system/gl_load.c
|
||||||
gl/models/gl_models_md3.cpp
|
gl/models/gl_models_md3.cpp
|
||||||
gl/models/gl_models_md2.cpp
|
gl/models/gl_models_md2.cpp
|
||||||
gl/models/gl_models.cpp
|
gl/models/gl_models.cpp
|
||||||
|
|
|
@ -121,8 +121,7 @@ void OpenGLFrameBuffer::InitializeState()
|
||||||
|
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
glewExperimental=true;
|
ogl_LoadFunctions();
|
||||||
glewInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_LoadExtensions();
|
gl_LoadExtensions();
|
||||||
|
@ -536,4 +535,5 @@ void OpenGLFrameBuffer::GameRestart()
|
||||||
ScreenshotBuffer = NULL;
|
ScreenshotBuffer = NULL;
|
||||||
LastCamera = NULL;
|
LastCamera = NULL;
|
||||||
gl_GenerateGlobalBrightmapFromColormap();
|
gl_GenerateGlobalBrightmapFromColormap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1344
src/gl/system/gl_load.c
Normal file
1344
src/gl/system/gl_load.c
Normal file
File diff suppressed because it is too large
Load diff
1793
src/gl/system/gl_load.h
Normal file
1793
src/gl/system/gl_load.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -67,13 +67,10 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
//GL headers
|
//GL headers
|
||||||
#include <GL/glew.h>
|
#include "gl_load.h"
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#elif defined(__unix__)
|
|
||||||
//#include <GL/glxew.h>
|
|
||||||
#else // !__APPLE__ && !__unix__
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
#include "gl/system/gl_system.h"
|
//#include "gl/system/gl_system.h"
|
||||||
|
|
||||||
#define DWORD WINDOWS_DWORD
|
|
||||||
#include <GL/wglew.h>
|
|
||||||
#undef DWORD
|
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include "wglext.h"
|
||||||
|
|
||||||
|
#define USE_WINDOWS_DWORD
|
||||||
#include "win32iface.h"
|
#include "win32iface.h"
|
||||||
#include "win32gliface.h"
|
#include "win32gliface.h"
|
||||||
//#include "gl/gl_intern.h"
|
//#include "gl/gl_intern.h"
|
||||||
|
#include "x86.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
@ -22,8 +24,6 @@
|
||||||
|
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "gl/renderer/gl_renderer.h"
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
#include "gl/shaders/gl_shader.h"
|
|
||||||
#include "gl/utility/gl_templates.h"
|
|
||||||
|
|
||||||
void gl_CalculateCPUSpeed();
|
void gl_CalculateCPUSpeed();
|
||||||
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
||||||
|
@ -726,6 +726,12 @@ bool Win32GLVideo::SetupPixelFormat(int multisample)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
// since we cannot use the extension loader here, before it gets initialized,
|
||||||
|
// we have to define the extended GL stuff we need, ourselves here.
|
||||||
|
// The headers generated by GLLoadGen only work if the loader gets initialized.
|
||||||
|
typedef const GLubyte * (APIENTRY *PFNGLGETSTRINGIPROC)(GLenum, GLuint);
|
||||||
|
#define GL_NUM_EXTENSIONS 0x821D
|
||||||
|
|
||||||
bool Win32GLVideo::checkCoreUsability()
|
bool Win32GLVideo::checkCoreUsability()
|
||||||
{
|
{
|
||||||
// if we explicitly want to disable 4.x features this must fail.
|
// if we explicitly want to disable 4.x features this must fail.
|
||||||
|
@ -734,7 +740,7 @@ bool Win32GLVideo::checkCoreUsability()
|
||||||
// GL 4.4 implies GL_ARB_buffer_storage
|
// GL 4.4 implies GL_ARB_buffer_storage
|
||||||
if (strcmp((char*)glGetString(GL_VERSION), "4.4") >= 0) return true;
|
if (strcmp((char*)glGetString(GL_VERSION), "4.4") >= 0) return true;
|
||||||
|
|
||||||
// at this point GLEW has not been initialized so we have to retrieve glGetStringi ourselves.
|
// at this point the extension loader has not been initialized so we have to retrieve glGetStringi ourselves.
|
||||||
PFNGLGETSTRINGIPROC myglGetStringi = (PFNGLGETSTRINGIPROC)wglGetProcAddress("glGetStringi");
|
PFNGLGETSTRINGIPROC myglGetStringi = (PFNGLGETSTRINGIPROC)wglGetProcAddress("glGetStringi");
|
||||||
if (!myglGetStringi) return false; // this should not happen.
|
if (!myglGetStringi) return false; // this should not happen.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef __WIN32GLIFACE_H__
|
#ifndef __WIN32GLIFACE_H__
|
||||||
#define __WIN32GLIFACE_H__
|
#define __WIN32GLIFACE_H__
|
||||||
|
|
||||||
#include "gl/system/gl_system.h"
|
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "win32iface.h"
|
#include "win32iface.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
|
Loading…
Reference in a new issue