Browse Source

Added empty stub implementations of OpenGL calls used by Quake, as an alternative way of removing the dependencies on SDL & OpenGL

console
Nico de Poel 5 years ago
parent
commit
56bc6c7ba6
  1. 289
      engine/UniQuake/stub/stub_opengl.c
  2. 5
      engine/Windows/VisualStudio/uniquake.vcxproj
  3. 6
      engine/Windows/VisualStudio/uniquake.vcxproj.filters

289
engine/UniQuake/stub/stub_opengl.c

@ -0,0 +1,289 @@
#ifndef USE_OPENGL
#define BUILD_GL32
#include "SDL_opengl.h"
#if !defined(__WIN32__)
#undef GLAPI
#define GLAPI
#endif
GLAPI void GLAPIENTRY glBegin(GLenum mode)
{
}
GLAPI void GLAPIENTRY glEnd(void)
{
}
GLAPI void GLAPIENTRY glEnable(GLenum cap)
{
}
GLAPI void GLAPIENTRY glDisable(GLenum cap)
{
}
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
{
}
GLAPI void GLAPIENTRY glMatrixMode(GLenum mode)
{
}
GLAPI void GLAPIENTRY glOrtho(GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble near_val, GLdouble far_val)
{
}
GLAPI void GLAPIENTRY glFrustum(GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble near_val, GLdouble far_val)
{
}
GLAPI void GLAPIENTRY glViewport(GLint x, GLint y,
GLsizei width, GLsizei height)
{
}
GLAPI void GLAPIENTRY glPushMatrix(void)
{
}
GLAPI void GLAPIENTRY glPopMatrix(void)
{
}
GLAPI void GLAPIENTRY glLoadIdentity(void)
{
}
GLAPI void GLAPIENTRY glMultMatrixf(const GLfloat *m)
{
}
GLAPI void GLAPIENTRY glRotatef(GLfloat angle,
GLfloat x, GLfloat y, GLfloat z)
{
}
GLAPI void GLAPIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)
{
}
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
{
}
GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y)
{
}
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
{
}
GLAPI void GLAPIENTRY glVertex3fv(const GLfloat *v)
{
}
GLAPI void GLAPIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue)
{
}
GLAPI void GLAPIENTRY glColor3fv(const GLfloat *v)
{
}
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
{
}
GLAPI void GLAPIENTRY glColor4fv(const GLfloat *v)
{
}
GLAPI void GLAPIENTRY glColor4ubv(const GLubyte *v)
{
}
GLAPI void GLAPIENTRY glTexCoord2f(GLfloat s, GLfloat t)
{
}
GLAPI void GLAPIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param)
{
}
GLAPI void GLAPIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param)
{
}
GLAPI void GLAPIENTRY glFogf(GLenum pname, GLfloat param)
{
}
GLAPI void GLAPIENTRY glFogi(GLenum pname, GLint param)
{
}
GLAPI void GLAPIENTRY glFogfv(GLenum pname, const GLfloat *params)
{
}
GLAPI void GLAPIENTRY glDepthFunc(GLenum func)
{
}
GLAPI void GLAPIENTRY glDepthMask(GLboolean flag)
{
}
GLAPI void GLAPIENTRY glDepthRange(GLclampd near_val, GLclampd far_val)
{
}
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
{
}
GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
}
GLAPI void GLAPIENTRY glClear(GLbitfield mask)
{
}
GLAPI void GLAPIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
}
GLAPI void GLAPIENTRY glPolygonMode(GLenum face, GLenum mode)
{
}
GLAPI void GLAPIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
{
}
GLAPI void GLAPIENTRY glFinish(void)
{
}
GLAPI void GLAPIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask)
{
}
GLAPI void GLAPIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
}
GLAPI void GLAPIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
{
}
GLAPI void GLAPIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
{
}
GLAPI void GLAPIENTRY glTexImage2D(GLenum target, GLint level,
GLint internalFormat,
GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels)
{
}
GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures)
{
memset(textures, 0, sizeof(GLuint) * n);
}
GLAPI void GLAPIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
{
}
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
{
}
GLAPI void GLAPIENTRY glPixelStorei(GLenum pname, GLint param)
{
}
GLAPI void GLAPIENTRY glReadPixels(GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
GLvoid *pixels)
{
int stride, sz;
switch (format)
{
case GL_RGB:
stride = 3;
break;
case GL_RGBA:
stride = 4;
break;
default:
stride = 0;
break;
}
switch (type)
{
case GL_UNSIGNED_BYTE:
sz = sizeof(unsigned char);
break;
default:
sz = 0;
break;
}
memset(pixels, 0, width * height * sz * stride);
}
GLAPI void GLAPIENTRY glGetIntegerv(GLenum pname, GLint *params)
{
*params = 0;
}
GLAPI void GLAPIENTRY glGetTexImage(GLenum target, GLint level,
GLenum format, GLenum type,
GLvoid *pixels)
{
// No way to figure out texture dimensions from just these parameters, so ignore
}
GLAPI void GLAPIENTRY glCopyTexSubImage2D(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
}
GLAPI void GLAPIENTRY glHint(GLenum target, GLenum mode)
{
}
GLAPI void GLAPIENTRY glDrawElements(GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices)
{
}
GLAPI void GLAPIENTRY glTexSubImage2D(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels)
{
}
GLAPI void GLAPIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{
}
#endif // !USE_OPENGL

5
engine/Windows/VisualStudio/uniquake.vcxproj

@ -149,7 +149,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\SDL2\include;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;USE_SDL2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -233,7 +233,7 @@ copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)"</Command>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\SDL2\include;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;USE_SDL2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -363,6 +363,7 @@ copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)"</Command>
<ClCompile Include="..\..\Quake\world.c" />
<ClCompile Include="..\..\Quake\zone.c" />
<ClCompile Include="..\..\UniQuake\gl_uniquake.c" />
<ClCompile Include="..\..\UniQuake\stub\stub_opengl.c" />
<ClCompile Include="..\..\UniQuake\sys_uniquake.c" />
<ClCompile Include="..\..\UniQuake\uniquake.c" />
</ItemGroup>

6
engine/Windows/VisualStudio/uniquake.vcxproj.filters

@ -238,6 +238,9 @@
<ClCompile Include="..\..\Quake\snd_codec.c">
<Filter>obsolete</Filter>
</ClCompile>
<ClCompile Include="..\..\UniQuake\stub\stub_opengl.c">
<Filter>stub</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Quake\anorm_dots.h">
@ -470,5 +473,8 @@
<Filter Include="fmod">
<UniqueIdentifier>{d5c16a8d-ccc3-411a-831d-d2e8f4bf2219}</UniqueIdentifier>
</Filter>
<Filter Include="stub">
<UniqueIdentifier>{049ed891-83c0-4948-a9b1-e4688933c0e5}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
Loading…
Cancel
Save