diff --git a/code/null/null_glimp.c b/code/null/null_glimp.c index 042e4281..2fc6aff1 100644 --- a/code/null/null_glimp.c +++ b/code/null/null_glimp.c @@ -19,7 +19,7 @@ along with Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#include "../renderergl1/tr_local.h" +#include "tr_common.h" qboolean ( * qwglSwapIntervalEXT)( int interval ); diff --git a/code/renderergl1/qgl.h b/code/renderercommon/qgl.h similarity index 100% rename from code/renderergl1/qgl.h rename to code/renderercommon/qgl.h diff --git a/code/renderercommon/tr_common.h b/code/renderercommon/tr_common.h new file mode 100644 index 00000000..8bddc215 --- /dev/null +++ b/code/renderercommon/tr_common.h @@ -0,0 +1,75 @@ +#ifndef TR_COMMON_H +#define TR_COMMON_H + +#include "../qcommon/q_shared.h" +/*#include "../qcommon/qfiles.h"*/ +/*#include "../qcommon/qcommon.h"*/ +#include "../renderercommon/tr_public.h" +#include "qgl.h" + +extern refimport_t ri; +extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init + +// These variables should live inside glConfig but can't because of +// compatibility issues to the original ID vms. If you release a stand-alone +// game and your mod uses tr_types.h from this build you can safely move them +// to the glconfig_t struct. +extern qboolean textureFilterAnisotropic; +extern int maxAnisotropy; +extern float displayAspect; + +// +// cvars +// +extern cvar_t *r_stencilbits; // number of desired stencil bits +extern cvar_t *r_depthbits; // number of desired depth bits +extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen +extern cvar_t *r_texturebits; // number of desired texture bits +extern cvar_t *r_ext_multisample; + // 0 = use framebuffer depth + // 16 = use 16-bit textures + // 32 = use 32-bit textures + // all else = error + +extern cvar_t *r_mode; // video mode +extern cvar_t *r_noborder; +extern cvar_t *r_fullscreen; +extern cvar_t *r_ignorehwgamma; // overrides hardware gamma capabilities +extern cvar_t *r_drawBuffer; +extern cvar_t *r_swapInterval; + +extern cvar_t *r_allowExtensions; // global enable/disable of OpenGL extensions +extern cvar_t *r_ext_compressed_textures; // these control use of specific extensions +extern cvar_t *r_ext_multitexture; +extern cvar_t *r_ext_compiled_vertex_array; +extern cvar_t *r_ext_texture_env_add; + +extern cvar_t *r_ext_texture_filter_anisotropic; +extern cvar_t *r_ext_max_anisotropy; + +extern cvar_t *r_stereoEnabled; + +qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ); + + +/* +==================================================================== + +IMPLEMENTATION SPECIFIC FUNCTIONS + +==================================================================== +*/ + +void GLimp_Init( void ); +void GLimp_Shutdown( void ); +void GLimp_EndFrame( void ); + +void GLimp_LogComment( char *comment ); +void GLimp_Minimize(void); + +void GLimp_SetGamma( unsigned char red[256], + unsigned char green[256], + unsigned char blue[256] ); + + +#endif diff --git a/code/renderercommon/tr_image_bmp.c b/code/renderercommon/tr_image_bmp.c index 0536ca81..0708f8e5 100644 --- a/code/renderercommon/tr_image_bmp.c +++ b/code/renderercommon/tr_image_bmp.c @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#include "../renderergl1/tr_local.h" +#include "tr_common.h" typedef struct { diff --git a/code/renderercommon/tr_image_jpg.c b/code/renderercommon/tr_image_jpg.c index 7e9c824e..de122337 100644 --- a/code/renderercommon/tr_image_jpg.c +++ b/code/renderercommon/tr_image_jpg.c @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#include "../renderergl1/tr_local.h" +#include "tr_common.h" /* * Include file for users of JPEG library. diff --git a/code/renderercommon/tr_image_pcx.c b/code/renderercommon/tr_image_pcx.c index 9ebaf8c4..6bc15dea 100644 --- a/code/renderercommon/tr_image_pcx.c +++ b/code/renderercommon/tr_image_pcx.c @@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#include "../renderergl1/tr_local.h" +#include "tr_common.h" /* ======================================================================== diff --git a/code/renderercommon/tr_image_png.c b/code/renderercommon/tr_image_png.c index 48b65a83..aad794e7 100644 --- a/code/renderercommon/tr_image_png.c +++ b/code/renderercommon/tr_image_png.c @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. =========================================================================== */ -#include "../renderergl1/tr_local.h" +#include "tr_common.h" #include "../qcommon/puff.h" diff --git a/code/renderercommon/tr_image_tga.c b/code/renderercommon/tr_image_tga.c index fb648929..b1dd5157 100644 --- a/code/renderercommon/tr_image_tga.c +++ b/code/renderercommon/tr_image_tga.c @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#include "../renderergl1/tr_local.h" +#include "tr_common.h" /* ======================================================================== diff --git a/code/renderercommon/tr_noise.c b/code/renderercommon/tr_noise.c index 4ab53089..445ef827 100644 --- a/code/renderercommon/tr_noise.c +++ b/code/renderercommon/tr_noise.c @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ // tr_noise.c -#include "../renderergl1/tr_local.h" +#include "tr_common.h" #define NOISE_SIZE 256 #define NOISE_MASK ( NOISE_SIZE - 1 ) diff --git a/code/renderergl1/tr_init.c b/code/renderergl1/tr_init.c index ad46f806..8ab50cd7 100644 --- a/code/renderergl1/tr_init.c +++ b/code/renderergl1/tr_init.c @@ -1287,6 +1287,9 @@ void RE_Shutdown( qboolean destroyWindow ) { // shut down platform specific OpenGL stuff if ( destroyWindow ) { GLimp_Shutdown(); + + Com_Memset( &glConfig, 0, sizeof( glConfig ) ); + Com_Memset( &glState, 0, sizeof( glState ) ); } tr.registered = qfalse; diff --git a/code/renderergl1/tr_local.h b/code/renderergl1/tr_local.h index ffb2987b..8b78c2b1 100644 --- a/code/renderergl1/tr_local.h +++ b/code/renderergl1/tr_local.h @@ -28,8 +28,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../qcommon/qfiles.h" #include "../qcommon/qcommon.h" #include "../renderercommon/tr_public.h" -#include "qgl.h" +#include "../renderercommon/tr_common.h" #include "../renderercommon/iqm.h" +#include "../renderercommon/qgl.h" #define GL_INDEX_TYPE GL_UNSIGNED_INT typedef unsigned int glIndex_t; @@ -801,7 +802,6 @@ void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ); void R_Modellist_f (void); //==================================================== -extern refimport_t ri; #define MAX_DRAWIMAGES 2048 #define MAX_SKINS 1024 @@ -868,7 +868,6 @@ typedef struct { unsigned long glStateBits; } glstate_t; - typedef struct { int c_surfaces, c_shaders, c_vertexes, c_indexes, c_totalIndexes; float c_overDraw; @@ -996,17 +995,8 @@ typedef struct { extern backEndState_t backEnd; extern trGlobals_t tr; -extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init extern glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init -// These two variables should live inside glConfig but can't because of compatibility issues to the original ID vms. -// If you release a stand-alone game and your mod uses tr_types.h from this build you can safely move them to -// the glconfig_t struct. -extern qboolean textureFilterAnisotropic; -extern int maxAnisotropy; -extern float displayAspect; - - // // cvars // @@ -1028,16 +1018,6 @@ extern cvar_t *r_znear; // near Z clip plane extern cvar_t *r_zproj; // z distance of projection plane extern cvar_t *r_stereoSeparation; // separation of cameras for stereo rendering -extern cvar_t *r_stencilbits; // number of desired stencil bits -extern cvar_t *r_depthbits; // number of desired depth bits -extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen -extern cvar_t *r_texturebits; // number of desired texture bits -extern cvar_t *r_ext_multisample; - // 0 = use framebuffer depth - // 16 = use 16-bit textures - // 32 = use 32-bit textures - // all else = error - extern cvar_t *r_measureOverdraw; // enables stencil buffer overdraw measurement extern cvar_t *r_lodbias; // push/pull LOD transitions @@ -1065,20 +1045,7 @@ extern cvar_t *r_facePlaneCull; // enables culling of planar surfaces with back extern cvar_t *r_nocurves; extern cvar_t *r_showcluster; -extern cvar_t *r_mode; // video mode -extern cvar_t *r_fullscreen; -extern cvar_t *r_noborder; extern cvar_t *r_gamma; -extern cvar_t *r_ignorehwgamma; // overrides hardware gamma capabilities - -extern cvar_t *r_allowExtensions; // global enable/disable of OpenGL extensions -extern cvar_t *r_ext_compressed_textures; // these control use of specific extensions -extern cvar_t *r_ext_multitexture; -extern cvar_t *r_ext_compiled_vertex_array; -extern cvar_t *r_ext_texture_env_add; - -extern cvar_t *r_ext_texture_filter_anisotropic; -extern cvar_t *r_ext_max_anisotropy; extern cvar_t *r_nobind; // turns off binding to appropriate textures extern cvar_t *r_singleShader; // make most world faces use default shader @@ -1086,8 +1053,6 @@ extern cvar_t *r_roundImagesDown; extern cvar_t *r_colorMipLevels; // development aid to see texture mip usage extern cvar_t *r_picmip; // controls picmip values extern cvar_t *r_finish; -extern cvar_t *r_drawBuffer; -extern cvar_t *r_swapInterval; extern cvar_t *r_textureMode; extern cvar_t *r_offsetFactor; extern cvar_t *r_offsetUnits; @@ -1116,7 +1081,6 @@ extern cvar_t *r_subdivisions; extern cvar_t *r_lodCurveError; extern cvar_t *r_skipBackEnd; -extern cvar_t *r_stereoEnabled; extern cvar_t *r_anaglyphMode; extern cvar_t *r_greyscale; @@ -1239,7 +1203,6 @@ image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicm image_t *R_CreateImage( const char *name, const byte *pic, int width, int height, qboolean mipmap , qboolean allowPicmip, int wrapClampMode ); -qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ); void R_SetColorMappings( void ); void R_GammaCorrect( byte *buffer, int bufSize ); @@ -1278,28 +1241,6 @@ void R_InitShaders( void ); void R_ShaderList_f( void ); void R_RemapShader(const char *oldShader, const char *newShader, const char *timeOffset); -/* -==================================================================== - -IMPLEMENTATION SPECIFIC FUNCTIONS - -==================================================================== -*/ - -void GLimp_Init( void ); -void GLimp_Shutdown( void ); -void GLimp_EndFrame( void ); - -void GLimp_LogComment( char *comment ); -void GLimp_Minimize(void); - -// NOTE TTimo linux works with float gamma value, not the gamma table -// the params won't be used, getting the r_gamma cvar directly -void GLimp_SetGamma( unsigned char red[256], - unsigned char green[256], - unsigned char blue[256] ); - - /* ==================================================================== diff --git a/code/renderergl2/qgl.h b/code/renderergl2/qgl2.h similarity index 64% rename from code/renderergl2/qgl.h rename to code/renderergl2/qgl2.h index 6013a87c..2c9c2240 100644 --- a/code/renderergl2/qgl.h +++ b/code/renderergl2/qgl2.h @@ -23,21 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ** QGL.H */ -#ifndef __QGL_H__ -#define __QGL_H__ +#ifndef __QGL2_H__ +#define __QGL2_H__ -#ifdef USE_LOCAL_HEADERS -# include "SDL_opengl.h" -#else -# include -#endif - -extern void (APIENTRYP qglActiveTextureARB) (GLenum texture); -extern void (APIENTRYP qglClientActiveTextureARB) (GLenum texture); -extern void (APIENTRYP qglMultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t); - -extern void (APIENTRYP qglLockArraysEXT) (GLint first, GLsizei count); -extern void (APIENTRYP qglUnlockArraysEXT) (void); +#include "../renderercommon/qgl.h" // GL_EXT_draw_range_elements extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); @@ -415,341 +404,4 @@ extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hS extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); #endif -//=========================================================================== - -#define qglAccum glAccum -#define qglAlphaFunc glAlphaFunc -#define qglAreTexturesResident glAreTexturesResident -#define qglArrayElement glArrayElement -#define qglBegin glBegin -#define qglBindTexture glBindTexture -#define qglBitmap glBitmap -#define qglBlendFunc glBlendFunc -#define qglCallList glCallList -#define qglCallLists glCallLists -#define qglClear glClear -#define qglClearAccum glClearAccum -#define qglClearColor glClearColor -#define qglClearDepth glClearDepth -#define qglClearIndex glClearIndex -#define qglClearStencil glClearStencil -#define qglClipPlane glClipPlane -#define qglColor3b glColor3b -#define qglColor3bv glColor3bv -#define qglColor3d glColor3d -#define qglColor3dv glColor3dv -#define qglColor3f glColor3f -#define qglColor3fv glColor3fv -#define qglColor3i glColor3i -#define qglColor3iv glColor3iv -#define qglColor3s glColor3s -#define qglColor3sv glColor3sv -#define qglColor3ub glColor3ub -#define qglColor3ubv glColor3ubv -#define qglColor3ui glColor3ui -#define qglColor3uiv glColor3uiv -#define qglColor3us glColor3us -#define qglColor3usv glColor3usv -#define qglColor4b glColor4b -#define qglColor4bv glColor4bv -#define qglColor4d glColor4d -#define qglColor4dv glColor4dv -#define qglColor4f glColor4f -#define qglColor4fv glColor4fv -#define qglColor4i glColor4i -#define qglColor4iv glColor4iv -#define qglColor4s glColor4s -#define qglColor4sv glColor4sv -#define qglColor4ub glColor4ub -#define qglColor4ubv glColor4ubv -#define qglColor4ui glColor4ui -#define qglColor4uiv glColor4uiv -#define qglColor4us glColor4us -#define qglColor4usv glColor4usv -#define qglColorMask glColorMask -#define qglColorMaterial glColorMaterial -#define qglColorPointer glColorPointer -#define qglCopyPixels glCopyPixels -#define qglCopyTexImage1D glCopyTexImage1D -#define qglCopyTexImage2D glCopyTexImage2D -#define qglCopyTexSubImage1D glCopyTexSubImage1D -#define qglCopyTexSubImage2D glCopyTexSubImage2D -#define qglCullFace glCullFace -#define qglDeleteLists glDeleteLists -#define qglDeleteTextures glDeleteTextures -#define qglDepthFunc glDepthFunc -#define qglDepthMask glDepthMask -#define qglDepthRange glDepthRange -#define qglDisable glDisable -#define qglDisableClientState glDisableClientState -#define qglDrawArrays glDrawArrays -#define qglDrawBuffer glDrawBuffer -#define qglDrawElements glDrawElements -#define qglDrawPixels glDrawPixels -#define qglEdgeFlag glEdgeFlag -#define qglEdgeFlagPointer glEdgeFlagPointer -#define qglEdgeFlagv glEdgeFlagv -#define qglEnable glEnable -#define qglEnableClientState glEnableClientState -#define qglEnd glEnd -#define qglEndList glEndList -#define qglEvalCoord1d glEvalCoord1d -#define qglEvalCoord1dv glEvalCoord1dv -#define qglEvalCoord1f glEvalCoord1f -#define qglEvalCoord1fv glEvalCoord1fv -#define qglEvalCoord2d glEvalCoord2d -#define qglEvalCoord2dv glEvalCoord2dv -#define qglEvalCoord2f glEvalCoord2f -#define qglEvalCoord2fv glEvalCoord2fv -#define qglEvalMesh1 glEvalMesh1 -#define qglEvalMesh2 glEvalMesh2 -#define qglEvalPoint1 glEvalPoint1 -#define qglEvalPoint2 glEvalPoint2 -#define qglFeedbackBuffer glFeedbackBuffer -#define qglFinish glFinish -#define qglFlush glFlush -#define qglFogf glFogf -#define qglFogfv glFogfv -#define qglFogi glFogi -#define qglFogiv glFogiv -#define qglFrontFace glFrontFace -#define qglFrustum glFrustum -#define qglGenLists glGenLists -#define qglGenTextures glGenTextures -#define qglGetBooleanv glGetBooleanv -#define qglGetClipPlane glGetClipPlane -#define qglGetDoublev glGetDoublev -#define qglGetError glGetError -#define qglGetFloatv glGetFloatv -#define qglGetIntegerv glGetIntegerv -#define qglGetLightfv glGetLightfv -#define qglGetLightiv glGetLightiv -#define qglGetMapdv glGetMapdv -#define qglGetMapfv glGetMapfv -#define qglGetMapiv glGetMapiv -#define qglGetMaterialfv glGetMaterialfv -#define qglGetMaterialiv glGetMaterialiv -#define qglGetPixelMapfv glGetPixelMapfv -#define qglGetPixelMapuiv glGetPixelMapuiv -#define qglGetPixelMapusv glGetPixelMapusv -#define qglGetPointerv glGetPointerv -#define qglGetPolygonStipple glGetPolygonStipple -#define qglGetString glGetString -#define qglGetTexGendv glGetTexGendv -#define qglGetTexGenfv glGetTexGenfv -#define qglGetTexGeniv glGetTexGeniv -#define qglGetTexImage glGetTexImage -#define qglGetTexLevelParameterfv glGetTexLevelParameterfv -#define qglGetTexLevelParameteriv glGetTexLevelParameteriv -#define qglGetTexParameterfv glGetTexParameterfv -#define qglGetTexParameteriv glGetTexParameteriv -#define qglHint glHint -#define qglIndexMask glIndexMask -#define qglIndexPointer glIndexPointer -#define qglIndexd glIndexd -#define qglIndexdv glIndexdv -#define qglIndexf glIndexf -#define qglIndexfv glIndexfv -#define qglIndexi glIndexi -#define qglIndexiv glIndexiv -#define qglIndexs glIndexs -#define qglIndexsv glIndexsv -#define qglIndexub glIndexub -#define qglIndexubv glIndexubv -#define qglInitNames glInitNames -#define qglInterleavedArrays glInterleavedArrays -#define qglIsEnabled glIsEnabled -#define qglIsList glIsList -#define qglIsTexture glIsTexture -#define qglLightModelf glLightModelf -#define qglLightModelfv glLightModelfv -#define qglLightModeli glLightModeli -#define qglLightModeliv glLightModeliv -#define qglLightf glLightf -#define qglLightfv glLightfv -#define qglLighti glLighti -#define qglLightiv glLightiv -#define qglLineStipple glLineStipple -#define qglLineWidth glLineWidth -#define qglListBase glListBase -#define qglLoadIdentity glLoadIdentity -#define qglLoadMatrixd glLoadMatrixd -#define qglLoadMatrixf glLoadMatrixf -#define qglLoadName glLoadName -#define qglLogicOp glLogicOp -#define qglMap1d glMap1d -#define qglMap1f glMap1f -#define qglMap2d glMap2d -#define qglMap2f glMap2f -#define qglMapGrid1d glMapGrid1d -#define qglMapGrid1f glMapGrid1f -#define qglMapGrid2d glMapGrid2d -#define qglMapGrid2f glMapGrid2f -#define qglMaterialf glMaterialf -#define qglMaterialfv glMaterialfv -#define qglMateriali glMateriali -#define qglMaterialiv glMaterialiv -#define qglMatrixMode glMatrixMode -#define qglMultMatrixd glMultMatrixd -#define qglMultMatrixf glMultMatrixf -#define qglNewList glNewList -#define qglNormal3b glNormal3b -#define qglNormal3bv glNormal3bv -#define qglNormal3d glNormal3d -#define qglNormal3dv glNormal3dv -#define qglNormal3f glNormal3f -#define qglNormal3fv glNormal3fv -#define qglNormal3i glNormal3i -#define qglNormal3iv glNormal3iv -#define qglNormal3s glNormal3s -#define qglNormal3sv glNormal3sv -#define qglNormalPointer glNormalPointer -#define qglOrtho glOrtho -#define qglPassThrough glPassThrough -#define qglPixelMapfv glPixelMapfv -#define qglPixelMapuiv glPixelMapuiv -#define qglPixelMapusv glPixelMapusv -#define qglPixelStoref glPixelStoref -#define qglPixelStorei glPixelStorei -#define qglPixelTransferf glPixelTransferf -#define qglPixelTransferi glPixelTransferi -#define qglPixelZoom glPixelZoom -#define qglPointSize glPointSize -#define qglPolygonMode glPolygonMode -#define qglPolygonOffset glPolygonOffset -#define qglPolygonStipple glPolygonStipple -#define qglPopAttrib glPopAttrib -#define qglPopClientAttrib glPopClientAttrib -#define qglPopMatrix glPopMatrix -#define qglPopName glPopName -#define qglPrioritizeTextures glPrioritizeTextures -#define qglPushAttrib glPushAttrib -#define qglPushClientAttrib glPushClientAttrib -#define qglPushMatrix glPushMatrix -#define qglPushName glPushName -#define qglRasterPos2d glRasterPos2d -#define qglRasterPos2dv glRasterPos2dv -#define qglRasterPos2f glRasterPos2f -#define qglRasterPos2fv glRasterPos2fv -#define qglRasterPos2i glRasterPos2i -#define qglRasterPos2iv glRasterPos2iv -#define qglRasterPos2s glRasterPos2s -#define qglRasterPos2sv glRasterPos2sv -#define qglRasterPos3d glRasterPos3d -#define qglRasterPos3dv glRasterPos3dv -#define qglRasterPos3f glRasterPos3f -#define qglRasterPos3fv glRasterPos3fv -#define qglRasterPos3i glRasterPos3i -#define qglRasterPos3iv glRasterPos3iv -#define qglRasterPos3s glRasterPos3s -#define qglRasterPos3sv glRasterPos3sv -#define qglRasterPos4d glRasterPos4d -#define qglRasterPos4dv glRasterPos4dv -#define qglRasterPos4f glRasterPos4f -#define qglRasterPos4fv glRasterPos4fv -#define qglRasterPos4i glRasterPos4i -#define qglRasterPos4iv glRasterPos4iv -#define qglRasterPos4s glRasterPos4s -#define qglRasterPos4sv glRasterPos4sv -#define qglReadBuffer glReadBuffer -#define qglReadPixels glReadPixels -#define qglRectd glRectd -#define qglRectdv glRectdv -#define qglRectf glRectf -#define qglRectfv glRectfv -#define qglRecti glRecti -#define qglRectiv glRectiv -#define qglRects glRects -#define qglRectsv glRectsv -#define qglRenderMode glRenderMode -#define qglRotated glRotated -#define qglRotatef glRotatef -#define qglScaled glScaled -#define qglScalef glScalef -#define qglScissor glScissor -#define qglSelectBuffer glSelectBuffer -#define qglShadeModel glShadeModel -#define qglStencilFunc glStencilFunc -#define qglStencilMask glStencilMask -#define qglStencilOp glStencilOp -#define qglTexCoord1d glTexCoord1d -#define qglTexCoord1dv glTexCoord1dv -#define qglTexCoord1f glTexCoord1f -#define qglTexCoord1fv glTexCoord1fv -#define qglTexCoord1i glTexCoord1i -#define qglTexCoord1iv glTexCoord1iv -#define qglTexCoord1s glTexCoord1s -#define qglTexCoord1sv glTexCoord1sv -#define qglTexCoord2d glTexCoord2d -#define qglTexCoord2dv glTexCoord2dv -#define qglTexCoord2f glTexCoord2f -#define qglTexCoord2fv glTexCoord2fv -#define qglTexCoord2i glTexCoord2i -#define qglTexCoord2iv glTexCoord2iv -#define qglTexCoord2s glTexCoord2s -#define qglTexCoord2sv glTexCoord2sv -#define qglTexCoord3d glTexCoord3d -#define qglTexCoord3dv glTexCoord3dv -#define qglTexCoord3f glTexCoord3f -#define qglTexCoord3fv glTexCoord3fv -#define qglTexCoord3i glTexCoord3i -#define qglTexCoord3iv glTexCoord3iv -#define qglTexCoord3s glTexCoord3s -#define qglTexCoord3sv glTexCoord3sv -#define qglTexCoord4d glTexCoord4d -#define qglTexCoord4dv glTexCoord4dv -#define qglTexCoord4f glTexCoord4f -#define qglTexCoord4fv glTexCoord4fv -#define qglTexCoord4i glTexCoord4i -#define qglTexCoord4iv glTexCoord4iv -#define qglTexCoord4s glTexCoord4s -#define qglTexCoord4sv glTexCoord4sv -#define qglTexCoordPointer glTexCoordPointer -#define qglTexEnvf glTexEnvf -#define qglTexEnvfv glTexEnvfv -#define qglTexEnvi glTexEnvi -#define qglTexEnviv glTexEnviv -#define qglTexGend glTexGend -#define qglTexGendv glTexGendv -#define qglTexGenf glTexGenf -#define qglTexGenfv glTexGenfv -#define qglTexGeni glTexGeni -#define qglTexGeniv glTexGeniv -#define qglTexImage1D glTexImage1D -#define qglTexImage2D glTexImage2D -#define qglTexParameterf glTexParameterf -#define qglTexParameterfv glTexParameterfv -#define qglTexParameteri glTexParameteri -#define qglTexParameteriv glTexParameteriv -#define qglTexSubImage1D glTexSubImage1D -#define qglTexSubImage2D glTexSubImage2D -#define qglTranslated glTranslated -#define qglTranslatef glTranslatef -#define qglVertex2d glVertex2d -#define qglVertex2dv glVertex2dv -#define qglVertex2f glVertex2f -#define qglVertex2fv glVertex2fv -#define qglVertex2i glVertex2i -#define qglVertex2iv glVertex2iv -#define qglVertex2s glVertex2s -#define qglVertex2sv glVertex2sv -#define qglVertex3d glVertex3d -#define qglVertex3dv glVertex3dv -#define qglVertex3f glVertex3f -#define qglVertex3fv glVertex3fv -#define qglVertex3i glVertex3i -#define qglVertex3iv glVertex3iv -#define qglVertex3s glVertex3s -#define qglVertex3sv glVertex3sv -#define qglVertex4d glVertex4d -#define qglVertex4dv glVertex4dv -#define qglVertex4f glVertex4f -#define qglVertex4fv glVertex4fv -#define qglVertex4i glVertex4i -#define qglVertex4iv glVertex4iv -#define qglVertex4s glVertex4s -#define qglVertex4sv glVertex4sv -#define qglVertexPointer glVertexPointer -#define qglViewport glViewport - #endif diff --git a/code/renderergl2/tr_init.c b/code/renderergl2/tr_init.c index 418c8a91..06fe48ca 100644 --- a/code/renderergl2/tr_init.c +++ b/code/renderergl2/tr_init.c @@ -1476,6 +1476,9 @@ void RE_Shutdown( qboolean destroyWindow ) { // shut down platform specific OpenGL stuff if ( destroyWindow ) { GLimp_Shutdown(); + + Com_Memset( &glConfig, 0, sizeof( glConfig ) ); + Com_Memset( &glState, 0, sizeof( glState ) ); } tr.registered = qfalse; diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index f95261fb..ee8fbcbb 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -28,12 +28,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../qcommon/qfiles.h" #include "../qcommon/qcommon.h" #include "../renderercommon/tr_public.h" +#include "../renderercommon/tr_common.h" #include "tr_extratypes.h" #include "tr_extramath.h" #include "tr_fbo.h" #include "tr_postprocess.h" -#include "qgl.h" #include "../renderercommon/iqm.h" +#include "qgl2.h" #define GL_INDEX_TYPE GL_UNSIGNED_INT typedef unsigned int glIndex_t; @@ -1580,7 +1581,6 @@ void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ); void R_Modellist_f (void); //==================================================== -extern refimport_t ri; #define MAX_DRAWIMAGES 2048 #define MAX_SKINS 1024 @@ -1945,17 +1945,8 @@ typedef struct { extern backEndState_t backEnd; extern trGlobals_t tr; -extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init extern glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init - -// These three variables should live inside glConfig but can't because of compatibility issues to the original ID vms. -// If you release a stand-alone game and your mod uses tr_types.h from this build you can safely move them to -// the glconfig_t struct. -extern qboolean textureFilterAnisotropic; -extern int maxAnisotropy; extern glRefConfig_t glRefConfig; -extern float displayAspect; - // // cvars @@ -1977,16 +1968,6 @@ extern cvar_t *r_znear; // near Z clip plane extern cvar_t *r_zproj; // z distance of projection plane extern cvar_t *r_stereoSeparation; // separation of cameras for stereo rendering -extern cvar_t *r_stencilbits; // number of desired stencil bits -extern cvar_t *r_depthbits; // number of desired depth bits -extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen -extern cvar_t *r_texturebits; // number of desired texture bits -extern cvar_t *r_ext_multisample; - // 0 = use framebuffer depth - // 16 = use 16-bit textures - // 32 = use 32-bit textures - // all else = error - extern cvar_t *r_measureOverdraw; // enables stencil buffer overdraw measurement extern cvar_t *r_lodbias; // push/pull LOD transitions @@ -2009,20 +1990,7 @@ extern cvar_t *r_facePlaneCull; // enables culling of planar surfaces with back extern cvar_t *r_nocurves; extern cvar_t *r_showcluster; -extern cvar_t *r_mode; // video mode -extern cvar_t *r_fullscreen; -extern cvar_t *r_noborder; extern cvar_t *r_gamma; -extern cvar_t *r_ignorehwgamma; // overrides hardware gamma capabilities - -extern cvar_t *r_allowExtensions; // global enable/disable of OpenGL extensions -extern cvar_t *r_ext_compressed_textures; // these control use of specific extensions -extern cvar_t *r_ext_multitexture; -extern cvar_t *r_ext_compiled_vertex_array; -extern cvar_t *r_ext_texture_env_add; - -extern cvar_t *r_ext_texture_filter_anisotropic; -extern cvar_t *r_ext_max_anisotropy; extern cvar_t *r_ext_draw_range_elements; extern cvar_t *r_ext_multi_draw_arrays; @@ -2037,8 +2005,6 @@ extern cvar_t *r_roundImagesDown; extern cvar_t *r_colorMipLevels; // development aid to see texture mip usage extern cvar_t *r_picmip; // controls picmip values extern cvar_t *r_finish; -extern cvar_t *r_drawBuffer; -extern cvar_t *r_swapInterval; extern cvar_t *r_textureMode; extern cvar_t *r_offsetFactor; extern cvar_t *r_offsetUnits; @@ -2067,7 +2033,6 @@ extern cvar_t *r_subdivisions; extern cvar_t *r_lodCurveError; extern cvar_t *r_skipBackEnd; -extern cvar_t *r_stereoEnabled; extern cvar_t *r_anaglyphMode; extern cvar_t *r_mergeMultidraws; @@ -2258,7 +2223,6 @@ void R_Init( void ); image_t *R_FindImageFile( const char *name, imgType_t type, imgFlags_t flags ); image_t *R_CreateImage( const char *name, byte *pic, int width, int height, imgType_t type, imgFlags_t flags, int internalFormat ); void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int height ); -qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ); void R_SetColorMappings( void ); void R_GammaCorrect( byte *buffer, int bufSize ); @@ -2305,21 +2269,8 @@ IMPLEMENTATION SPECIFIC FUNCTIONS ==================================================================== */ -void GLimp_Init( void ); -void GLimp_Shutdown( void ); -void GLimp_EndFrame( void ); - -void GLimp_LogComment( char *comment ); -void GLimp_Minimize(void); - -// NOTE TTimo linux works with float gamma value, not the gamma table -// the params won't be used, getting the r_gamma cvar directly -void GLimp_SetGamma( unsigned char red[256], - unsigned char green[256], - unsigned char blue[256] ); - - void GLimp_InitExtraExtensions( void ); + /* ==================================================================== diff --git a/code/sdl/sdl_gamma.c b/code/sdl/sdl_gamma.c index e2e1da58..a74ca6a8 100644 --- a/code/sdl/sdl_gamma.c +++ b/code/sdl/sdl_gamma.c @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # include #endif -#include "../renderergl1/tr_local.h" +#include "../renderercommon/tr_common.h" #include "../qcommon/qcommon.h" /* diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index b6907eb8..2eda189e 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -31,8 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -//FIXME: factor out the bits that are actually needed here into a renderercommon header -#include "../renderergl1/tr_local.h" +#include "../renderercommon/tr_common.h" #include "../sys/sys_local.h" #include "sdl_icon.h" @@ -86,9 +85,6 @@ void GLimp_Shutdown( void ) SDL_QuitSubSystem( SDL_INIT_VIDEO ); screen = NULL; - - Com_Memset( &glConfig, 0, sizeof( glConfig ) ); - Com_Memset( &glState, 0, sizeof( glState ) ); } /*