diff --git a/configure.in b/configure.in index 14c765f13..ff9cf4f15 100644 --- a/configure.in +++ b/configure.in @@ -516,128 +516,6 @@ fi AC_SUBST(GLIDE_CFLAGS) AC_SUBST(GLIDE_LIBS) -dnl Checks for GLX support -AC_ARG_WITH(glx, -[ --with-glx[=DIR] use GLX with libraries found in DIR], - glx_libraries=$withval, glx_libraries=auto -) -AC_ARG_WITH(glx-includes, -[ --with-glx-includes[=DIR] - use GLX with header files found in DIR], - glx_includes=$withval, glx_includes=auto -) -if test "x$glx_includes" = xno; then - glx_libraries="" -fi -if test "x$glx_librariesS" = xno; then - glx_includes="" -fi - -dnl Checks for GLX headers. lib[Mesa]GL should be either in a standard -dnl include directory or the X include directory. Either way, we -dnl use X_CFLAGS. -if test "x$glx_includes" != xauto -a "x$glx_includes" != x; then - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$glx_includes" - AC_CHECK_HEADER($glx_includes/GL/gl.h, HAVE_GLX=yes, HAVE_GLX=no ) - CPPFLAGS="$save_CPPFLAGS" -else - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - AC_CHECK_HEADER(GL/gl.h, HAVE_GLX=yes, HAVE_GLX=no) - CPPFLAGS="$save_CPPFLAGS" -fi - -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $X_CFLAGS" -dnl Checks for OpenGL features in headers -if test "x$HAVE_GLX" != xno; then - AC_MSG_CHECKING(for GL_COLOR_INDEX8_EXT in GL/gl.h) - AC_TRY_COMPILE([#include "GL/gl.h"], - [ int x = (int) GL_COLOR_INDEX8_EXT;], - AC_DEFINE(HAVE_GL_COLOR_INDEX8_EXT) AC_MSG_RESULT(yes), - AC_MSG_RESULT(no) - ) - AC_CHECK_HEADERS(GL/glext.h, HAVE_GL_GLEXT_H=yes) -fi -CPPFLAGS="$save_CPPFLAGS" - -dnl Make sure -lGL or -lMesaGL or -lopengl32 works -if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then - if test "x$HAVE_GLX" = xyes; then - HAVE_GLX=no - AC_CHECK_LIB(GL, glColor4f, - HAVE_GLX=yes - OGL_NAME=GL,, - [ -L$glx_libraries -lX11 $X_EXTRA_LIBS ] - ) - if test "x$HAVE_GLX" != xyes; then - AC_CHECK_LIB(MesaGL, glColor4f, - HAVE_GLX=yes - OGL_NAME=MesaGL,, - [ -L$glx_libraries -lX11 $X_EXTRA_LIBS ] - ) - fi - if test "x$HAVE_GLX" != xyes; then - AC_CHECK_LIB(opengl32, glColor4f, - HAVE_GLX=yes - OGL_NAME=opengl32,, - [ -L$glx_libraries ] - ) - fi - fi -else - if test "x$glx_libraries" != xauto \ - -o "x$glx_libraries" != xno \ - -o "x$glx_libraries" != x; then - glx_libraries="" - fi - - if test "x$HAVE_GLX" = xyes; then - HAVE_GLX=no - AC_CHECK_LIB(GL, glColor4f, - HAVE_GLX=yes - GLX_LIBS=-lXext - OGL_NAME=GL,, - [ $X_LIBS -lX11 -lXext $X_EXTRA_LIBS ] - ) - if test "x$HAVE_GLX" != xyes; then - AC_CHECK_LIB(MesaGL, glColor4f, - HAVE_GLX=yes - GLX_LIBS=-lXext - OGL_NAME=MesaGL,, - [ $X_LIBS -lX11 -lXext $X_EXTRA_LIBS ] - ) - fi - if test "x$HAVE_GLX" != xyes; then - LIBS_save="$LIBS" - LIBS="$LIBS -lopengl32" - AC_MSG_CHECKING(for glColor4f in -lopengl32) - AC_TRY_LINK( - [#include ], - [glColor4f(0,0,0,0);], - HAVE_GLX=yes - OGL_NAME=opengl32 - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no) - ) - LIBS="$LIBS_save" - fi - fi -fi - -if test "x$HAVE_GLX" = xyes; then - test "x$glx_includes" != x && GLX_CFLAGS="-I$glx_includes" - test "x$glx_libraries" != x && GLX_LIBS="-L$glx_libraries" - GLX_LIBS="$GLX_LIBS -l$OGL_NAME" - AC_DEFINE(HAVE_GLX) -else - GLX_CFLAGS="" - GLX_LIBS="" -fi -AC_SUBST(GLX_CFLAGS) -AC_SUBST(GLX_LIBS) - dnl SDL/SDL-GL checks AC_ARG_ENABLE(sdl, [ --disable-sdl disable checking for SDL], @@ -1397,7 +1275,7 @@ if test "x$HAVE_FBDEV" = xyes -a "x$ENABLE_FBDEV" = xyes; then BUILD_SW=yes fi if test "x$HAVE_X" = xyes; then - if test "x$HAVE_GLX" = xyes -a "x$ENABLE_GLX" = xyes; then + if test "x$ENABLE_GLX" = xyes; then QW_TARGETS="$QW_TARGETS qw-client-glx\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-glx\$(EXEEXT)" CL_TARGETS="$CL_TARGETS GLX" @@ -1420,7 +1298,7 @@ if test "x$HAVE_SDL" = xyes -a "x$ENABLE_SDL" = xyes; then BUILD_SW=yes fi if test "x$HAVE_SGL" = xyes; then - if test "x$HAVE_GLX" = xyes -a "x$ENABLE_SGL" = xyes; then + if test "x$ENABLE_SGL" = xyes; then QW_TARGETS="$QW_TARGETS qw-client-sgl\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-sgl\$(EXEEXT)" CL_TARGETS="$CL_TARGETS SDL-GL" @@ -1435,7 +1313,7 @@ if test "x$HAVE_SVGA" = xyes -a "x$ENABLE_SVGA" = xyes; then VID_TARGETS="$VID_TARGETS libQFsvga.la" BUILD_SW=yes fi -if test "x$mingw" = xyes -a "x$HAVE_GLX" = xyes -a "x$ENABLE_WGL" = xyes; then +if test "x$mingw" = xyes -a "x$ENABLE_WGL" = xyes; then QW_TARGETS="$QW_TARGETS qw-client-wgl\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-wgl\$(EXEEXT)" CL_TARGETS="$CL_TARGETS WGL" diff --git a/include/QF/GL/defines.h b/include/QF/GL/defines.h new file mode 100644 index 000000000..5847d2f76 --- /dev/null +++ b/include/QF/GL/defines.h @@ -0,0 +1,782 @@ +/* + gl_defines.h + + GL defines. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __gl_defines_h +#define __gl_defines_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" + +/* + * + * Constants + * + */ + +/* Boolean values */ +#define GL_FALSE 0x0 +#define GL_TRUE 0x1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0x0 +#define GL_ONE 0x1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_COEFF 0x0A00 +#define GL_DOMAIN 0x0A02 +#define GL_ORDER 0x0A01 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SCISSOR_BOX 0x0C10 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 + +/* GL 1.1 texturing */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 + +/* GL 1.2 texturing */ +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A + +/* Internal texture formats (GL 1.1) */ +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0x0 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + + +/* OpenGL 1.2 */ +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E + + + +/* + * OpenGL 1.2 imaging subset (NOT IMPLEMENTED BY MESA) + */ +/* GL_EXT_color_table */ +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +/* GL_EXT_convolution and GL_HP_convolution_border_modes */ +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +/* GL_SGI_color_matrix */ +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +/* GL_EXT_histogram */ +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +/* GL_EXT_blend_color, GL_EXT_blend_minmax */ +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 + + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF + +#endif // __gl_defines_h diff --git a/include/QF/GL/funcs.h b/include/QF/GL/funcs.h new file mode 100644 index 000000000..5e6ee24c8 --- /dev/null +++ b/include/QF/GL/funcs.h @@ -0,0 +1,38 @@ +/* + funcs.h + + GL function defs. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_funcs_h +#define __QF_GL_funcs_h + +#include "QF/GL/types.h" + +#define QFGL_NEED(ret, name, args) extern ret (* QFGL_##name) args +#include "QF/GL/qf_funcs_list.h" +#undef QFGL_NEED + +#endif // __QF_GL_funcs_h diff --git a/include/qfgl_ext.h b/include/QF/GL/qf_ext.h similarity index 99% rename from include/qfgl_ext.h rename to include/QF/GL/qf_ext.h index a6f830a4c..866747ded 100644 --- a/include/qfgl_ext.h +++ b/include/QF/GL/qf_ext.h @@ -36,16 +36,9 @@ # include #endif -#include - -#ifdef HAVE_GL_GLX_H -# include -#endif -#ifdef HAVE_GL_GLEXT_H -# include -#endif - #include "QF/qtypes.h" +#include "QF/GL/defines.h" +#include "QF/GL/types.h" // Define GLAPIENTRY to a useful value #ifndef GLAPIENTRY diff --git a/include/QF/GL/qf_fires.h b/include/QF/GL/qf_fires.h new file mode 100644 index 000000000..35ae02010 --- /dev/null +++ b/include/QF/GL/qf_fires.h @@ -0,0 +1,45 @@ +/* + qf_rlight.h + + GL light stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_fires_h +#define __QF_GL_fires_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" + +void R_AddFire (vec3_t, vec3_t, struct entity_s *ent); +void R_UpdateFires (void); + +#endif // __QF_GL_fires_h diff --git a/include/QF/GL/qf_funcs_list.h b/include/QF/GL/qf_funcs_list.h new file mode 100644 index 000000000..31f662573 --- /dev/null +++ b/include/QF/GL/qf_funcs_list.h @@ -0,0 +1,420 @@ +/* + gl_funcs_list.h + + QF GL function list. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef QFGL_DONT_NEED +#define QFGL_DONT_NEED(ret, func, params) +#define UNDEF_QFGL_DONT_NEED +#endif + +#ifndef QFGL_NEED +#define QFGL_NEED(ret, func, params) +#define UNDEF_QFGL_NEED +#endif + +QFGL_DONT_NEED (void, glAccum, (GLenum op, GLfloat value)); +QFGL_NEED (void, glAlphaFunc, (GLenum func, GLclampf ref)); +QFGL_DONT_NEED (GLboolean, glAreTexturesResident, (GLsizei n, const GLuint * textures, GLboolean * residences)); +QFGL_DONT_NEED (void, glArrayElement, (GLint i)); +QFGL_NEED (void, glBegin, (GLenum mode)); +QFGL_NEED (void, glBindTexture, (GLenum target, GLuint texture)); +QFGL_DONT_NEED (void, glBitmap, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap)); +QFGL_DONT_NEED (void, glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)); +QFGL_DONT_NEED (void, glBlendEquation, (GLenum mode)); +QFGL_NEED (void, glBlendFunc, (GLenum sfactor, GLenum dfactor)); +QFGL_DONT_NEED (void, glCallList, (GLuint list)); +QFGL_DONT_NEED (void, glCallLists, (GLsizei n, GLenum type, const GLvoid * lists)); +QFGL_NEED (void, glClear, (GLbitfield mask)); +QFGL_NEED (void, glClearAccum, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)); +QFGL_NEED (void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)); +QFGL_NEED (void, glClearDepth, (GLclampd depth)); +QFGL_NEED (void, glClearIndex, (GLfloat c)); +QFGL_NEED (void, glClearStencil, (GLint s)); +QFGL_DONT_NEED (void, glClipPlane, (GLenum plane, const GLdouble * equation)); +QFGL_DONT_NEED (void, glColor3b, (GLbyte red, GLbyte green, GLbyte blue)); +QFGL_DONT_NEED (void, glColor3bv, (const GLbyte * v)); +QFGL_DONT_NEED (void, glColor3d, (GLdouble red, GLdouble green, GLdouble blue)); +QFGL_DONT_NEED (void, glColor3dv, (const GLdouble * v)); +QFGL_NEED (void, glColor3f, (GLfloat red, GLfloat green, GLfloat blue)); +QFGL_NEED (void, glColor3fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glColor3i, (GLint red, GLint green, GLint blue)); +QFGL_DONT_NEED (void, glColor3iv, (const GLint * v)); +QFGL_DONT_NEED (void, glColor3s, (GLshort red, GLshort green, GLshort blue)); +QFGL_DONT_NEED (void, glColor3sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glColor3ub, (GLubyte red, GLubyte green, GLubyte blue)); +QFGL_NEED (void, glColor3ubv, (const GLubyte * v)); +QFGL_DONT_NEED (void, glColor3ui, (GLuint red, GLuint green, GLuint blue)); +QFGL_DONT_NEED (void, glColor3uiv, (const GLuint * v)); +QFGL_DONT_NEED (void, glColor3us, (GLushort red, GLushort green, GLushort blue)); +QFGL_DONT_NEED (void, glColor3usv, (const GLushort * v)); +QFGL_DONT_NEED (void, glColor4b, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)); +QFGL_DONT_NEED (void, glColor4bv, (const GLbyte * v)); +QFGL_DONT_NEED (void, glColor4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)); +QFGL_DONT_NEED (void, glColor4dv, (const GLdouble * v)); +QFGL_NEED (void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)); +QFGL_NEED (void, glColor4fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glColor4i, (GLint red, GLint green, GLint blue, GLint alpha)); +QFGL_DONT_NEED (void, glColor4iv, (const GLint * v)); +QFGL_DONT_NEED (void, glColor4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha)); +QFGL_DONT_NEED (void, glColor4sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)); +QFGL_NEED (void, glColor4ubv, (const GLubyte * v)); +QFGL_DONT_NEED (void, glColor4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha)); +QFGL_DONT_NEED (void, glColor4uiv, (const GLuint * v)); +QFGL_DONT_NEED (void, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha)); +QFGL_DONT_NEED (void, glColor4usv, (const GLushort * v)); +QFGL_DONT_NEED (void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)); +QFGL_DONT_NEED (void, glColorMaterial, (GLenum face, GLenum mode)); +QFGL_NEED (void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr)); +QFGL_DONT_NEED (void, glColorSubTable, (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data)); +QFGL_DONT_NEED (void, glColorTable, (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table)); +QFGL_DONT_NEED (void, glColorTableParameterfv, (GLenum target, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glColorTableParameteriv, (GLenum target, GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glConvolutionFilter1D, (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image)); +QFGL_DONT_NEED (void, glConvolutionFilter2D, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image)); +QFGL_DONT_NEED (void, glConvolutionParameterf, (GLenum target, GLenum pname, GLfloat params)); +QFGL_DONT_NEED (void, glConvolutionParameterfv, (GLenum target, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glConvolutionParameteri, (GLenum target, GLenum pname, GLint params)); +QFGL_DONT_NEED (void, glConvolutionParameteriv, (GLenum target, GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glCopyColorSubTable, (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)); +QFGL_DONT_NEED (void, glCopyColorTable, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)); +QFGL_DONT_NEED (void, glCopyConvolutionFilter1D, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)); +QFGL_DONT_NEED (void, glCopyConvolutionFilter2D, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)); +QFGL_DONT_NEED (void, glCopyPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)); +QFGL_DONT_NEED (void, glCopyTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)); +QFGL_DONT_NEED (void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)); +QFGL_DONT_NEED (void, glCopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)); +QFGL_DONT_NEED (void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)); +QFGL_DONT_NEED (void, glCopyTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)); +QFGL_NEED (void, glCullFace, (GLenum mode)); +QFGL_DONT_NEED (void, glDeleteLists, (GLuint list, GLsizei range)); +QFGL_NEED (void, glDeleteTextures, (GLsizei n, const GLuint * textures)); +QFGL_NEED (void, glDepthFunc, (GLenum func)); +QFGL_NEED (void, glDepthMask, (GLboolean flag)); +QFGL_NEED (void, glDepthRange, (GLclampd near_val, GLclampd far_val)); +QFGL_NEED (void, glDisable, (GLenum cap)); +QFGL_NEED (void, glDisableClientState, (GLenum cap)); +QFGL_NEED (void, glDrawArrays, (GLenum mode, GLint first, GLsizei count)); +QFGL_NEED (void, glDrawBuffer, (GLenum mode)); +QFGL_DONT_NEED (void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices)); +QFGL_DONT_NEED (void, glDrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_DONT_NEED (void, glDrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices)); +QFGL_DONT_NEED (void, glEdgeFlag, (GLboolean flag)); +QFGL_DONT_NEED (void, glEdgeFlagPointer, (GLsizei stride, const GLvoid * ptr)); +QFGL_DONT_NEED (void, glEdgeFlagv, (const GLboolean * flag)); +QFGL_NEED (void, glEnable, (GLenum cap)); +QFGL_NEED (void, glEnableClientState, (GLenum cap)); +QFGL_NEED (void, glEnd, (void)); +QFGL_NEED (void, glEndList, (void)); +QFGL_DONT_NEED (void, glEvalCoord1d, (GLdouble u)); +QFGL_DONT_NEED (void, glEvalCoord1dv, (const GLdouble * u)); +QFGL_DONT_NEED (void, glEvalCoord1f, (GLfloat u)); +QFGL_DONT_NEED (void, glEvalCoord1fv, (const GLfloat * u)); +QFGL_DONT_NEED (void, glEvalCoord2d, (GLdouble u, GLdouble v)); +QFGL_DONT_NEED (void, glEvalCoord2dv, (const GLdouble * u)); +QFGL_DONT_NEED (void, glEvalCoord2f, (GLfloat u, GLfloat v)); +QFGL_DONT_NEED (void, glEvalCoord2fv, (const GLfloat * u)); +QFGL_DONT_NEED (void, glEvalMesh1, (GLenum mode, GLint i1, GLint i2)); +QFGL_DONT_NEED (void, glEvalMesh2, (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)); +QFGL_DONT_NEED (void, glEvalPoint1, (GLint i)); +QFGL_DONT_NEED (void, glEvalPoint2, (GLint i, GLint j)); +QFGL_DONT_NEED (void, glFeedbackBuffer, (GLsizei size, GLenum type, GLfloat * buffer)); +QFGL_NEED (void, glFinish, (void)); +QFGL_NEED (void, glFlush, (void)); +QFGL_DONT_NEED (void, glFogf, (GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glFogfv, (GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glFogi, (GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glFogiv, (GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glFrontFace, (GLenum mode)); +QFGL_NEED (void, glFrustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)); +QFGL_DONT_NEED (GLuint, glGenLists, (GLsizei range)); +QFGL_DONT_NEED (void, glGenTextures, (GLsizei n, GLuint * textures)); +QFGL_DONT_NEED (void, glGetBooleanv, (GLenum pname, GLboolean * params)); +QFGL_DONT_NEED (void, glGetClipPlane, (GLenum plane, GLdouble * equation)); +QFGL_DONT_NEED (void, glGetColorTable, (GLenum target, GLenum format, GLenum type, GLvoid * table)); +QFGL_DONT_NEED (void, glGetColorTableParameterfv, (GLenum target, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetColorTableParameteriv, (GLenum target, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetConvolutionFilter, (GLenum target, GLenum format, GLenum type, GLvoid * image)); +QFGL_DONT_NEED (void, glGetConvolutionParameterfv, (GLenum target, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetConvolutionParameteriv, (GLenum target, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetDoublev, (GLenum pname, GLdouble * params)); +QFGL_DONT_NEED (GLenum, glGetError, (void)); +QFGL_NEED (void, glGetFloatv, (GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetHistogram, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)); +QFGL_DONT_NEED (void, glGetHistogramParameterfv, (GLenum target, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetHistogramParameteriv, (GLenum target, GLenum pname, GLint * params)); +QFGL_NEED (void, glGetIntegerv, (GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetLightfv, (GLenum light, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetLightiv, (GLenum light, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetMapdv, (GLenum target, GLenum query, GLdouble * v)); +QFGL_DONT_NEED (void, glGetMapfv, (GLenum target, GLenum query, GLfloat * v)); +QFGL_DONT_NEED (void, glGetMapiv, (GLenum target, GLenum query, GLint * v)); +QFGL_DONT_NEED (void, glGetMaterialfv, (GLenum face, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetMaterialiv, (GLenum face, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetMinmax, (GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid * values)); +QFGL_DONT_NEED (void, glGetMinmaxParameterfv, (GLenum target, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetMinmaxParameteriv, (GLenum target, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetPixelMapfv, (GLenum map, GLfloat * values)); +QFGL_DONT_NEED (void, glGetPixelMapuiv, (GLenum map, GLuint * values)); +QFGL_DONT_NEED (void, glGetPixelMapusv, (GLenum map, GLushort * values)); +QFGL_DONT_NEED (void, glGetPointerv, (GLenum pname, void **params)); +QFGL_DONT_NEED (void, glGetPolygonStipple, (GLubyte * mask)); +QFGL_DONT_NEED (void, glGetSeparableFilter, (GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span)); +QFGL_NEED (const GLubyte *, glGetString, (GLenum name)); +QFGL_DONT_NEED (void, glGetTexEnvfv, (GLenum target, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetTexEnviv, (GLenum target, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetTexGendv, (GLenum coord, GLenum pname, GLdouble * params)); +QFGL_DONT_NEED (void, glGetTexGenfv, (GLenum coord, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetTexGeniv, (GLenum coord, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels)); +QFGL_DONT_NEED (void, glGetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint * params)); +QFGL_DONT_NEED (void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat * params)); +QFGL_DONT_NEED (void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint * params)); +QFGL_NEED (void, glHint, (GLenum target, GLenum mode)); +QFGL_DONT_NEED (void, glHistogram, (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)); +QFGL_DONT_NEED (void, glIndexMask, (GLuint mask)); +QFGL_DONT_NEED (void, glIndexPointer, (GLenum type, GLsizei stride, const GLvoid * ptr)); +QFGL_DONT_NEED (void, glIndexd, (GLdouble c)); +QFGL_DONT_NEED (void, glIndexdv, (const GLdouble * c)); +QFGL_DONT_NEED (void, glIndexf, (GLfloat c)); +QFGL_DONT_NEED (void, glIndexfv, (const GLfloat * c)); +QFGL_DONT_NEED (void, glIndexi, (GLint c)); +QFGL_DONT_NEED (void, glIndexiv, (const GLint * c)); +QFGL_DONT_NEED (void, glIndexs, (GLshort c)); +QFGL_DONT_NEED (void, glIndexsv, (const GLshort * c)); +QFGL_DONT_NEED (void, glIndexub, (GLubyte c)); +QFGL_DONT_NEED (void, glIndexubv, (const GLubyte * c)); +QFGL_DONT_NEED (void, glInitNames, (void)); +QFGL_NEED (void, glInterleavedArrays, (GLenum format, GLsizei stride, const GLvoid * pointer)); +QFGL_DONT_NEED (GLboolean, glIsEnabled, (GLenum cap)); +QFGL_DONT_NEED (GLboolean, glIsList, (GLuint list)); +QFGL_DONT_NEED (GLboolean, glIsTexture, (GLuint texture)); +QFGL_DONT_NEED (void, glLightModelf, (GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glLightModelfv, (GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glLightModeli, (GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glLightModeliv, (GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glLightf, (GLenum light, GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glLightfv, (GLenum light, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glLighti, (GLenum light, GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glLightiv, (GLenum light, GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glLineStipple, (GLint factor, GLushort pattern)); +QFGL_DONT_NEED (void, glLineWidth, (GLfloat width)); +QFGL_DONT_NEED (void, glListBase, (GLuint base)); +QFGL_NEED (void, glLoadIdentity, (void)); +QFGL_DONT_NEED (void, glLoadMatrixd, (const GLdouble * m)); +QFGL_NEED (void, glLoadMatrixf, (const GLfloat * m)); +QFGL_DONT_NEED (void, glLoadName, (GLuint name)); +QFGL_DONT_NEED (void, glLogicOp, (GLenum opcode)); +QFGL_DONT_NEED (void, glMap1d, (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points)); +QFGL_DONT_NEED (void, glMap1f, (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points)); +QFGL_DONT_NEED (void, glMap2d, (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points)); +QFGL_DONT_NEED (void, glMap2f, (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points)); +QFGL_DONT_NEED (void, glMapGrid1d, (GLint un, GLdouble u1, GLdouble u2)); +QFGL_DONT_NEED (void, glMapGrid1f, (GLint un, GLfloat u1, GLfloat u2)); +QFGL_DONT_NEED (void, glMapGrid2d, (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)); +QFGL_DONT_NEED (void, glMapGrid2f, (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)); +QFGL_DONT_NEED (void, glMaterialf, (GLenum face, GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glMaterialfv, (GLenum face, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glMateriali, (GLenum face, GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glMaterialiv, (GLenum face, GLenum pname, const GLint * params)); +QFGL_NEED (void, glMatrixMode, (GLenum mode)); +QFGL_DONT_NEED (void, glMinmax, (GLenum target, GLenum internalformat, GLboolean sink)); +QFGL_DONT_NEED (void, glMultMatrixd, (const GLdouble * m)); +QFGL_DONT_NEED (void, glMultMatrixf, (const GLfloat * m)); +QFGL_DONT_NEED (void, glNewList, (GLuint list, GLenum mode)); +QFGL_DONT_NEED (void, glNormal3b, (GLbyte nx, GLbyte ny, GLbyte nz)); +QFGL_DONT_NEED (void, glNormal3bv, (const GLbyte * v)); +QFGL_DONT_NEED (void, glNormal3d, (GLdouble nx, GLdouble ny, GLdouble nz)); +QFGL_DONT_NEED (void, glNormal3dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz)); +QFGL_DONT_NEED (void, glNormal3fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glNormal3i, (GLint nx, GLint ny, GLint nz)); +QFGL_DONT_NEED (void, glNormal3iv, (const GLint * v)); +QFGL_DONT_NEED (void, glNormal3s, (GLshort nx, GLshort ny, GLshort nz)); +QFGL_DONT_NEED (void, glNormal3sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid * ptr)); +QFGL_NEED (void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)); +QFGL_DONT_NEED (void, glPassThrough, (GLfloat token)); +QFGL_DONT_NEED (void, glPixelMapfv, (GLenum map, GLint mapsize, const GLfloat * values)); +QFGL_DONT_NEED (void, glPixelMapuiv, (GLenum map, GLint mapsize, const GLuint * values)); +QFGL_DONT_NEED (void, glPixelMapusv, (GLenum map, GLint mapsize, const GLushort * values)); +QFGL_DONT_NEED (void, glPixelStoref, (GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glPixelStorei, (GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glPixelTransferf, (GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glPixelTransferi, (GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glPixelZoom, (GLfloat xfactor, GLfloat yfactor)); +QFGL_DONT_NEED (void, glPointSize, (GLfloat size)); +QFGL_NEED (void, glPolygonMode, (GLenum face, GLenum mode)); +QFGL_DONT_NEED (void, glPolygonOffset, (GLfloat factor, GLfloat units)); +QFGL_DONT_NEED (void, glPolygonStipple, (const GLubyte * mask)); +QFGL_DONT_NEED (void, glPopAttrib, (void)); +QFGL_DONT_NEED (void, glPopClientAttrib, (void)); +QFGL_NEED (void, glPopMatrix, (void)); +QFGL_DONT_NEED (void, glPopName, (void)); +QFGL_DONT_NEED (void, glPrioritizeTextures, (GLsizei n, const GLuint * textures, const GLclampf * priorities)); +QFGL_DONT_NEED (void, glPushAttrib, (GLbitfield mask)); +QFGL_DONT_NEED (void, glPushClientAttrib, (GLbitfield mask)); +QFGL_NEED (void, glPushMatrix, (void)); +QFGL_DONT_NEED (void, glPushName, (GLuint name)); +QFGL_DONT_NEED (void, glRasterPos2d, (GLdouble x, GLdouble y)); +QFGL_DONT_NEED (void, glRasterPos2dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glRasterPos2f, (GLfloat x, GLfloat y)); +QFGL_DONT_NEED (void, glRasterPos2fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glRasterPos2i, (GLint x, GLint y)); +QFGL_DONT_NEED (void, glRasterPos2iv, (const GLint * v)); +QFGL_DONT_NEED (void, glRasterPos2s, (GLshort x, GLshort y)); +QFGL_DONT_NEED (void, glRasterPos2sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glRasterPos3d, (GLdouble x, GLdouble y, GLdouble z)); +QFGL_DONT_NEED (void, glRasterPos3dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glRasterPos3f, (GLfloat x, GLfloat y, GLfloat z)); +QFGL_DONT_NEED (void, glRasterPos3fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glRasterPos3i, (GLint x, GLint y, GLint z)); +QFGL_DONT_NEED (void, glRasterPos3iv, (const GLint * v)); +QFGL_DONT_NEED (void, glRasterPos3s, (GLshort x, GLshort y, GLshort z)); +QFGL_DONT_NEED (void, glRasterPos3sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glRasterPos4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)); +QFGL_DONT_NEED (void, glRasterPos4dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glRasterPos4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)); +QFGL_DONT_NEED (void, glRasterPos4fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glRasterPos4i, (GLint x, GLint y, GLint z, GLint w)); +QFGL_DONT_NEED (void, glRasterPos4iv, (const GLint * v)); +QFGL_DONT_NEED (void, glRasterPos4s, (GLshort x, GLshort y, GLshort z, GLshort w)); +QFGL_DONT_NEED (void, glRasterPos4sv, (const GLshort * v)); +QFGL_NEED (void, glReadBuffer, (GLenum mode)); +QFGL_NEED (void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels)); +QFGL_DONT_NEED (void, glRectd, (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)); +QFGL_DONT_NEED (void, glRectdv, (const GLdouble * v1, const GLdouble * v2)); +QFGL_DONT_NEED (void, glRectf, (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)); +QFGL_DONT_NEED (void, glRectfv, (const GLfloat * v1, const GLfloat * v2)); +QFGL_DONT_NEED (void, glRecti, (GLint x1, GLint y1, GLint x2, GLint y2)); +QFGL_DONT_NEED (void, glRectiv, (const GLint * v1, const GLint * v2)); +QFGL_DONT_NEED (void, glRects, (GLshort x1, GLshort y1, GLshort x2, GLshort y2)); +QFGL_DONT_NEED (void, glRectsv, (const GLshort * v1, const GLshort * v2)); +QFGL_DONT_NEED (GLint, glRenderMode, (GLenum mode)); +QFGL_DONT_NEED (void, glResetHistogram, (GLenum target)); +QFGL_DONT_NEED (void, glResetMinmax, (GLenum target)); +QFGL_DONT_NEED (void, glRotated, (GLdouble angle, GLdouble x, GLdouble y, GLdouble z)); +QFGL_NEED (void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z)); +QFGL_DONT_NEED (void, glScaled, (GLdouble x, GLdouble y, GLdouble z)); +QFGL_NEED (void, glScalef, (GLfloat x, GLfloat y, GLfloat z)); +QFGL_DONT_NEED (void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height)); +QFGL_DONT_NEED (void, glSelectBuffer, (GLsizei size, GLuint * buffer)); +QFGL_DONT_NEED (void, glSeparableFilter2D, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column)); +QFGL_NEED (void, glShadeModel, (GLenum mode)); +QFGL_DONT_NEED (void, glStencilFunc, (GLenum func, GLint ref, GLuint mask)); +QFGL_DONT_NEED (void, glStencilMask, (GLuint mask)); +QFGL_DONT_NEED (void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass)); +QFGL_DONT_NEED (void, glTexCoord1d, (GLdouble s)); +QFGL_DONT_NEED (void, glTexCoord1dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glTexCoord1f, (GLfloat s)); +QFGL_DONT_NEED (void, glTexCoord1fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glTexCoord1i, (GLint s)); +QFGL_DONT_NEED (void, glTexCoord1iv, (const GLint * v)); +QFGL_DONT_NEED (void, glTexCoord1s, (GLshort s)); +QFGL_DONT_NEED (void, glTexCoord1sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glTexCoord2d, (GLdouble s, GLdouble t)); +QFGL_DONT_NEED (void, glTexCoord2dv, (const GLdouble * v)); +QFGL_NEED (void, glTexCoord2f, (GLfloat s, GLfloat t)); +QFGL_NEED (void, glTexCoord2fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glTexCoord2i, (GLint s, GLint t)); +QFGL_DONT_NEED (void, glTexCoord2iv, (const GLint * v)); +QFGL_DONT_NEED (void, glTexCoord2s, (GLshort s, GLshort t)); +QFGL_DONT_NEED (void, glTexCoord2sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glTexCoord3d, (GLdouble s, GLdouble t, GLdouble r)); +QFGL_DONT_NEED (void, glTexCoord3dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glTexCoord3f, (GLfloat s, GLfloat t, GLfloat r)); +QFGL_DONT_NEED (void, glTexCoord3fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glTexCoord3i, (GLint s, GLint t, GLint r)); +QFGL_DONT_NEED (void, glTexCoord3iv, (const GLint * v)); +QFGL_DONT_NEED (void, glTexCoord3s, (GLshort s, GLshort t, GLshort r)); +QFGL_DONT_NEED (void, glTexCoord3sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glTexCoord4d, (GLdouble s, GLdouble t, GLdouble r, GLdouble q)); +QFGL_DONT_NEED (void, glTexCoord4dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glTexCoord4f, (GLfloat s, GLfloat t, GLfloat r, GLfloat q)); +QFGL_DONT_NEED (void, glTexCoord4fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glTexCoord4i, (GLint s, GLint t, GLint r, GLint q)); +QFGL_DONT_NEED (void, glTexCoord4iv, (const GLint * v)); +QFGL_DONT_NEED (void, glTexCoord4s, (GLshort s, GLshort t, GLshort r, GLshort q)); +QFGL_DONT_NEED (void, glTexCoord4sv, (const GLshort * v)); +QFGL_NEED (void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr)); +QFGL_NEED (void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param)); +QFGL_NEED (void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glTexEnvi, (GLenum target, GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glTexEnviv, (GLenum target, GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glTexGend, (GLenum coord, GLenum pname, GLdouble param)); +QFGL_DONT_NEED (void, glTexGendv, (GLenum coord, GLenum pname, const GLdouble * params)); +QFGL_DONT_NEED (void, glTexGenf, (GLenum coord, GLenum pname, GLfloat param)); +QFGL_DONT_NEED (void, glTexGenfv, (GLenum coord, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glTexGeni, (GLenum coord, GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glTexGeniv, (GLenum coord, GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glTexImage1D, (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_NEED (void, glTexImage2D, (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_DONT_NEED (void, glTexImage3D, (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_NEED (void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param)); +QFGL_NEED (void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat * params)); +QFGL_DONT_NEED (void, glTexParameteri, (GLenum target, GLenum pname, GLint param)); +QFGL_DONT_NEED (void, glTexParameteriv, (GLenum target, GLenum pname, const GLint * params)); +QFGL_DONT_NEED (void, glTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_NEED (void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_DONT_NEED (void, glTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels)); +QFGL_DONT_NEED (void, glTranslated, (GLdouble x, GLdouble y, GLdouble z)); +QFGL_NEED (void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z)); +QFGL_DONT_NEED (void, glVertex2d, (GLdouble x, GLdouble y)); +QFGL_DONT_NEED (void, glVertex2dv, (const GLdouble * v)); +QFGL_NEED (void, glVertex2f, (GLfloat x, GLfloat y)); +QFGL_NEED (void, glVertex2fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glVertex2i, (GLint x, GLint y)); +QFGL_DONT_NEED (void, glVertex2iv, (const GLint * v)); +QFGL_DONT_NEED (void, glVertex2s, (GLshort x, GLshort y)); +QFGL_DONT_NEED (void, glVertex2sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glVertex3d, (GLdouble x, GLdouble y, GLdouble z)); +QFGL_DONT_NEED (void, glVertex3dv, (const GLdouble * v)); +QFGL_NEED (void, glVertex3f, (GLfloat x, GLfloat y, GLfloat z)); +QFGL_NEED (void, glVertex3fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glVertex3i, (GLint x, GLint y, GLint z)); +QFGL_DONT_NEED (void, glVertex3iv, (const GLint * v)); +QFGL_DONT_NEED (void, glVertex3s, (GLshort x, GLshort y, GLshort z)); +QFGL_DONT_NEED (void, glVertex3sv, (const GLshort * v)); +QFGL_DONT_NEED (void, glVertex4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)); +QFGL_DONT_NEED (void, glVertex4dv, (const GLdouble * v)); +QFGL_DONT_NEED (void, glVertex4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)); +QFGL_DONT_NEED (void, glVertex4fv, (const GLfloat * v)); +QFGL_DONT_NEED (void, glVertex4i, (GLint x, GLint y, GLint z, GLint w)); +QFGL_DONT_NEED (void, glVertex4iv, (const GLint * v)); +QFGL_DONT_NEED (void, glVertex4s, (GLshort x, GLshort y, GLshort z, GLshort w)); +QFGL_DONT_NEED (void, glVertex4sv, (const GLshort * v)); +QFGL_NEED (void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr)); +QFGL_NEED (void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height)); + +#ifdef UNDEF_QFGL_DONT_NEED +#undef QFGL_DONT_NEED +#endif + +#ifdef UNDEF_QFGL_NEED +#undef QFGL_DONT_NEED +#endif diff --git a/include/QF/GL/qf_rlight.h b/include/QF/GL/qf_rlight.h new file mode 100644 index 000000000..a7cb2fbb6 --- /dev/null +++ b/include/QF/GL/qf_rlight.h @@ -0,0 +1,44 @@ +/* + qf_rlight.h + + GL light stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_rlight_h +#define __QF_GL_rlight_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +extern float bubble_sintable[], bubble_costable[]; +void AddLightBlend (float, float, float, float); +void R_RenderDlights (void); + +#endif // __QF_GL_rlight_h diff --git a/include/QF/GL/qf_rmain.h b/include/QF/GL/qf_rmain.h new file mode 100644 index 000000000..f38d39455 --- /dev/null +++ b/include/QF/GL/qf_rmain.h @@ -0,0 +1,48 @@ +/* + qf_rmain.h + + GL light stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_rmain_h +#define __QF_GL_rmain_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" + +extern qboolean envmap; +extern int c_brush_polys, c_alias_polys; +extern float r_world_matrix[16]; + +void R_RotateForEntity (struct entity_s *e); + +#endif // __QF_GL_rmain_h diff --git a/include/QF/GL/qf_rsurf.h b/include/QF/GL/qf_rsurf.h new file mode 100644 index 000000000..0ff68001a --- /dev/null +++ b/include/QF/GL/qf_rsurf.h @@ -0,0 +1,47 @@ +/* + gl_rsurf.h + + GL texture stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_rsurf_h +#define __QF_GL_rsurf_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +extern int skytexturenum; // index in cl.loadmodel, not gl texture object +extern int mirrortexturenum; // quake texturenum, not gltexturenum + +void GL_BuildLightmaps (struct model_s **models, int num_models); +void R_DrawBrushModel (struct entity_s *e); +void R_DrawWorld (void); + +#endif // __QF_GL_rsurf_h diff --git a/include/QF/GL/qf_screen.h b/include/QF/GL/qf_screen.h new file mode 100644 index 000000000..fa965afac --- /dev/null +++ b/include/QF/GL/qf_screen.h @@ -0,0 +1,42 @@ +/* + gl_textures.h + + GL texture stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_screen_h +#define __QF_GL_screen_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +extern int glx, gly, glwidth, glheight; + +#endif // __QF_GL_screen_h diff --git a/include/QF/GL/qf_sky.h b/include/QF/GL/qf_sky.h new file mode 100644 index 000000000..dfff06556 --- /dev/null +++ b/include/QF/GL/qf_sky.h @@ -0,0 +1,47 @@ +/* + qf_sky.h + + GL sky stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_sky_h +#define __QF_GL_sky_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" + +#define SKY_TEX 2000 // Quake 2 environment sky + +void R_DrawSky (void); +void R_DrawSkyChain (msurface_t *s); + +#endif // __QF_GL_sky_h diff --git a/include/QF/GL/qf_textures.h b/include/QF/GL/qf_textures.h new file mode 100644 index 000000000..89e244be3 --- /dev/null +++ b/include/QF/GL/qf_textures.h @@ -0,0 +1,53 @@ +/* + gl_textures.h + + GL texture stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __gl_textures_h +#define __gl_textures_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" + +#define MAX_GLTEXTURES 2048 + +extern int gl_alpha_format; +extern int gl_solid_format; +extern int gl_lightmap_format; + +void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha); +void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha); +int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel); +int GL_FindTexture (char *identifier); + +#endif // __gl_textures_h diff --git a/include/QF/GL/qf_vid.h b/include/QF/GL/qf_vid.h new file mode 100644 index 000000000..fa1030ab6 --- /dev/null +++ b/include/QF/GL/qf_vid.h @@ -0,0 +1,58 @@ +/* + gl_textures.h + + GL texture stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __QF_GL_vid_h +#define __QF_GL_vid_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" +#include "QF/GL/types.h" +#include "QF/GL/qf_ext.h" + +// Multitexturing +extern QF_glActiveTextureARB qglActiveTexture; +extern QF_glMultiTexCoord2fARB qglMultiTexCoord2f; +extern qboolean gl_mtex_capable; +extern GLenum gl_mtex_enum; +// convenience check +#define gl_mtex_active (gl_mtex_capable && gl_multitexture->int_val) + +extern int texture_extension_number; +extern float gldepthmin, gldepthmax; + +void GL_EndRendering (void); +void GL_BeginRendering (int *x, int *y, int *width, int *height); + +#endif // __QF_GL_vid_h diff --git a/include/QF/GL/types.h b/include/QF/GL/types.h new file mode 100644 index 000000000..824bbcfc0 --- /dev/null +++ b/include/QF/GL/types.h @@ -0,0 +1,58 @@ +/* + gl_types.h + + GL texture stuff from the renderer. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __gl_types_h +#define __gl_types_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include "QF/qtypes.h" + +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + +#endif // __gl_types_h diff --git a/include/glquake.h b/include/glquake.h deleted file mode 100644 index 6e7af4010..000000000 --- a/include/glquake.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - glquake.h - - OpenGL-specific definitions and prototypes - - Copyright (C) 1996-1997 Id Software, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to: - - Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307, USA - - $Id$ -*/ - -#ifndef __glquake_h -#define __glquake_h - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#ifdef HAVE_WINDOWS_H -# include -#endif - -#include - -#include "QF/model.h" -#include "QF/wad.h" - -#include "qfgl_ext.h" - - -void GL_BeginRendering (int *x, int *y, int *width, int *height); -void GL_EndRendering (void); - -extern int texture_extension_number; -extern int texture_mode; - -extern float gldepthmin, gldepthmax; - -void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha); -void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha); -int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel); -int GL_FindTexture (char *identifier); - -extern int glx, gly, glwidth, glheight; - -#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0) - // normalizing factor so player model works out to about - // 1 pixel per triangle - -#define MAX_LBM_HEIGHT 480 - -#define MAX_GLTEXTURES 2048 - -#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf - -#define SKYSHIFT 7 -#define SKYSIZE (1 << SKYSHIFT) -#define SKYMASK (SKYSIZE - 1) -#define SKY_TEX 2000 // Quake 2 environment sky - -#define BACKFACE_EPSILON 0.01 - -#define NUM_GRAPH_TEXTURES 8 - -extern qboolean envmap; -extern int currenttexture; -extern int cnttextures[2]; -extern int particletexture; -extern int graph_texture[NUM_GRAPH_TEXTURES]; -extern int netgraphtexture; // netgraph texture - -extern int skytexturenum; // index in cl.loadmodel, not gl texture object - -extern struct cvar_s *r_novis; -extern struct cvar_s *r_particles; -extern struct cvar_s *r_norefresh; -extern struct cvar_s *r_drawviewmodel; -extern struct cvar_s *r_shadows; -extern struct cvar_s *r_wateralpha; -extern struct cvar_s *r_waterripple; -extern struct cvar_s *r_dynamic; -extern struct cvar_s *r_netgraph; -extern struct cvar_s *r_lightmap; -extern struct cvar_s *r_mirroralpha; - -extern struct cvar_s *gl_affinemodels; -extern struct cvar_s *gl_clear; -extern struct cvar_s *gl_cull; -extern struct cvar_s *gl_poly; -extern struct cvar_s *gl_texsort; -extern struct cvar_s *gl_smoothmodels; -extern struct cvar_s *gl_affinemodels; -extern struct cvar_s *gl_polyblend; -extern struct cvar_s *gl_fb_bmodels; -extern struct cvar_s *gl_fb_models; -extern struct cvar_s *gl_dlight_lightmap; -extern struct cvar_s *gl_dlight_polyblend; -extern struct cvar_s *gl_dlight_smooth; -extern struct cvar_s *gl_keeptjunctions; -extern struct cvar_s *gl_reporttjunctions; -extern struct cvar_s *gl_flashblend; -extern struct cvar_s *gl_multitexture; -extern struct cvar_s *gl_nocolors; -extern struct cvar_s *gl_doubleeyes; - -extern struct cvar_s *gl_ztrick; -extern struct cvar_s *gl_finish; -extern struct cvar_s *gl_clear; -extern struct cvar_s *gl_subdivide_size; -extern struct cvar_s *gl_particles; -extern struct cvar_s *gl_fires; -extern struct cvar_s *gl_fb_models; -extern struct cvar_s *gl_fb_bmodels; -extern struct cvar_s *gl_poly; -extern struct cvar_s *gl_polyblend; - -extern struct cvar_s *gl_max_size; -extern struct cvar_s *gl_playermip; - -extern struct cvar_s *r_skyname; -extern struct cvar_s *gl_skymultipass; -extern struct cvar_s *gl_sky_clip; -extern struct cvar_s *gl_sky_divide; - -extern int mirrortexturenum; // quake texturenum, not gltexturenum -extern qboolean mirror; -extern mplane_t *mirror_plane; -extern int gl_lightmap_format; -extern int gl_solid_format; -extern int gl_alpha_format; - -extern unsigned char lighthalf_v[3]; - -extern const char *gl_vendor; -extern const char *gl_renderer; -extern const char *gl_version; -extern const char *gl_extensions; - -void GL_Bind (int texnum); - -// Multitexture - -#define TEXTURE0_SGIS 0x835E -#define TEXTURE1_SGIS 0x835F - -#ifndef APIENTRY -# ifndef _WIN32 -# define APIENTRY /* */ -# endif -#endif - -typedef void (APIENTRY *lpMTexFUNC) (GLenum, GLfloat, GLfloat); -typedef void (APIENTRY *lpSelTexFUNC) (GLenum); -extern lpMTexFUNC qglMTexCoord2fSGIS; -extern lpSelTexFUNC qglSelectTextureSGIS; -extern lpMTexFUNC qglMTexCoord2f; -extern lpSelTexFUNC qglSelectTexture; - -extern qboolean gl_mtexable; - -void GL_SubdivideSurface (msurface_t *fa); - -// Multitexturing -extern QF_glActiveTextureARB qglActiveTexture; -extern QF_glMultiTexCoord2fARB qglMultiTexCoord2f; -extern qboolean gl_mtex_capable; -extern GLenum gl_mtex_enum; -// convenience check -#define gl_mtex_active (gl_mtex_capable && gl_multitexture->int_val) - -void GL_DisableMultitexture (void); -void GL_EnableMultitexture (void); -struct model_s; -void GL_BuildLightmaps (struct model_s **models, int num_models); -void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha) ; -void GL_Set2D (void); -void GL_CheckGamma (unsigned char *pal); -void GL_CheckBrightness (unsigned char *pal); - -typedef struct { - int key; // allows reusability - vec3_t origin, owner; - float size; - float die, decay; // duration settings - float minlight; // lighting threshold - float color[3]; // RGB -} fire_t; - -struct entity_s; -void R_AddFire (vec3_t, vec3_t, struct entity_s *ent); -fire_t *R_AllocFire (int); -void R_DrawFire (fire_t *); -void R_UpdateFires (void); - -void R_DrawBrushModel (struct entity_s *e); -void R_DrawWorld (void); -void R_RenderDlights (void); -void R_DrawSky (void); -void R_DrawSkyChain (msurface_t *s); -void EmitWaterPolys (msurface_t *fa); -void R_RotateForEntity (struct entity_s *e); -void EmitWaterPolys (msurface_t *fa); -void R_NetGraph (void); -void R_LoadSkys (const char *sky); - -extern float bubble_sintable[], bubble_costable[]; -extern float v_blend[4]; - -void AddLightBlend (float, float, float, float); -extern int c_brush_polys, c_alias_polys; -extern float r_world_matrix[16]; - -int R_InitGraphTextures (int base); - -#endif // __glquake_h diff --git a/include/r_cvar.h b/include/r_cvar.h index 491d610bc..4d767a22c 100644 --- a/include/r_cvar.h +++ b/include/r_cvar.h @@ -1,3 +1,5 @@ +extern unsigned char lighthalf_v[3]; + extern struct cvar_s *cl_crossx; extern struct cvar_s *cl_crossy; extern struct cvar_s *cl_verstring; @@ -21,16 +23,20 @@ extern struct cvar_s *gl_fb_models; extern struct cvar_s *gl_fires; extern struct cvar_s *gl_keeptjunctions; extern struct cvar_s *gl_lerp_anim; +extern struct cvar_s *gl_libgl; extern struct cvar_s *gl_lightmap_components; extern struct cvar_s *gl_max_size; +extern struct cvar_s *gl_multitexture; extern struct cvar_s *gl_nocolors; extern struct cvar_s *gl_picmip; extern struct cvar_s *gl_playermip; extern struct cvar_s *gl_reporttjunctions; extern struct cvar_s *gl_sky_clip; +extern struct cvar_s *gl_sky_divide; extern struct cvar_s *gl_skymultipass; extern struct cvar_s *gl_texsort; extern struct cvar_s *gl_triplebuffer; +extern struct cvar_s *gl_occlusion; extern struct cvar_s *r_aliasstats; extern struct cvar_s *r_aliastransadj; diff --git a/include/varrays.h b/include/varrays.h index 4283f3fb6..fa79177b8 100644 --- a/include/varrays.h +++ b/include/varrays.h @@ -37,7 +37,7 @@ # include #endif -#include +#include "QF/GL/types.h" typedef struct varray_t2f_c4f_v3f_s { GLfloat texcoord[2]; diff --git a/libs/models/alias/Makefile.am b/libs/models/alias/Makefile.am index 2e8099d80..e55aef543 100644 --- a/libs/models/alias/Makefile.am +++ b/libs/models/alias/Makefile.am @@ -2,7 +2,6 @@ INCLUDES= -I$(top_srcdir)/include if BUILD_GL ALIAS_GL = libalias_gl.la -AM_CFLAGS = $(GLX_CFLAGS) else ALIAS_GL = endif diff --git a/libs/models/alias/gl_model_alias.c b/libs/models/alias/gl_model_alias.c index 42bc9ff03..4bc9a7e91 100644 --- a/libs/models/alias/gl_model_alias.c +++ b/libs/models/alias/gl_model_alias.c @@ -45,8 +45,7 @@ #include "QF/qendian.h" #include "QF/skin.h" #include "QF/sys.h" - -#include "glquake.h" +#include "QF/GL/qf_textures.h" byte player_8bit_texels[320 * 200]; diff --git a/libs/models/brush/Makefile.am b/libs/models/brush/Makefile.am index a0a0cab36..8a527d6d0 100644 --- a/libs/models/brush/Makefile.am +++ b/libs/models/brush/Makefile.am @@ -2,7 +2,6 @@ INCLUDES= -I$(top_srcdir)/include if BUILD_GL BRUSH_GL = libbrush_gl.la -AM_CFLAGS = $(GLX_CFLAGS) else BRUSH_GL = endif diff --git a/libs/models/brush/gl_model_brush.c b/libs/models/brush/gl_model_brush.c index 89b9c5169..9aaff6332 100644 --- a/libs/models/brush/gl_model_brush.c +++ b/libs/models/brush/gl_model_brush.c @@ -41,10 +41,10 @@ #include "compat.h" #include "QF/console.h" -#include "glquake.h" #include "QF/model.h" #include "QF/qendian.h" #include "QF/vfs.h" +#include "QF/GL/qf_textures.h" int Mod_Fullbright (byte * skin, int width, int height, char *name); diff --git a/libs/models/gl_model_fullbright.c b/libs/models/gl_model_fullbright.c index 62d7fb538..e1fc3bf47 100644 --- a/libs/models/gl_model_fullbright.c +++ b/libs/models/gl_model_fullbright.c @@ -35,12 +35,12 @@ #include +#include "QF/GL/qf_textures.h" #include "QF/checksum.h" #include "QF/console.h" #include "QF/qendian.h" #include "QF/sys.h" -#include "glquake.h" #include "r_local.h" int diff --git a/libs/models/sprite/Makefile.am b/libs/models/sprite/Makefile.am index 381ef14e3..3c62f6fd7 100644 --- a/libs/models/sprite/Makefile.am +++ b/libs/models/sprite/Makefile.am @@ -2,7 +2,6 @@ INCLUDES= -I$(top_srcdir)/include if BUILD_GL SPRITE_GL = libsprite_gl.la -AM_CFLAGS = $(GLX_CFLAGS) else SPRITE_GL = endif diff --git a/libs/models/sprite/gl_model_sprite.c b/libs/models/sprite/gl_model_sprite.c index 652a72294..394ba8af5 100644 --- a/libs/models/sprite/gl_model_sprite.c +++ b/libs/models/sprite/gl_model_sprite.c @@ -39,10 +39,10 @@ # include #endif -#include "glquake.h" #include "compat.h" #include "QF/model.h" #include "QF/qendian.h" +#include "QF/GL/qf_textures.h" extern model_t *loadmodel; extern char loadname[]; diff --git a/libs/video/renderer/gl/Makefile.am b/libs/video/renderer/gl/Makefile.am index e4dc827b3..3f70f6e29 100644 --- a/libs/video/renderer/gl/Makefile.am +++ b/libs/video/renderer/gl/Makefile.am @@ -12,4 +12,5 @@ noinst_LTLIBRARIES = $(GL) libgl_la_LDFLAGS = -version-info 1:0:0 libgl_la_SOURCES = gl_draw.c gl_dyn_fires.c gl_dyn_part.c gl_dyn_textures.c \ gl_graph.c gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c \ - gl_skin.c gl_sky.c gl_sky_clip.c gl_textures.c gl_warp.c noisetextures.c + gl_skin.c gl_sky.c gl_sky_clip.c gl_textures.c gl_warp.c gl_funcs.c \ + noisetextures.c diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index bd9123a8c..212a4c8ec 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -48,8 +48,13 @@ #include "QF/vid.h" #include "QF/va.h" #include "QF/vfs.h" +#include "QF/GL/qf_textures.h" +#include "QF/GL/types.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_screen.h" +#include "QF/GL/qf_vid.h" -#include "glquake.h" #include "r_cvar.h" #include "sbar.h" @@ -58,7 +63,6 @@ extern cvar_t *crosshair, *cl_crossx, *cl_crossy, *crosshaircolor, *gl_lightmap_components; byte *draw_chars; // 8*8 graphic characters -qpic_t *draw_disc; qpic_t *draw_backtile; static int translate_texture; @@ -78,7 +82,6 @@ static byte cs_data[64] = { typedef struct { int texnum; -// float sl, tl, sh, th; } glpic_t; extern int gl_filter_min, gl_filter_max; @@ -243,7 +246,7 @@ Draw_Init (void) GLint texSize; // Some cards have a texture size limit. - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize); + QFGL_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize); Cvar_Set (gl_max_size, va("%d", texSize)); Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality."); @@ -261,14 +264,13 @@ Draw_Init (void) char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1); // 1999-12-27 Conwidth/height charset fix by TcT cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true, 1); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // save a texture slot for translated picture translate_texture = texture_extension_number++; // get the other pics we need - draw_disc = Draw_PicFromWad ("disc"); draw_backtile = Draw_PicFromWad ("backtile"); // LordHavoc: call init code for other GL renderer modules; @@ -305,18 +307,18 @@ Draw_Character8 (int x, int y, int num) fcol = col * 0.0625; size = 0.0625; - glBindTexture (GL_TEXTURE_2D, char_texture); + QFGL_glBindTexture (GL_TEXTURE_2D, char_texture); - glBegin (GL_QUADS); - glTexCoord2f (fcol, frow); - glVertex2f (x, y); - glTexCoord2f (fcol + size, frow); - glVertex2f (x + 8, y); - glTexCoord2f (fcol + size, frow + size); - glVertex2f (x + 8, y + 8); - glTexCoord2f (fcol, frow + size); - glVertex2f (x, y + 8); - glEnd (); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (fcol, frow); + QFGL_glVertex2f (x, y); + QFGL_glTexCoord2f (fcol + size, frow); + QFGL_glVertex2f (x + 8, y); + QFGL_glTexCoord2f (fcol + size, frow + size); + QFGL_glVertex2f (x + 8, y + 8); + QFGL_glTexCoord2f (fcol, frow + size); + QFGL_glVertex2f (x, y + 8); + QFGL_glEnd (); } @@ -364,20 +366,20 @@ Draw_Crosshair (int swap) y = scr_vrect.y + scr_vrect.height / 2 - 3 + cl_crossy->int_val; pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val]; - glColor4ubv (pColor); - glBindTexture (GL_TEXTURE_2D, cs_texture); + QFGL_glColor4ubv (pColor); + QFGL_glBindTexture (GL_TEXTURE_2D, cs_texture); - glBegin (GL_QUADS); - glTexCoord2f (0, 0); - glVertex2f (x - 4, y - 4); - glTexCoord2f (1, 0); - glVertex2f (x + 12, y - 4); - glTexCoord2f (1, 1); - glVertex2f (x + 12, y + 12); - glTexCoord2f (0, 1); - glVertex2f (x - 4, y + 12); - glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (0, 0); + QFGL_glVertex2f (x - 4, y - 4); + QFGL_glTexCoord2f (1, 0); + QFGL_glVertex2f (x + 12, y - 4); + QFGL_glTexCoord2f (1, 1); + QFGL_glVertex2f (x + 12, y + 12); + QFGL_glTexCoord2f (0, 1); + QFGL_glVertex2f (x - 4, y + 12); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); break; } } @@ -390,17 +392,17 @@ Draw_Pic (int x, int y, qpic_t *pic) gl = (glpic_t *) pic->data; - glBindTexture (GL_TEXTURE_2D, gl->texnum); - glBegin (GL_QUADS); - glTexCoord2f (0, 0); - glVertex2f (x, y); - glTexCoord2f (1, 0); - glVertex2f (x + pic->width, y); - glTexCoord2f (1, 1); - glVertex2f (x + pic->width, y + pic->height); - glTexCoord2f (0, 1); - glVertex2f (x, y + pic->height); - glEnd (); + QFGL_glBindTexture (GL_TEXTURE_2D, gl->texnum); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (0, 0); + QFGL_glVertex2f (x, y); + QFGL_glTexCoord2f (1, 0); + QFGL_glVertex2f (x + pic->width, y); + QFGL_glTexCoord2f (1, 1); + QFGL_glVertex2f (x + pic->width, y + pic->height); + QFGL_glTexCoord2f (0, 1); + QFGL_glVertex2f (x, y + pic->height); + QFGL_glEnd (); } @@ -419,19 +421,19 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, newtl = (float) srcy / (float) pic->height; newth = newtl + (float) height / (float) pic->height; - glColor3f (0.8, 0.8, 0.8); - glBindTexture (GL_TEXTURE_2D, gl->texnum); - glBegin (GL_QUADS); - glTexCoord2f (newsl, newtl); - glVertex2f (x, y); - glTexCoord2f (newsh, newtl); - glVertex2f (x + width, y); - glTexCoord2f (newsh, newth); - glVertex2f (x + width, y + height); - glTexCoord2f (newsl, newth); - glVertex2f (x, y + height); - glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glColor3f (0.8, 0.8, 0.8); + QFGL_glBindTexture (GL_TEXTURE_2D, gl->texnum); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (newsl, newtl); + QFGL_glVertex2f (x, y); + QFGL_glTexCoord2f (newsh, newtl); + QFGL_glVertex2f (x + width, y); + QFGL_glTexCoord2f (newsh, newth); + QFGL_glVertex2f (x + width, y + height); + QFGL_glTexCoord2f (newsl, newth); + QFGL_glVertex2f (x, y + height); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); } @@ -448,7 +450,7 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation) byte *src; int p; - glBindTexture (GL_TEXTURE_2D, translate_texture); + QFGL_glBindTexture (GL_TEXTURE_2D, translate_texture); c = pic->width * pic->height; @@ -464,24 +466,24 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation) } } - glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA, + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); - glColor3f (0.8, 0.8, 0.8); - glBegin (GL_QUADS); - glTexCoord2f (0, 0); - glVertex2f (x, y); - glTexCoord2f (1, 0); - glVertex2f (x + pic->width, y); - glTexCoord2f (1, 1); - glVertex2f (x + pic->width, y + pic->height); - glTexCoord2f (0, 1); - glVertex2f (x, y + pic->height); - glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glColor3f (0.8, 0.8, 0.8); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (0, 0); + QFGL_glVertex2f (x, y); + QFGL_glTexCoord2f (1, 0); + QFGL_glVertex2f (x + pic->width, y); + QFGL_glTexCoord2f (1, 1); + QFGL_glVertex2f (x + pic->width, y + pic->height); + QFGL_glTexCoord2f (0, 1); + QFGL_glVertex2f (x, y + pic->height); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); } @@ -510,16 +512,16 @@ Draw_ConsoleBackground (int lines) static float xfactor = .3f; static float xstep = .005f; - glPushMatrix (); - glMatrixMode (GL_TEXTURE); - glPushMatrix (); - glLoadIdentity (); + QFGL_glPushMatrix (); + QFGL_glMatrixMode (GL_TEXTURE); + QFGL_glPushMatrix (); + QFGL_glLoadIdentity (); xangle += gl_conspin->value; xfactor += xstep; if (xfactor > 8 || xfactor < .3f) xstep = -xstep; - glRotatef (xangle, 0, 0, 1); - glScalef (xfactor, xfactor, xfactor); + QFGL_glRotatef (xangle, 0, 0, 1); + QFGL_glScalef (xfactor, xfactor, xfactor); } // slide console up/down or stretch it? if (gl_constretch->int_val) @@ -535,35 +537,35 @@ Draw_ConsoleBackground (int lines) alpha = (float) (gl_conalpha->value * lines) / y; } - glColor4f (0.8, 0.8, 0.8, alpha); + QFGL_glColor4f (0.8, 0.8, 0.8, alpha); // draw the console texture - glBindTexture (GL_TEXTURE_2D, gl->texnum); - glBegin (GL_QUADS); - glTexCoord2f (0, 0 + ofs); - glVertex2f (0, 0); - glTexCoord2f (1, 0 + ofs); - glVertex2f (vid.conwidth, 0); - glTexCoord2f (1, 1); - glVertex2f (vid.conwidth, lines); - glTexCoord2f (0, 1); - glVertex2f (0, lines); - glEnd (); + QFGL_glBindTexture (GL_TEXTURE_2D, gl->texnum); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (0, 0 + ofs); + QFGL_glVertex2f (0, 0); + QFGL_glTexCoord2f (1, 0 + ofs); + QFGL_glVertex2f (vid.conwidth, 0); + QFGL_glTexCoord2f (1, 1); + QFGL_glVertex2f (vid.conwidth, lines); + QFGL_glTexCoord2f (0, 1); + QFGL_glVertex2f (0, lines); + QFGL_glEnd (); // turn off alpha blending if (alpha < 1.0) { - glColor3f (0.8, 0.8, 0.8); + QFGL_glColor3f (0.8, 0.8, 0.8); } if (gl_conspin->value) { - glPopMatrix (); - glMatrixMode (GL_MODELVIEW); - glPopMatrix (); + QFGL_glPopMatrix (); + QFGL_glMatrixMode (GL_MODELVIEW); + QFGL_glPopMatrix (); } Draw_AltString8 (vid.conwidth - strlen (cl_verstring->string) * 8 - 11, lines - 14, cl_verstring->string); - glColor3ubv (lighthalf_v); + QFGL_glColor3ubv (lighthalf_v); } @@ -576,19 +578,19 @@ Draw_ConsoleBackground (int lines) void Draw_TileClear (int x, int y, int w, int h) { - glColor3f (0.8, 0.8, 0.8); - glBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data); - glBegin (GL_QUADS); - glTexCoord2f (x / 64.0, y / 64.0); - glVertex2f (x, y); - glTexCoord2f ((x + w) / 64.0, y / 64.0); - glVertex2f (x + w, y); - glTexCoord2f ((x + w) / 64.0, (y + h) / 64.0); - glVertex2f (x + w, y + h); - glTexCoord2f (x / 64.0, (y + h) / 64.0); - glVertex2f (x, y + h); - glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glColor3f (0.8, 0.8, 0.8); + QFGL_glBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (x / 64.0, y / 64.0); + QFGL_glVertex2f (x, y); + QFGL_glTexCoord2f ((x + w) / 64.0, y / 64.0); + QFGL_glVertex2f (x + w, y); + QFGL_glTexCoord2f ((x + w) / 64.0, (y + h) / 64.0); + QFGL_glVertex2f (x + w, y + h); + QFGL_glTexCoord2f (x / 64.0, (y + h) / 64.0); + QFGL_glVertex2f (x, y + h); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); } @@ -600,20 +602,20 @@ Draw_TileClear (int x, int y, int w, int h) void Draw_Fill (int x, int y, int w, int h, int c) { - glDisable (GL_TEXTURE_2D); - glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0, + QFGL_glDisable (GL_TEXTURE_2D); + QFGL_glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0, vid_basepal[c * 3 + 2] / 255.0); - glBegin (GL_QUADS); + QFGL_glBegin (GL_QUADS); - glVertex2f (x, y); - glVertex2f (x + w, y); - glVertex2f (x + w, y + h); - glVertex2f (x, y + h); + QFGL_glVertex2f (x, y); + QFGL_glVertex2f (x + w, y); + QFGL_glVertex2f (x + w, y + h); + QFGL_glVertex2f (x, y + h); - glEnd (); - glColor3ubv (lighthalf_v); - glEnable (GL_TEXTURE_2D); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glEnable (GL_TEXTURE_2D); } @@ -623,18 +625,18 @@ Draw_Fill (int x, int y, int w, int h, int c) void Draw_FadeScreen (void) { - glDisable (GL_TEXTURE_2D); - glColor4f (0, 0, 0, 0.7); - glBegin (GL_QUADS); + QFGL_glDisable (GL_TEXTURE_2D); + QFGL_glColor4f (0, 0, 0, 0.7); + QFGL_glBegin (GL_QUADS); - glVertex2f (0, 0); - glVertex2f (vid.width, 0); - glVertex2f (vid.width, vid.height); - glVertex2f (0, vid.height); + QFGL_glVertex2f (0, 0); + QFGL_glVertex2f (vid.width, 0); + QFGL_glVertex2f (vid.width, vid.height); + QFGL_glVertex2f (0, vid.height); - glEnd (); - glColor3ubv (lighthalf_v); - glEnable (GL_TEXTURE_2D); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glEnable (GL_TEXTURE_2D); Sbar_Changed (); } @@ -675,17 +677,17 @@ Draw_EndDisc (void) void GL_Set2D (void) { - glViewport (glx, gly, glwidth, glheight); + QFGL_glViewport (glx, gly, glwidth, glheight); - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - glOrtho (0, vid.width, vid.height, 0, -99999, 99999); + QFGL_glMatrixMode (GL_PROJECTION); + QFGL_glLoadIdentity (); + QFGL_glOrtho (0, vid.width, vid.height, 0, -99999, 99999); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); + QFGL_glMatrixMode (GL_MODELVIEW); + QFGL_glLoadIdentity (); - glDisable (GL_DEPTH_TEST); - glDisable (GL_CULL_FACE); + QFGL_glDisable (GL_DEPTH_TEST); + QFGL_glDisable (GL_CULL_FACE); - glColor3ubv (lighthalf_v); + QFGL_glColor3ubv (lighthalf_v); } diff --git a/libs/video/renderer/gl/gl_dyn_fires.c b/libs/video/renderer/gl/gl_dyn_fires.c index edc95ac8a..d6758f4b9 100644 --- a/libs/video/renderer/gl/gl_dyn_fires.c +++ b/libs/video/renderer/gl/gl_dyn_fires.c @@ -42,16 +42,32 @@ #include "QF/console.h" #include "QF/cvar.h" #include "QF/render.h" +#include "QF/GL/funcs.h" +#include "QF/GL/defines.h" +#include "QF/GL/qf_rlight.h" -#include "glquake.h" +#include "r_cvar.h" #include "r_shared.h" #define MAX_FIRES 128 // rocket flames +typedef struct { + int key; // allows reusability + vec3_t origin, owner; + float size; + float die, decay; // duration settings + float minlight; // lighting threshold + float color[3]; // RGB +} fire_t; + static fire_t r_fires[MAX_FIRES]; extern cvar_t *gl_fires; extern cvar_t *r_firecolor; +void R_AddFire (vec3_t, vec3_t, struct entity_s *ent); +fire_t *R_AllocFire (int); +void R_DrawFire (fire_t *); +void R_UpdateFires (void); /* R_AddFire @@ -150,12 +166,12 @@ R_DrawFire (fire_t *f) return; } // we're not - draw it - glBegin (GL_TRIANGLE_FAN); - glColor3fv (f->color); + QFGL_glBegin (GL_TRIANGLE_FAN); + QFGL_glColor3fv (f->color); for (i = 0; i < 3; i++) vec[i] = f->origin[i] - vpn[i] * radius; - glVertex3fv (vec); - glColor3f (0.0, 0.0, 0.0); + QFGL_glVertex3fv (vec); + QFGL_glColor3f (0.0, 0.0, 0.0); // don't panic, this just draws a bubble... for (i = 16; i >= 0; i--) { @@ -165,14 +181,14 @@ R_DrawFire (fire_t *f) vec2[j] = f->owner[j] + (*b_cos * vright[j] + vup[j] * (*b_sin)) * radius; } - glVertex3fv (vec); - glVertex3fv (vec2); + QFGL_glVertex3fv (vec); + QFGL_glVertex3fv (vec2); b_sin += 2; b_cos += 2; } - glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); } @@ -190,9 +206,9 @@ R_UpdateFires (void) if (!gl_fires->int_val) return; - glDepthMask (GL_FALSE); - glDisable (GL_TEXTURE_2D); - glBlendFunc (GL_ONE, GL_ONE); + QFGL_glDepthMask (GL_FALSE); + QFGL_glDisable (GL_TEXTURE_2D); + QFGL_glBlendFunc (GL_ONE, GL_ONE); f = r_fires; for (i = 0; i < MAX_FIRES; i++, f++) { @@ -202,7 +218,7 @@ R_UpdateFires (void) R_DrawFire (f); } - glEnable (GL_TEXTURE_2D); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthMask (GL_TRUE); + QFGL_glEnable (GL_TEXTURE_2D); + QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + QFGL_glDepthMask (GL_TRUE); } diff --git a/libs/video/renderer/gl/gl_dyn_part.c b/libs/video/renderer/gl/gl_dyn_part.c index 226494890..6ec693295 100644 --- a/libs/video/renderer/gl/gl_dyn_part.c +++ b/libs/video/renderer/gl/gl_dyn_part.c @@ -47,8 +47,11 @@ #include "QF/sys.h" #include "varrays.h" #include "QF/vfs.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "r_cvar.h" +#include "QF/GL/qf_fires.h" -#include "glquake.h" #include "r_dynamic.h" #include "r_shared.h" @@ -572,7 +575,7 @@ R_DrawParticles (void) int activeparticles, maxparticle, j, k; // LordHavoc: particles should not affect zbuffer - glDepthMask (GL_FALSE); + QFGL_glDepthMask (GL_FALSE); VectorScale (vup, 1.5, o_up); VectorScale (vright, 1.5, o_right); @@ -657,8 +660,8 @@ R_DrawParticles (void) varray[3].vertex[1] = part->org[1] + up_scale[1] - right_scale[1]; varray[3].vertex[2] = part->org[2] + up_scale[2] - right_scale[2]; - glBindTexture (GL_TEXTURE_2D, part->tex); - glDrawArrays (GL_QUADS, 0, 4); + QFGL_glBindTexture (GL_TEXTURE_2D, part->tex); + QFGL_glDrawArrays (GL_QUADS, 0, 4); } for (i = 0; i < 3; i++) @@ -744,6 +747,6 @@ R_DrawParticles (void) } numparticles = activeparticles; - glColor3ubv (lighthalf_v); - glDepthMask (GL_TRUE); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glDepthMask (GL_TRUE); } diff --git a/libs/video/renderer/gl/gl_dyn_textures.c b/libs/video/renderer/gl/gl_dyn_textures.c index f61e207e9..26e3b1de7 100644 --- a/libs/video/renderer/gl/gl_dyn_textures.c +++ b/libs/video/renderer/gl/gl_dyn_textures.c @@ -32,7 +32,10 @@ #include -#include "glquake.h" +#include "QF/GL/defines.h" +#include "QF/GL/qf_vid.h" +#include "QF/GL/funcs.h" +#include "QF/qtypes.h" extern void noise_diamondsquare(unsigned char *noise, int size); extern void noise_plasma(unsigned char *noise, int size); @@ -80,10 +83,10 @@ GDT_InitDotParticleTexture (void) } } part_tex_dot = texture_extension_number++; - glBindTexture (GL_TEXTURE_2D, part_tex_dot); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA, + QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_dot); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data); } @@ -112,10 +115,10 @@ GDT_InitSparkParticleTexture (void) } } part_tex_spark = texture_extension_number++; - glBindTexture (GL_TEXTURE_2D, part_tex_spark); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA, + QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_spark); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data); } @@ -150,10 +153,10 @@ GDT_InitSmokeParticleTexture (void) } } part_tex_smoke[i] = texture_extension_number++; - glBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA, + QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data); } } @@ -194,10 +197,10 @@ GDT_InitSmokeRingParticleTexture (void) } } part_tex_smoke_ring[i] = texture_extension_number++; - glBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA, + QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data); } } diff --git a/libs/video/renderer/gl/gl_funcs.c b/libs/video/renderer/gl/gl_funcs.c new file mode 100644 index 000000000..e73b3cecf --- /dev/null +++ b/libs/video/renderer/gl/gl_funcs.c @@ -0,0 +1,73 @@ +/* + gl_funcs.c + + GL functions. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include "r_cvar.h" + +// First we need to get all the function pointers declared. +#define QFGL_NEED(ret, name, args) ret (* QFGL_##name) args = NULL; +#include "QF/GL/qf_funcs_list.h" +#undef QFGL_NEED + +// Then we need to open the libGL and set all the symbols. + +qboolean GLF_Init () +{ + void *handle; + + handle = dlopen (gl_libgl->string, RTLD_NOW); + if (!handle) { + Con_Printf("Can't open libgl %s: %s\n", gl_libgl->string, dlerror()); + return false; + } + +#define QFGL_NEED(ret, name, args) \ + QFGL_##name = dlsym(handle, #name); \ + if (!QFGL_##name) { \ + Con_Printf("Can't load symbol %s: %s\n", #name, dlerror()); \ + } +#include "QF/GL/qf_funcs_list.h" +#undef QFGL_NEED + + return true; +} diff --git a/libs/video/renderer/gl/gl_graph.c b/libs/video/renderer/gl/gl_graph.c index ede54c106..39fa22a92 100644 --- a/libs/video/renderer/gl/gl_graph.c +++ b/libs/video/renderer/gl/gl_graph.c @@ -39,13 +39,17 @@ #include #include +#include "QF/GL/qf_textures.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" #include "QF/cvar.h" #include "QF/draw.h" #include "QF/sys.h" -#include "glquake.h" #include "r_cvar.h" +#define NUM_GRAPH_TEXTURES 8 + extern byte *draw_chars; // 8*8 graphic characters extern cvar_t *r_netgraph; @@ -118,22 +122,22 @@ R_LineGraph (int x, int y, int *h_vals, int count) dest[0] = 0xff; } - glBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]); + QFGL_glBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]); GL_Upload8 (graph_texels[graph_index], graph_width[graph_index], s, 0, 1); - glBegin (GL_QUADS); - glTexCoord2f (0, 0); - glVertex2f (x, y); - glTexCoord2f (1, 0); - glVertex2f (x + graph_width[graph_index], y); - glTexCoord2f (1, 1); - glVertex2f (x + graph_width[graph_index], y - s); - glTexCoord2f (0, 1); - glVertex2f (x, y - s); - glEnd (); + QFGL_glBegin (GL_QUADS); + QFGL_glTexCoord2f (0, 0); + QFGL_glVertex2f (x, y); + QFGL_glTexCoord2f (1, 0); + QFGL_glVertex2f (x + graph_width[graph_index], y); + QFGL_glTexCoord2f (1, 1); + QFGL_glVertex2f (x + graph_width[graph_index], y - s); + QFGL_glTexCoord2f (0, 1); + QFGL_glVertex2f (x, y - s); + QFGL_glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glColor3ubv (lighthalf_v); graph_index = (graph_index + 1) % NUM_GRAPH_TEXTURES; } diff --git a/libs/video/renderer/gl/gl_rlight.c b/libs/video/renderer/gl/gl_rlight.c index 49dc3c6ee..683ac6706 100644 --- a/libs/video/renderer/gl/gl_rlight.c +++ b/libs/video/renderer/gl/gl_rlight.c @@ -42,9 +42,13 @@ #include "QF/cvar.h" #include "QF/render.h" -#include "glquake.h" -#include "r_shared.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "r_shared.h" +#include "r_cvar.h" + +extern float v_blend[4]; void R_AnimateLight (void) @@ -125,9 +129,9 @@ R_RenderDlight (dlight_t *light) return; } - glBegin (GL_TRIANGLE_FAN); + QFGL_glBegin (GL_TRIANGLE_FAN); - glColor3fv (light->color); + QFGL_glColor3fv (light->color); VectorSubtract (r_origin, light->origin, v); VectorNormalize (v); @@ -135,8 +139,8 @@ R_RenderDlight (dlight_t *light) for (i = 0; i < 3; i++) v[i] = light->origin[i] + v[i] * rad; - glVertex3fv (v); - glColor3f (0, 0, 0); + QFGL_glVertex3fv (v); + QFGL_glColor3f (0, 0, 0); for (i = 16; i >= 0; i--) { for (j = 0; j < 3; j++) @@ -144,10 +148,10 @@ R_RenderDlight (dlight_t *light) vup[j] * (*bub_sin)) * rad; bub_sin += 2; bub_cos += 2; - glVertex3fv (v); + QFGL_glVertex3fv (v); } - glEnd (); + QFGL_glEnd (); } @@ -160,10 +164,10 @@ R_RenderDlights (void) if (!gl_dlight_polyblend->int_val) return; - glDepthMask (GL_FALSE); - glDisable (GL_TEXTURE_2D); - glBlendFunc (GL_ONE, GL_ONE); - glShadeModel (GL_SMOOTH); + QFGL_glDepthMask (GL_FALSE); + QFGL_glDisable (GL_TEXTURE_2D); + QFGL_glBlendFunc (GL_ONE, GL_ONE); + QFGL_glShadeModel (GL_SMOOTH); l = r_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { @@ -173,11 +177,11 @@ R_RenderDlights (void) } if (!gl_dlight_smooth->int_val) - glShadeModel (GL_FLAT); - glColor3ubv (lighthalf_v); - glEnable (GL_TEXTURE_2D); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthMask (GL_TRUE); + QFGL_glShadeModel (GL_FLAT); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glEnable (GL_TEXTURE_2D); + QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + QFGL_glDepthMask (GL_TRUE); } diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index 368c10263..1fd515508 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -52,7 +52,14 @@ #include "QF/sys.h" #include "QF/vid.h" -#include "glquake.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_screen.h" +#include "QF/GL/qf_vid.h" +#include "QF/GL/qf_rsurf.h" +#include "QF/GL/qf_rlight.h" +#include "QF/GL/qf_fires.h" + #include "r_cvar.h" #include "r_dynamic.h" #include "r_local.h" @@ -98,8 +105,7 @@ float modelalpha; // Ender (Extend) Alpha void R_MarkLeaves (void); -extern cvar_t *scr_fov; - +//qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org); // LordHavoc: place for gl_rmain setup code void @@ -111,12 +117,12 @@ glrmain_init (void) void R_RotateForEntity (entity_t *e) { - glTranslatef (e->origin[0], e->origin[1], e->origin[2]); + QFGL_glTranslatef (e->origin[0], e->origin[1], e->origin[2]); - glRotatef (e->angles[1], 0, 0, 1); - glRotatef (-e->angles[0], 0, 1, 0); + QFGL_glRotatef (e->angles[1], 0, 0, 1); + QFGL_glRotatef (-e->angles[0], 0, 1, 0); // ZOID: fixed z angle - glRotatef (e->angles[2], 1, 0, 0); + QFGL_glRotatef (e->angles[2], 1, 0, 0); } @@ -187,34 +193,34 @@ R_DrawSpriteModel (entity_t *e) right = vright; } - glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum); + QFGL_glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum); - glEnable (GL_ALPHA_TEST); - glBegin (GL_QUADS); + QFGL_glEnable (GL_ALPHA_TEST); + QFGL_glBegin (GL_QUADS); - glTexCoord2f (0, 1); + QFGL_glTexCoord2f (0, 1); VectorMA (e->origin, frame->down, up, point); VectorMA (point, frame->left, right, point); - glVertex3fv (point); + QFGL_glVertex3fv (point); - glTexCoord2f (0, 0); + QFGL_glTexCoord2f (0, 0); VectorMA (e->origin, frame->up, up, point); VectorMA (point, frame->left, right, point); - glVertex3fv (point); + QFGL_glVertex3fv (point); - glTexCoord2f (1, 0); + QFGL_glTexCoord2f (1, 0); VectorMA (e->origin, frame->up, up, point); VectorMA (point, frame->right, right, point); - glVertex3fv (point); + QFGL_glVertex3fv (point); - glTexCoord2f (1, 1); + QFGL_glTexCoord2f (1, 1); VectorMA (e->origin, frame->down, up, point); VectorMA (point, frame->right, right, point); - glVertex3fv (point); + QFGL_glVertex3fv (point); - glEnd (); + QFGL_glEnd (); - glDisable (GL_ALPHA_TEST); + QFGL_glDisable (GL_ALPHA_TEST); } @@ -257,24 +263,24 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb) order = (int *) ((byte *) paliashdr + paliashdr->commands); if (modelalpha != 1.0) - glDepthMask (GL_FALSE); + QFGL_glDepthMask (GL_FALSE); if (fb) { - glColor4f (1, 1, 1, modelalpha); + QFGL_glColor4f (1, 1, 1, modelalpha); } while ((count = *order++)) { // get the vertex count and primitive type if (count < 0) { count = -count; - glBegin (GL_TRIANGLE_FAN); + QFGL_glBegin (GL_TRIANGLE_FAN); } else { - glBegin (GL_TRIANGLE_STRIP); + QFGL_glBegin (GL_TRIANGLE_STRIP); } do { // texture coordinates come from the draw list - glTexCoord2f (((float *) order)[0], ((float *) order)[1]); + QFGL_glTexCoord2f (((float *) order)[0], ((float *) order)[1]); order += 2; if (!fb) { @@ -282,21 +288,21 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb) l = shadedots[verts->lightnormalindex] * shadelight; // LordHavoc: cleanup after Endy - glColor4f (shadecolor[0] * l, shadecolor[1] * l, + QFGL_glColor4f (shadecolor[0] * l, shadecolor[1] * l, shadecolor[2] * l, modelalpha); } - glVertex3f (verts->v[0], verts->v[1], verts->v[2]); + QFGL_glVertex3f (verts->v[0], verts->v[1], verts->v[2]); verts++; } while (--count); - glEnd (); + QFGL_glEnd (); } if (modelalpha != 1.0) - glDepthMask (GL_TRUE); + QFGL_glDepthMask (GL_TRUE); - glColor3ubv (lighthalf_v); + QFGL_glColor3ubv (lighthalf_v); } @@ -327,10 +333,10 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble order = (int *) ((byte *) paliashdr + paliashdr->commands); if (modelalpha != 1.0) - glDepthMask (GL_FALSE); + QFGL_glDepthMask (GL_FALSE); if (fb) { // don't do this in the loop, it doesn't change - glColor4f (1, 1, 1, modelalpha); + QFGL_glColor4f (1, 1, 1, modelalpha); } lerp = 1 - blend; @@ -338,14 +344,14 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble if (count < 0) { count = -count; - glBegin (GL_TRIANGLE_FAN); + QFGL_glBegin (GL_TRIANGLE_FAN); } else { - glBegin (GL_TRIANGLE_STRIP); + QFGL_glBegin (GL_TRIANGLE_STRIP); } do { // texture coordinates come from the draw list - glTexCoord2f (((float *) order)[0], ((float *) order)[1]); + QFGL_glTexCoord2f (((float *) order)[0], ((float *) order)[1]); order += 2; if (!fb) { @@ -355,24 +361,24 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble lerp) + (shadedots[verts2->lightnormalindex] * blend)); - glColor4f (shadecolor[0] * light, shadecolor[1] * light, + QFGL_glColor4f (shadecolor[0] * light, shadecolor[1] * light, shadecolor[2] * light, modelalpha); } // blend the vertex positions from each frame together - glVertex3f ((verts1->v[0] * lerp) + (verts2->v[0] * blend), + QFGL_glVertex3f ((verts1->v[0] * lerp) + (verts2->v[0] * blend), (verts1->v[1] * lerp) + (verts2->v[1] * blend), (verts1->v[2] * lerp) + (verts2->v[2] * blend)); verts1++; verts2++; } while (--count); - glEnd (); + QFGL_glEnd (); } if (modelalpha != 1.0) - glDepthMask (GL_TRUE); - glColor3ubv (lighthalf_v); + QFGL_glDepthMask (GL_TRUE); + QFGL_glColor3ubv (lighthalf_v); } @@ -406,13 +412,13 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) if (count < 0) { count = -count; - glBegin (GL_TRIANGLE_FAN); + QFGL_glBegin (GL_TRIANGLE_FAN); } else - glBegin (GL_TRIANGLE_STRIP); + QFGL_glBegin (GL_TRIANGLE_STRIP); do { // texture coordinates come from the draw list - // (skipped for shadows) glTexCoord2fv ((float *)order); + // (skipped for shadows) QFGL_glTexCoord2fv ((float *)order); order += 2; // normals and vertexes come from the frame list @@ -430,12 +436,12 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) point[1] -= shadevector[1] * (point[2] + lheight); point[2] = height; // height -= 0.001; - glVertex3fv (point); + QFGL_glVertex3fv (point); verts++; } while (--count); - glEnd (); + QFGL_glEnd (); } } @@ -473,9 +479,9 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t if (count < 0) { count = -count; - glBegin (GL_TRIANGLE_FAN); + QFGL_glBegin (GL_TRIANGLE_FAN); } else { - glBegin (GL_TRIANGLE_STRIP); + QFGL_glBegin (GL_TRIANGLE_STRIP); } do { @@ -495,14 +501,14 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t point2[0] -= shadevector[0] * (point2[2] + lheight); point2[1] -= shadevector[1] * (point2[2] + lheight); - glVertex3f ((point1[0] * lerp) + (point2[0] * blend), + QFGL_glVertex3f ((point1[0] * lerp) + (point2[0] * blend), (point1[1] * lerp) + (point2[1] * blend), height); verts1++; verts2++; } while (--count); - glEnd (); + QFGL_glEnd (); } } @@ -581,7 +587,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea static void -R_DrawAliasModel (entity_t *e) +R_DrawAliasModel (entity_t *e, qboolean cull) { int lnum; vec3_t dist; @@ -601,9 +607,14 @@ R_DrawAliasModel (entity_t *e) VectorAdd (currententity->origin, clmodel->mins, mins); VectorAdd (currententity->origin, clmodel->maxs, maxs); - if (R_CullBox (mins, maxs)) + if (cull && R_CullBox (mins, maxs)) return; + /* + if (cull && R_CullBlocked(mins, maxs, currententity->origin)) + return; + */ + // FIXME: shadecolor is supposed to be the lighting for the model, not // just colormod shadecolor[0] = currententity->colormod[0] * 2.0; @@ -660,21 +671,21 @@ R_DrawAliasModel (entity_t *e) c_alias_polys += paliashdr->mdl.numtris; // draw all the triangles - glPushMatrix (); + QFGL_glPushMatrix (); R_RotateForEntity (e); if (strequal (clmodel->name, "progs/eyes.mdl")) { - glTranslatef (paliashdr->mdl.scale_origin[0], + QFGL_glTranslatef (paliashdr->mdl.scale_origin[0], paliashdr->mdl.scale_origin[1], paliashdr->mdl.scale_origin[2] - (22 + 8)); // double size of eyes, since they are really hard to see in GL - glScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2, + QFGL_glScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2, paliashdr->mdl.scale[2] * 2); } else { - glTranslatef (paliashdr->mdl.scale_origin[0], + QFGL_glTranslatef (paliashdr->mdl.scale_origin[0], paliashdr->mdl.scale_origin[1], paliashdr->mdl.scale_origin[2]); - glScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1], + QFGL_glScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1], paliashdr->mdl.scale[2]); } @@ -701,10 +712,10 @@ R_DrawAliasModel (entity_t *e) } } - glBindTexture (GL_TEXTURE_2D, texture); + QFGL_glBindTexture (GL_TEXTURE_2D, texture); if (gl_affinemodels->int_val) - glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + QFGL_glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); if (gl_lerp_anim->int_val) { R_SetupAliasBlendedFrame (currententity->frame, paliashdr, currententity, false); @@ -714,7 +725,7 @@ R_DrawAliasModel (entity_t *e) // This block is GL fullbright support for objects... if (fb_texture) { - glBindTexture (GL_TEXTURE_2D, fb_texture); + QFGL_glBindTexture (GL_TEXTURE_2D, fb_texture); if (gl_lerp_anim->int_val) { R_SetupAliasBlendedFrame (currententity->frame, paliashdr, currententity, true); @@ -724,9 +735,9 @@ R_DrawAliasModel (entity_t *e) } if (gl_affinemodels->int_val) - glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE); + QFGL_glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE); - glPopMatrix (); + QFGL_glPopMatrix (); if (r_shadows->int_val) { // torches, grenades, and lightning bolts do not have shadows @@ -735,11 +746,11 @@ R_DrawAliasModel (entity_t *e) if (strequal (clmodel->name, "progs/grenade.mdl")) return; - glPushMatrix (); + QFGL_glPushMatrix (); R_RotateForEntity (e); - glDisable (GL_TEXTURE_2D); - glColor4f (0, 0, 0, 0.5); + QFGL_glDisable (GL_TEXTURE_2D); + QFGL_glColor4f (0, 0, 0, 0.5); if (gl_lerp_anim->int_val) { GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity); @@ -747,9 +758,9 @@ R_DrawAliasModel (entity_t *e) GL_DrawAliasShadow (paliashdr, lastposenum); } - glEnable (GL_TEXTURE_2D); - glColor3ubv (lighthalf_v); - glPopMatrix (); + QFGL_glEnable (GL_TEXTURE_2D); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glPopMatrix (); } } @@ -820,7 +831,7 @@ R_DrawEntitiesOnList (void) if (currententity == r_player_entity) currententity->angles[PITCH] *= 0.3; - R_DrawAliasModel (currententity); + R_DrawAliasModel (currententity, true); } for (i = 0; i < r_numvisedicts; i++) { @@ -849,9 +860,9 @@ R_DrawViewModel (void) modelalpha = currententity->alpha; // hack the depth range to prevent view model from poking into walls - glDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); - R_DrawAliasModel (currententity); - glDepthRange (gldepthmin, gldepthmax); + QFGL_glDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); + R_DrawAliasModel (currententity, false); + QFGL_glDepthRange (gldepthmin, gldepthmax); } @@ -946,7 +957,7 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) xmin = ymin * aspect; xmax = ymax * aspect; - glFrustum (xmin, xmax, ymin, ymax, zNear, zFar); + QFGL_glFrustum (xmin, xmax, ymin, ymax, zNear, zFar); } @@ -958,8 +969,8 @@ R_SetupGL (void) int x, x2, y2, y, w, h; // set up viewpoint - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); + QFGL_glMatrixMode (GL_PROJECTION); + QFGL_glLoadIdentity (); x = r_refdef.vrect.x * glwidth / vid.width; x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth / vid.width; y = (vid.height - r_refdef.vrect.y) * glheight / vid.height; @@ -984,41 +995,41 @@ R_SetupGL (void) w = h = 256; } - glViewport (glx + x, gly + y2, w, h); + QFGL_glViewport (glx + x, gly + y2, w, h); screenaspect = (float) r_refdef.vrect.width / r_refdef.vrect.height; MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096); if (mirror) { if (mirror_plane->normal[2]) - glScalef (1, -1, 1); + QFGL_glScalef (1, -1, 1); else - glScalef (-1, 1, 1); - glCullFace (GL_BACK); + QFGL_glScalef (-1, 1, 1); + QFGL_glCullFace (GL_BACK); } else - glCullFace (GL_FRONT); + QFGL_glCullFace (GL_FRONT); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); + QFGL_glMatrixMode (GL_MODELVIEW); + QFGL_glLoadIdentity (); - glRotatef (-90, 1, 0, 0); // put Z going up - glRotatef (90, 0, 0, 1); // put Z going up - glRotatef (-r_refdef.viewangles[2], 1, 0, 0); - glRotatef (-r_refdef.viewangles[0], 0, 1, 0); - glRotatef (-r_refdef.viewangles[1], 0, 0, 1); - glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], + QFGL_glRotatef (-90, 1, 0, 0); // put Z going up + QFGL_glRotatef (90, 0, 0, 1); // put Z going up + QFGL_glRotatef (-r_refdef.viewangles[2], 1, 0, 0); + QFGL_glRotatef (-r_refdef.viewangles[0], 0, 1, 0); + QFGL_glRotatef (-r_refdef.viewangles[1], 0, 0, 1); + QFGL_glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]); - glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix); + QFGL_glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix); // set drawing parms - glEnable (GL_CULL_FACE); - glDisable (GL_ALPHA_TEST); - glAlphaFunc (GL_GREATER, 0.5); - glEnable (GL_DEPTH_TEST); + QFGL_glEnable (GL_CULL_FACE); + QFGL_glDisable (GL_ALPHA_TEST); + QFGL_glAlphaFunc (GL_GREATER, 0.5); + QFGL_glEnable (GL_DEPTH_TEST); if (gl_dlight_smooth->int_val) - glShadeModel (GL_SMOOTH); + QFGL_glShadeModel (GL_SMOOTH); else - glShadeModel (GL_FLAT); + QFGL_glShadeModel (GL_FLAT); } @@ -1026,14 +1037,14 @@ static void R_Clear (void) { if (gl_clear->int_val) - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + QFGL_glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); else - glClear (GL_DEPTH_BUFFER_BIT); + QFGL_glClear (GL_DEPTH_BUFFER_BIT); gldepthmin = 0; gldepthmax = 1; - glDepthFunc (GL_LEQUAL); + QFGL_glDepthFunc (GL_LEQUAL); - glDepthRange (gldepthmin, gldepthmax); + QFGL_glDepthRange (gldepthmin, gldepthmax); } @@ -1101,34 +1112,34 @@ R_Mirror (void) gldepthmin = 0.5; gldepthmax = 1; - glDepthRange (gldepthmin, gldepthmax); - glDepthFunc (GL_LEQUAL); + QFGL_glDepthRange (gldepthmin, gldepthmax); + QFGL_glDepthFunc (GL_LEQUAL); R_RenderScene (); R_DrawWaterSurfaces (); gldepthmin = 0; gldepthmax = 1;//XXX 0.5; - glDepthRange (gldepthmin, gldepthmax); - glDepthFunc (GL_LEQUAL); + QFGL_glDepthRange (gldepthmin, gldepthmax); + QFGL_glDepthFunc (GL_LEQUAL); // blend on top - glMatrixMode (GL_PROJECTION); + QFGL_glMatrixMode (GL_PROJECTION); if (mirror_plane->normal[2]) - glScalef (1, -1, 1); + QFGL_glScalef (1, -1, 1); else - glScalef (-1, 1, 1); - glCullFace (GL_FRONT); - glMatrixMode (GL_MODELVIEW); + QFGL_glScalef (-1, 1, 1); + QFGL_glCullFace (GL_FRONT); + QFGL_glMatrixMode (GL_MODELVIEW); - glLoadMatrixf (r_base_world_matrix); + QFGL_glLoadMatrixf (r_base_world_matrix); - glColor4f (1, 1, 1, r_mirroralpha->value); + QFGL_glColor4f (1, 1, 1, r_mirroralpha->value); s = r_worldentity.model->textures[mirrortexturenum]->texturechain; for (; s; s = s->texturechain) R_RenderBrushPoly (s); r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL; - glColor4f (1, 1, 1, 1); + QFGL_glColor4f (1, 1, 1, 1); } @@ -1146,7 +1157,7 @@ R_RenderView (void) if (!r_worldentity.model) Sys_Error ("R_RenderView: NULL worldmodel"); -// glFinish (); +// QFGL_glFinish (); mirror = false; @@ -1166,3 +1177,119 @@ R_RenderView (void) // render mirror view R_Mirror (); } + +#if 0 +qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org) +{ + static struct trace_t trace; + vec3_t point; + float rad; + + if (!gl_occlusion->int_val) + return false; + + // Check the origin first + if ( Mod_PointInLeaf(org, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, org, &trace)) + return false; + } + + rad = sqrt((maxs[0]-org[0])*(maxs[0]-org[0]) + + (maxs[1]-org[1])*(maxs[1]-org[1]) + + (maxs[2]-org[2])*(maxs[2]-org[2]) ); + + // Check a few points on the bounding sphere to catch rotating objects + // Raise the origin a bit to catch droptofloor models + point[0] = org[0]; point[1] = org[1]+rad; point[2] = org[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = org[0]+rad; point[1] = org[1]; point[2] = org[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = org[0]; point[1] = org[1]-rad; point[2] = org[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = org[0]-rad; point[1] = org[1]; point[2] = org[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + + // Check the poles of the sphere (can catch ents on ledges that would otherwise be missed) + point[0] = org[0]; point[1] = org[1]; point[2] = org[2]+rad; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = org[0]; point[1] = org[1]; point[2] = org[2]-rad; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + + + // Check the corners... + if ( Mod_PointInLeaf(maxs, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, maxs, &trace)) + return false; + } + point[0] = mins[0]; point[1] = maxs[1]; point[2] = maxs[2]; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = mins[0]; point[1] = mins[1]; point[2] = maxs[2]; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = maxs[0]; point[1] = mins[1]; point[2] = maxs[2]; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + if ( Mod_PointInLeaf(mins, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, mins, &trace)) + return false; + } + point[0] = mins[0]; point[1] = maxs[1]; point[2] = mins[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = maxs[0]; point[1] = mins[1]; point[2] = mins[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + point[0] = maxs[0]; point[1] = maxs[1]; point[2] = mins[2]+4; + if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) + { + if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) + return false; + } + + // Model is blocked (probably) + return true; +} +#endif diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index 4e4a76647..0ba3e11f3 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -48,10 +48,16 @@ #include "varrays.h" #include "QF/vfs.h" -#include "glquake.h" #include "r_dynamic.h" #include "r_local.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_vid.h" +#include "QF/GL/defines.h" +#include "QF/GL/qf_rmain.h" +#include "QF/GL/qf_rsurf.h" +#include "QF/GL/qf_screen.h" + varray_t2f_c4f_v3f_t varray[MAX_VARRAY_VERTS]; qboolean VID_Is8bit (void); @@ -61,6 +67,7 @@ extern cvar_t *gl_lerp_anim; extern cvar_t *r_netgraph; extern void GDT_Init (); +extern int R_InitGraphTextures (int base); /* @@ -73,8 +80,8 @@ R_Envmap_f (void) { byte buffer[256 * 256 * 4]; - glDrawBuffer (GL_FRONT); - glReadBuffer (GL_FRONT); + QFGL_glDrawBuffer (GL_FRONT); + QFGL_glReadBuffer (GL_FRONT); envmap = true; r_refdef.vrect.x = 0; @@ -87,44 +94,44 @@ R_Envmap_f (void) r_refdef.viewangles[2] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); - glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); COM_WriteFile ("env0.rgb", buffer, sizeof (buffer)); r_refdef.viewangles[1] = 90; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); - glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); COM_WriteFile ("env1.rgb", buffer, sizeof (buffer)); r_refdef.viewangles[1] = 180; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); - glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); COM_WriteFile ("env2.rgb", buffer, sizeof (buffer)); r_refdef.viewangles[1] = 270; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); - glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); COM_WriteFile ("env3.rgb", buffer, sizeof (buffer)); r_refdef.viewangles[0] = -90; r_refdef.viewangles[1] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); - glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); COM_WriteFile ("env4.rgb", buffer, sizeof (buffer)); r_refdef.viewangles[0] = 90; r_refdef.viewangles[1] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); - glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); COM_WriteFile ("env5.rgb", buffer, sizeof (buffer)); envmap = false; - glDrawBuffer (GL_BACK); - glReadBuffer (GL_BACK); + QFGL_glDrawBuffer (GL_BACK); + QFGL_glReadBuffer (GL_BACK); GL_EndRendering (); } @@ -159,14 +166,14 @@ R_Init (void) texture_extension_number = Skin_Init_Textures (texture_extension_number); - glEnableClientState (GL_COLOR_ARRAY); - glEnableClientState (GL_VERTEX_ARRAY); - glEnableClientState (GL_TEXTURE_COORD_ARRAY); + QFGL_glEnableClientState (GL_COLOR_ARRAY); + QFGL_glEnableClientState (GL_VERTEX_ARRAY); + QFGL_glEnableClientState (GL_TEXTURE_COORD_ARRAY); -// glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray); - glTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord); - glColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color); - glVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex); +// QFGL_glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray); + QFGL_glTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord); + QFGL_glColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color); + QFGL_glVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex); } @@ -223,7 +230,7 @@ R_TimeRefresh_f (void) int i; double start, stop, time; - glFinish (); + QFGL_glFinish (); GL_EndRendering (); start = Sys_DoubleTime (); @@ -231,7 +238,7 @@ R_TimeRefresh_f (void) GL_BeginRendering (&glx, &gly, &glwidth, &glheight); r_refdef.viewangles[1] = i / 128.0 * 360.0; R_RenderView (); - glFinish (); + QFGL_glFinish (); GL_EndRendering (); } diff --git a/libs/video/renderer/gl/gl_rsurf.c b/libs/video/renderer/gl/gl_rsurf.c index 35415a48b..cbf5bd3ad 100644 --- a/libs/video/renderer/gl/gl_rsurf.c +++ b/libs/video/renderer/gl/gl_rsurf.c @@ -45,11 +45,19 @@ #include "QF/render.h" #include "QF/sys.h" -#include "glquake.h" #include "r_cvar.h" #include "r_local.h" #include "r_shared.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_textures.h" +#include "QF/GL/qf_rmain.h" +#include "QF/GL/qf_vid.h" +#include "QF/GL/qf_sky.h" + +void EmitWaterPolys (msurface_t *fa); + qboolean r_cache_thrash; int skytexturenum; @@ -362,11 +370,11 @@ extern float speedscale; // for top sky and bottom sky void GL_UploadLightmap (int i, int x, int y, int w, int h) { -/* glTexSubImage2D (GL_TEXTURE_2D, 0, 0, y, BLOCK_WIDTH, h, gl_lightmap_format, +/* QFGL_glTexSubImage2D (GL_TEXTURE_2D, 0, 0, y, BLOCK_WIDTH, h, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes); */ - glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH, + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH, BLOCK_HEIGHT, 0, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps[i]); } @@ -390,17 +398,17 @@ R_DrawMultitexturePoly (msurface_t *s) i = s->lightmaptexturenum; - glColor3f (1, 1, 1); + QFGL_glColor3f (1, 1, 1); // Binds world to texture env 0 qglActiveTexture (gl_mtex_enum + 0); - glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum); - glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glEnable (GL_TEXTURE_2D); + QFGL_glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum); + QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + QFGL_glEnable (GL_TEXTURE_2D); // Binds lightmap to texenv 1 qglActiveTexture (gl_mtex_enum + 1); - glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); - glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glEnable (GL_TEXTURE_2D); + QFGL_glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); + QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + QFGL_glEnable (GL_TEXTURE_2D); // check for lightmap modification if (r_dynamic->int_val) { @@ -421,24 +429,24 @@ R_DrawMultitexturePoly (msurface_t *s) } } - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); v = s->polys->verts[0]; for (i = 0; i < s->polys->numverts; i++, v += VERTEXSIZE) { qglMultiTexCoord2f (gl_mtex_enum + 0, v[3], v[4]); qglMultiTexCoord2f (gl_mtex_enum + 1, v[5], v[6]); - glVertex3fv (v); + QFGL_glVertex3fv (v); } - glEnd (); - glDisable (GL_TEXTURE_2D); + QFGL_glEnd (); + QFGL_glDisable (GL_TEXTURE_2D); qglActiveTexture (gl_mtex_enum + 0); - glEnable (GL_TEXTURE_2D); + QFGL_glEnable (GL_TEXTURE_2D); if (texture->gl_fb_texturenum > 0) { s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum]; fullbright_polys[texture->gl_fb_texturenum] = s->polys; } - glColor3ubv (lighthalf_v); - glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } @@ -449,17 +457,17 @@ R_BlendLightmaps (void) glpoly_t *p; float *v; - glDepthMask (GL_FALSE); // don't bother writing Z + QFGL_glDepthMask (GL_FALSE); // don't bother writing Z - glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR); + QFGL_glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR); - glColor3f (1, 1, 1); + QFGL_glColor3f (1, 1, 1); for (i = 0; i < MAX_LIGHTMAPS; i++) { p = lightmap_polys[i]; if (!p) continue; - glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); + QFGL_glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); if (lightmap_modified[i]) { GL_UploadLightmap (i, lightmap_rectchange[i].l, lightmap_rectchange[i].t, @@ -468,21 +476,21 @@ R_BlendLightmaps (void) lightmap_modified[i] = false; } for (; p; p = p->chain) { - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); v = p->verts[0]; for (j = 0; j < p->numverts; j++, v += VERTEXSIZE) { - glTexCoord2fv (&v[5]); - glVertex3fv (v); + QFGL_glTexCoord2fv (&v[5]); + QFGL_glVertex3fv (v); } - glEnd (); + QFGL_glEnd (); } } // Return to normal blending --KB - glColor3ubv (lighthalf_v); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthMask (GL_TRUE); // back to normal Z buffering + QFGL_glDepthMask (GL_TRUE); // back to normal Z buffering } @@ -493,22 +501,22 @@ R_RenderFullbrights (void) glpoly_t *p; float *v; - glBlendFunc (GL_ONE, GL_ONE); + QFGL_glBlendFunc (GL_ONE, GL_ONE); for (i = 1; i < MAX_GLTEXTURES; i++) { if (!fullbright_polys[i]) continue; - glBindTexture (GL_TEXTURE_2D, i); + QFGL_glBindTexture (GL_TEXTURE_2D, i); for (p = fullbright_polys[i]; p; p = p->fb_chain) { - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); for (j = 0, v = p->verts[0]; j < p->numverts; j++, v += VERTEXSIZE) { - glTexCoord2fv (&v[3]); - glVertex3fv (v); + QFGL_glTexCoord2fv (&v[3]); + QFGL_glVertex3fv (v); } - glEnd (); + QFGL_glEnd (); } } - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -525,16 +533,16 @@ R_RenderBrushPoly (msurface_t *fa) c_brush_polys++; - glColor3f (1, 1, 1); - glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum); + QFGL_glColor3f (1, 1, 1); + QFGL_glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum); - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); v = fa->polys->verts[0]; for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) { - glTexCoord2fv (&v[3]); - glVertex3fv (v); + QFGL_glTexCoord2fv (&v[3]); + QFGL_glVertex3fv (v); } - glEnd (); + QFGL_glEnd (); // add the poly to the proper lightmap chain @@ -577,7 +585,7 @@ R_RenderBrushPoly (msurface_t *fa) R_BuildLightMap (fa, base, BLOCK_WIDTH * lightmap_bytes); } } - glColor3ubv (lighthalf_v); + QFGL_glColor3ubv (lighthalf_v); } @@ -587,13 +595,13 @@ GL_WaterSurface (msurface_t *s) int i; i = s->texinfo->texture->gl_texturenum; - glBindTexture (GL_TEXTURE_2D, i); + QFGL_glBindTexture (GL_TEXTURE_2D, i); if (r_wateralpha->value < 1.0) { - glDepthMask (GL_FALSE); - glColor4f (1, 1, 1, r_wateralpha->value); + QFGL_glDepthMask (GL_FALSE); + QFGL_glColor4f (1, 1, 1, r_wateralpha->value); EmitWaterPolys (s); - glColor3ubv (lighthalf_v); - glDepthMask (GL_TRUE); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glDepthMask (GL_TRUE); } else EmitWaterPolys (s); } @@ -609,18 +617,18 @@ R_DrawWaterSurfaces (void) return; // go back to the world matrix - glLoadMatrixf (r_world_matrix); + QFGL_glLoadMatrixf (r_world_matrix); if (r_wateralpha->value < 1.0) { - glDepthMask (GL_FALSE); - glColor4f (1, 1, 1, r_wateralpha->value); + QFGL_glDepthMask (GL_FALSE); + QFGL_glColor4f (1, 1, 1, r_wateralpha->value); } i = -1; for (s = waterchain; s; s = s->texturechain) { if (i != s->texinfo->texture->gl_texturenum) { i = s->texinfo->texture->gl_texturenum; - glBindTexture (GL_TEXTURE_2D, i); + QFGL_glBindTexture (GL_TEXTURE_2D, i); } EmitWaterPolys (s); } @@ -628,8 +636,8 @@ R_DrawWaterSurfaces (void) waterchain = NULL; if (r_wateralpha->value < 1.0) { - glDepthMask (GL_TRUE); - glColor3ubv (lighthalf_v); + QFGL_glDepthMask (GL_TRUE); + QFGL_glColor3ubv (lighthalf_v); } } @@ -640,7 +648,7 @@ DrawTextureChains (void) int i; msurface_t *s; - glDisable (GL_BLEND); + QFGL_glDisable (GL_BLEND); for (i = 0; i < r_worldentity.model->numtextures; i++) { if (!r_worldentity.model->textures[i]) @@ -651,7 +659,7 @@ DrawTextureChains (void) r_worldentity.model->textures[i]->texturechain = NULL; } - glEnable (GL_BLEND); + QFGL_glEnable (GL_BLEND); } @@ -720,7 +728,7 @@ R_DrawBrushModel (entity_t *e) } } - glPushMatrix (); + QFGL_glPushMatrix (); e->angles[0] = -e->angles[0]; // stupid quake bug R_RotateForEntity (e); e->angles[0] = -e->angles[0]; // stupid quake bug @@ -763,7 +771,7 @@ R_DrawBrushModel (entity_t *e) if (gl_sky_clip->int_val) R_DrawSkyChain (sky_chain); - glPopMatrix (); + QFGL_glPopMatrix (); } @@ -1190,10 +1198,10 @@ GL_BuildLightmaps (model_t **models, int num_models) lightmap_rectchange[i].t = BLOCK_HEIGHT; lightmap_rectchange[i].w = 0; lightmap_rectchange[i].h = 0; - glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH, + QFGL_glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH, BLOCK_HEIGHT, 0, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps[i]); } diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index 01e8771eb..e2d4bc8fe 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -52,12 +52,18 @@ #include "QF/vfs.h" // MAX_OSPATH #include "compat.h" -#include "glquake.h" #include "r_cvar.h" #include "r_local.h" #include "sbar.h" #include "view.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_rmain.h" +#include "QF/GL/qf_vid.h" + +extern float v_blend[4]; +extern void GL_Set2D (void); /* @@ -576,7 +582,7 @@ SCR_ScreenShot (int width, int height) if (!tex) return 0; - glReadPixels (glx, gly, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, + QFGL_glReadPixels (glx, gly, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, tex->data + vid.width * vid.height); w = (vid.width < width) ? vid.width : width; @@ -647,7 +653,7 @@ SCR_ScreenShot_f (void) return; } buffer = malloc (glwidth * glheight * 3); - glReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE, + QFGL_glReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE, buffer); WriteTGAfile (pcxname, buffer, glwidth, glheight); free (buffer); @@ -886,33 +892,33 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap) } // also makes polyblend apply to whole screen - glDisable (GL_TEXTURE_2D); + QFGL_glDisable (GL_TEXTURE_2D); if (v_blend[3]) { - glBegin (GL_QUADS); + QFGL_glBegin (GL_QUADS); - glColor4fv (v_blend); - glVertex2f (0, 0); - glVertex2f (vid.width, 0); - glVertex2f (vid.width, vid.height); - glVertex2f (0, vid.height); + QFGL_glColor4fv (v_blend); + QFGL_glVertex2f (0, 0); + QFGL_glVertex2f (vid.width, 0); + QFGL_glVertex2f (vid.width, vid.height); + QFGL_glVertex2f (0, vid.height); - glEnd (); - glColor3ubv (lighthalf_v); + QFGL_glEnd (); + QFGL_glColor3ubv (lighthalf_v); } - glEnable (GL_TEXTURE_2D); + QFGL_glEnable (GL_TEXTURE_2D); V_UpdatePalette (); if (r_speeds->int_val) { -// glFinish (); +// QFGL_glFinish (); time2 = Sys_DoubleTime (); Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int) ((time2 - time1) * 1000), c_brush_polys, c_alias_polys); } - glFinish (); + QFGL_glFinish (); GL_EndRendering (); } diff --git a/libs/video/renderer/gl/gl_skin.c b/libs/video/renderer/gl/gl_skin.c index 0ca5bb769..1b00aee61 100644 --- a/libs/video/renderer/gl/gl_skin.c +++ b/libs/video/renderer/gl/gl_skin.c @@ -37,13 +37,16 @@ #endif #include "compat.h" +#include "r_cvar.h" #include "QF/console.h" #include "QF/cvar.h" #include "QF/render.h" #include "QF/skin.h" #include "QF/texture.h" -#include "glquake.h" +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_textures.h" static byte translate[256]; static unsigned int translate32[256]; @@ -134,12 +137,12 @@ build_skin_32 (byte * original, int tinwidth, int tinheight, } } - glTexImage2D (GL_TEXTURE_2D, 0, samples, + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } static void @@ -150,7 +153,7 @@ build_skin (int texnum, byte *ptexels, int width, int height, // because this happens during gameplay, do it fast // instead of sending it through GL_Upload8() - glBindTexture (GL_TEXTURE_2D, texnum); + QFGL_glBindTexture (GL_TEXTURE_2D, texnum); // FIXME deek: This 512x256 limit sucks! scaled_width = min (gl_max_size->int_val, 512); diff --git a/libs/video/renderer/gl/gl_sky.c b/libs/video/renderer/gl/gl_sky.c index 75e2d8eca..434be1c5c 100644 --- a/libs/video/renderer/gl/gl_sky.c +++ b/libs/video/renderer/gl/gl_sky.c @@ -44,9 +44,16 @@ #include "QF/vfs.h" #include "QF/vid.h" -#include "glquake.h" #include "r_shared.h" #include "view.h" +#include "r_cvar.h" + +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_sky.h" +#include "QF/GL/qf_textures.h" +#include "QF/GL/qf_rlight.h" +#include "QF/GL/qf_vid.h" extern model_t *loadmodel; @@ -77,7 +84,7 @@ R_LoadSkys (const char *skyname) for (i = 0; i < 6; i++) { byte *targa_rgba; - glBindTexture (GL_TEXTURE_2D, SKY_TEX + i); + QFGL_glBindTexture (GL_TEXTURE_2D, SKY_TEX + i); snprintf (name, sizeof (name), "env/%s%s.tga", skyname, suf[i]); COM_FOpenFile (name, &f); if (!f) { @@ -87,13 +94,13 @@ R_LoadSkys (const char *skyname) } targa_rgba = LoadTGA (f); - glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, targa_rgba); free (targa_rgba); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } if (!skyloaded) Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname); @@ -106,8 +113,8 @@ R_SkyBoxPolyVec (vec5_t v) // avoid interpolation seams // s = s * (254.0/256.0) + (1.0/256.0); // t = t * (254.0/256.0) + (1.0/256.0); - glTexCoord2fv (v); - glVertex3f (r_refdef.vieworg[0] + v[2], + QFGL_glTexCoord2fv (v); + QFGL_glVertex3f (r_refdef.vieworg[0] + v[2], r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]); } @@ -165,18 +172,18 @@ R_DrawSkyBox (void) { int i, j; - glDisable (GL_DEPTH_TEST); - glDepthRange (gldepthmax, gldepthmax); + QFGL_glDisable (GL_DEPTH_TEST); + QFGL_glDepthRange (gldepthmax, gldepthmax); for (i = 0; i < 6; i++) { - glBindTexture (GL_TEXTURE_2D, SKY_TEX + i); - glBegin (GL_QUADS); + QFGL_glBindTexture (GL_TEXTURE_2D, SKY_TEX + i); + QFGL_glBegin (GL_QUADS); for (j = 0; j < 4; j++) R_SkyBoxPolyVec (skyvec[i][j]); - glEnd (); + QFGL_glEnd (); } - glEnable (GL_DEPTH_TEST); - glDepthRange (gldepthmin, gldepthmax); + QFGL_glEnable (GL_DEPTH_TEST); + QFGL_glDepthRange (gldepthmin, gldepthmax); } @@ -195,9 +202,9 @@ R_DrawSkyLayer (float s) a2x = bubble_costable[(a + 1) * 2] * domescale[0]; a2y = -bubble_sintable[(a + 1) * 2] * domescale[1]; - glBegin (GL_TRIANGLE_STRIP); - glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); - glVertex3f (r_refdef.vieworg[0], + QFGL_glBegin (GL_TRIANGLE_STRIP); + QFGL_glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); + QFGL_glVertex3f (r_refdef.vieworg[0], r_refdef.vieworg[1], r_refdef.vieworg[2] + domescale[2]); for (b = 1; b < 8; b++) { x = bubble_costable[b * 2 + 16]; @@ -206,23 +213,23 @@ R_DrawSkyLayer (float s) v[0] = a1x * x; v[1] = a1y * x; v[2] = y * domescale[2]; - glTexCoord2f ((v[0] + s) * (1.0 / 128.0), + QFGL_glTexCoord2f ((v[0] + s) * (1.0 / 128.0), (v[1] + s) * (1.0 / 128.0)); - glVertex3f (v[0] + r_refdef.vieworg[0], + QFGL_glVertex3f (v[0] + r_refdef.vieworg[0], v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]); v[0] = a2x * x; v[1] = a2y * x; v[2] = y * domescale[2]; - glTexCoord2f ((v[0] + s) * (1.0 / 128.0), + QFGL_glTexCoord2f ((v[0] + s) * (1.0 / 128.0), (v[1] + s) * (1.0 / 128.0)); - glVertex3f (v[0] + r_refdef.vieworg[0], + QFGL_glVertex3f (v[0] + r_refdef.vieworg[0], v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]); } - glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); - glVertex3f (r_refdef.vieworg[0], + QFGL_glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); + QFGL_glVertex3f (r_refdef.vieworg[0], r_refdef.vieworg[1], r_refdef.vieworg[2] - domescale[2]); - glEnd (); + QFGL_glEnd (); } } @@ -230,24 +237,24 @@ R_DrawSkyLayer (float s) void R_DrawSkyDome (void) { - glDisable (GL_DEPTH_TEST); - glDepthRange (gldepthmax, gldepthmax); + QFGL_glDisable (GL_DEPTH_TEST); + QFGL_glDepthRange (gldepthmax, gldepthmax); - glDisable (GL_BLEND); + QFGL_glDisable (GL_BLEND); // base sky - glBindTexture (GL_TEXTURE_2D, solidskytexture); + QFGL_glBindTexture (GL_TEXTURE_2D, solidskytexture); domescale[0] = 512; domescale[1] = 512; domescale[2] = 128; speedscale = r_realtime * 8; speedscale -= (int) speedscale & ~127; R_DrawSkyLayer (speedscale); - glEnable (GL_BLEND); + QFGL_glEnable (GL_BLEND); // clouds if (gl_skymultipass->int_val) { - glBindTexture (GL_TEXTURE_2D, alphaskytexture); + QFGL_glBindTexture (GL_TEXTURE_2D, alphaskytexture); domescale[0] = 512; domescale[1] = 512; domescale[2] = 128; @@ -256,8 +263,8 @@ R_DrawSkyDome (void) R_DrawSkyLayer (speedscale); } - glEnable (GL_DEPTH_TEST); - glDepthRange (gldepthmin, gldepthmax); + QFGL_glEnable (GL_DEPTH_TEST); + QFGL_glDepthRange (gldepthmin, gldepthmax); } @@ -310,11 +317,11 @@ R_InitSky (texture_t *mt) if (!solidskytexture) solidskytexture = texture_extension_number++; - glBindTexture (GL_TEXTURE_2D, solidskytexture); - glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA, + QFGL_glBindTexture (GL_TEXTURE_2D, solidskytexture); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); for (i = 0; i < 128; i++) @@ -328,9 +335,9 @@ R_InitSky (texture_t *mt) if (!alphaskytexture) alphaskytexture = texture_extension_number++; - glBindTexture (GL_TEXTURE_2D, alphaskytexture); - glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA, + QFGL_glBindTexture (GL_TEXTURE_2D, alphaskytexture); + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } diff --git a/libs/video/renderer/gl/gl_sky_clip.c b/libs/video/renderer/gl/gl_sky_clip.c index f0b632940..d06d249ae 100644 --- a/libs/video/renderer/gl/gl_sky_clip.c +++ b/libs/video/renderer/gl/gl_sky_clip.c @@ -43,8 +43,13 @@ #include "QF/render.h" #include "QF/sys.h" -#include "glquake.h" #include "view.h" +#include "r_cvar.h" + +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_sky.h" +#include "QF/GL/qf_vid.h" extern qboolean skyloaded; extern vec5_t skyvec[6][4]; @@ -588,13 +593,13 @@ render_box (struct box_def *box) for (i = 0; i < 6; i++) { if (box->face[i].poly.numverts <= 2) continue; - glBindTexture (GL_TEXTURE_2D, box->face[i].tex); - glBegin (GL_POLYGON); + QFGL_glBindTexture (GL_TEXTURE_2D, box->face[i].tex); + QFGL_glBegin (GL_POLYGON); for (j = 0; j < box->face[i].poly.numverts; j++) { - glTexCoord2fv (box->face[i].poly.verts[j] + 3); - glVertex3fv (box->face[i].poly.verts[j]); + QFGL_glTexCoord2fv (box->face[i].poly.verts[j] + 3); + QFGL_glVertex3fv (box->face[i].poly.verts[j]); } - glEnd (); + QFGL_glEnd (); } } @@ -663,11 +668,11 @@ R_DrawSkyDomePoly (glpoly_t *poly) { int i; - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); for (i = 0; i < poly->numverts; i++) { - glVertex3fv (poly->verts[i]); + QFGL_glVertex3fv (poly->verts[i]); } - glEnd (); + QFGL_glEnd (); } void @@ -676,7 +681,7 @@ R_DrawSkyChain (msurface_t *sky_chain) msurface_t *sc = sky_chain; if (skyloaded) { - glDepthRange (gldepthmax, gldepthmax); + QFGL_glDepthRange (gldepthmax, gldepthmax); while (sc) { glpoly_t *p = sc->polys; @@ -686,11 +691,11 @@ R_DrawSkyChain (msurface_t *sky_chain) } sc = sc->texturechain; } - glDepthRange (gldepthmin, gldepthmax); + QFGL_glDepthRange (gldepthmin, gldepthmax); } else { - glDisable (GL_BLEND); - glDisable (GL_TEXTURE_2D); - glColor3f (0, 0, 0); + QFGL_glDisable (GL_BLEND); + QFGL_glDisable (GL_TEXTURE_2D); + QFGL_glColor3f (0, 0, 0); while (sc) { glpoly_t *p = sc->polys; @@ -700,51 +705,51 @@ R_DrawSkyChain (msurface_t *sky_chain) } sc = sc->texturechain; } - glEnable (GL_TEXTURE_2D); - glEnable (GL_BLEND); + QFGL_glEnable (GL_TEXTURE_2D); + QFGL_glEnable (GL_BLEND); } #if 0 // seems to work, but this is the wrong place to do it. - glColor4f (1,1,1,0); + QFGL_glColor4f (1,1,1,0); sc = sky_chain; while (sc) { glpoly_t *p = sc->polys; while (p) { int i; - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); for (i = 0; i < p->numverts; i++) { - glVertex3fv (p->verts[i]); + QFGL_glVertex3fv (p->verts[i]); } - glEnd (); + QFGL_glEnd (); p = p->next; } sc = sc->texturechain; } #endif - glColor3ubv (lighthalf_v); + QFGL_glColor3ubv (lighthalf_v); #if 0 - glDisable (GL_TEXTURE_2D); + QFGL_glDisable (GL_TEXTURE_2D); sc = sky_chain; - glColor3f (1, 1, 1); + QFGL_glColor3f (1, 1, 1); while (sc) { glpoly_t *p = sc->polys; while (p) { int i; - glBegin (GL_LINE_LOOP); + QFGL_glBegin (GL_LINE_LOOP); for (i = 0; i < p->numverts; i++) { - glVertex3fv (p->verts[i]); + QFGL_glVertex3fv (p->verts[i]); } - glEnd (); + QFGL_glEnd (); p = p->next; } sc = sc->texturechain; } sc = sky_chain; - glColor3f (0, 1, 0); - glBegin (GL_POINTS); + QFGL_glColor3f (0, 1, 0); + QFGL_glBegin (GL_POINTS); while (sc) { glpoly_t *p = sc->polys; @@ -758,29 +763,29 @@ R_DrawSkyChain (msurface_t *sky_chain) } VectorScale (c, 1.0 / p->numverts, c); VectorAdd (c, r_refdef.vieworg, c); - glVertex3fv (c); + QFGL_glVertex3fv (c); p = p->next; } sc = sc->texturechain; } - glEnd (); + QFGL_glEnd (); if (skyloaded) { int i, j; - glColor3f (1, 0, 0); + QFGL_glColor3f (1, 0, 0); for (i = 0; i < 6; i++) { vec3_t v; - glBegin (GL_LINE_LOOP); + QFGL_glBegin (GL_LINE_LOOP); for (j = 0; j < 4; j++) { memcpy (v, &skyvec[i][j][2], sizeof (v)); VectorAdd (v, r_refdef.vieworg, v); - glVertex3fv (v); + QFGL_glVertex3fv (v); } - glEnd (); + QFGL_glEnd (); } } - glColor3ubv (lighthalf_v); - glEnable (GL_TEXTURE_2D); + QFGL_glColor3ubv (lighthalf_v); + QFGL_glEnable (GL_TEXTURE_2D); #endif } diff --git a/libs/video/renderer/gl/gl_textures.c b/libs/video/renderer/gl/gl_textures.c index 2d64f36a4..6d43c9114 100644 --- a/libs/video/renderer/gl/gl_textures.c +++ b/libs/video/renderer/gl/gl_textures.c @@ -48,8 +48,13 @@ #include "QF/sys.h" #include "QF/vid.h" -#include "glquake.h" #include "sbar.h" +#include "r_cvar.h" + +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" +#include "QF/GL/qf_textures.h" +#include "QF/GL/qf_vid.h" extern int gl_filter_min, gl_filter_max; extern unsigned char d_15to8table[65536]; @@ -208,10 +213,10 @@ GL_TextureMode_f (void) // change all the existing mipmap texture objects for (i = 0, glt = gltextures; i < numgltextures; i++, glt++) { if (glt->mipmap) { - glBindTexture (GL_TEXTURE_2D, glt->texnum); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + QFGL_glBindTexture (GL_TEXTURE_2D, glt->texnum); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); } } @@ -390,7 +395,7 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap, scaled_height); } - glTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0, + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled); if (mipmap) { @@ -403,20 +408,20 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap, scaled_width = max (scaled_width, 1); scaled_height = max (scaled_height, 1); miplevel++; - glTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width, + QFGL_glTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled); } } if (mipmap) { - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); } else { - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); if (gl_picmip->int_val) - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); else - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); } free (scaled); @@ -458,7 +463,7 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap, GL_Resample8BitTexture (data, width, height, scaled, scaled_width, scaled_height); } - glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width, + QFGL_glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width, scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled); if (mipmap) { @@ -472,21 +477,21 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap, scaled_width = max (scaled_width, 1); scaled_height = max (scaled_height, 1); miplevel++; - glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT, + QFGL_glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT, scaled_width, scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled); } } if (mipmap) { - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); } else { - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); if (gl_picmip->int_val) - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); else - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); } free (scaled); @@ -583,7 +588,7 @@ SetupTexture: glt->bytesperpixel = bytesperpixel; glt->mipmap = mipmap; - glBindTexture (GL_TEXTURE_2D, glt->texnum); + QFGL_glBindTexture (GL_TEXTURE_2D, glt->texnum); switch (glt->bytesperpixel) { case 1: diff --git a/libs/video/renderer/gl/gl_warp.c b/libs/video/renderer/gl/gl_warp.c index d1e87dec7..ec97bb9cd 100644 --- a/libs/video/renderer/gl/gl_warp.c +++ b/libs/video/renderer/gl/gl_warp.c @@ -33,8 +33,11 @@ #include "QF/cvar.h" #include "QF/sys.h" -#include "glquake.h" #include "r_shared.h" +#include "r_cvar.h" + +#include "QF/GL/defines.h" +#include "QF/GL/funcs.h" extern model_t *loadmodel; @@ -205,7 +208,7 @@ EmitWaterPolys (msurface_t *fa) vec3_t nv; for (p = fa->polys; p; p = p->next) { - glBegin (GL_POLYGON); + QFGL_glBegin (GL_POLYGON); for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) { os = v[3]; ot = v[4]; @@ -216,7 +219,7 @@ EmitWaterPolys (msurface_t *fa) t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255]; t *= (1.0 / 64); - glTexCoord2f (s, t); + QFGL_glTexCoord2f (s, t); VectorCopy (v, nv); nv[2] += r_waterripple->value @@ -224,8 +227,8 @@ EmitWaterPolys (msurface_t *fa) * turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255] * (1.0 / 64.0); - glVertex3fv (nv); + QFGL_glVertex3fv (nv); } - glEnd (); + QFGL_glEnd (); } } diff --git a/libs/video/renderer/r_cvar.c b/libs/video/renderer/r_cvar.c index dc1284d9d..f6e2eb1b8 100644 --- a/libs/video/renderer/r_cvar.c +++ b/libs/video/renderer/r_cvar.c @@ -62,6 +62,7 @@ cvar_t *gl_fb_models; cvar_t *gl_fires; cvar_t *gl_keeptjunctions; cvar_t *gl_lerp_anim; +cvar_t *gl_libgl; cvar_t *gl_lightmap_components; cvar_t *gl_max_size; cvar_t *gl_nocolors; @@ -72,6 +73,7 @@ cvar_t *gl_sky_clip; cvar_t *gl_skymultipass; cvar_t *gl_texsort; cvar_t *gl_triplebuffer; +cvar_t *gl_occlusion; cvar_t *r_aliasstats; cvar_t *r_aliastransadj; @@ -167,6 +169,8 @@ R_Init_Cvars (void) "upon level load"); gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, NULL, "Toggles model animation interpolation"); + gl_libgl = Cvar_Get ("gl_libgl", "libGL.so.1", CVAR_ROM, NULL, + "The GL library to use. (path optional)"); gl_lightmap_components = Cvar_Get ("gl_lightmap_components", "4", CVAR_ROM, NULL, "Lightmap texture components. 1 " "is greyscale, 3 is RGB, 4 is RGBA."); @@ -187,6 +191,8 @@ R_Init_Cvars (void) gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, NULL, "controls whether the skydome is single or " "double pass"); + gl_occlusion = Cvar_Get ("gl_occlusion", "0", CVAR_NONE, NULL, + "Toggles experimental alias model occlusion tests."); gl_texsort = Cvar_Get ("gl_texsort", "1", CVAR_NONE, NULL, "None"); gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, NULL, "Set to 1 by default. Fixes status bar " diff --git a/libs/video/targets/Makefile.am b/libs/video/targets/Makefile.am index b8138d8e8..df2d8e748 100644 --- a/libs/video/targets/Makefile.am +++ b/libs/video/targets/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES= -I$(top_srcdir)/include $(GGI_CFLAGS) $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS) +INCLUDES= -I$(top_srcdir)/include $(GGI_CFLAGS) $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(TDFXGL_CFLAGS) lib_LTLIBRARIES = @VID_TARGETS@ EXTRA_LTLIBRARIES = libQFjs.la libQFfbdev.la libQFsvga.la libQFx11.la libQFglx.la libQFsdl.la libQFsgl.la libQFtdfx.la libQFwgl.la libQFmgl.la @@ -44,7 +44,7 @@ fbset_modes_y.lo: $(srcdir)/fbset_modes_y.c fbset_modes_l.lo: $(srcdir)/fbset_modes_l.c $(LTCOMPILE) -Wno-error -c $< -libQFglx_la_LDFLAGS= -version-info 1:0:0 $(GLX_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) +libQFglx_la_LDFLAGS= -version-info 1:0:0 $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) libQFglx_la_SOURCES= in_common.c in_x11.c vid.c context_x11.c dga_check.c \ qfgl_ext.c vid_common_gl.c vid_glx.c libQFglx.la: $(libQFglx_la_OBJECTS) $(libQFglx_la_DEPENDENCIES) diff --git a/libs/video/targets/qfgl_ext.c b/libs/video/targets/qfgl_ext.c index d142084a3..51436e283 100644 --- a/libs/video/targets/qfgl_ext.c +++ b/libs/video/targets/qfgl_ext.c @@ -45,14 +45,6 @@ # include "winquake.h" #endif -#include - -#ifdef HAVE_GL_GLX_H -# include -#endif -#ifdef HAVE_GL_GLEXT_H -# include -#endif #ifdef HAVE_WINDOWS_H # include #endif @@ -66,7 +58,8 @@ #include "QF/qtypes.h" -#include "qfgl_ext.h" +#include "QF/GL/qf_ext.h" +#include "QF/GL/funcs.h" /* ParseExtensionList @@ -105,7 +98,7 @@ QFGL_ExtensionPresent (const char *name) static const GLubyte *gl_extensions = NULL; if (!gl_extensions) { // get and save GL extension list - gl_extensions = glGetString (GL_EXTENSIONS); + gl_extensions = QFGL_glGetString (GL_EXTENSIONS); } return QFGL_ParseExtensionList (gl_extensions, name); diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index f7d7e7e35..91903d2d7 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -38,7 +38,6 @@ # include #endif -#include #include #include #include @@ -144,7 +143,7 @@ GL_Init (void) void GL_EndRendering (void) { - glFlush (); + QFGL_glFlush (); fxMesaSwapBuffers (); Sbar_Changed (); } diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index ab8819dcc..a9122eab6 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -30,6 +30,9 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#ifdef HAVE_MATH_H +# include +#endif #ifdef HAVE_STRING_H # include #endif @@ -42,18 +45,19 @@ # include "winquake.h" #endif -#include - #include "compat.h" #include "QF/console.h" #include "QF/cvar.h" #include "QF/input.h" #include "QF/qargs.h" -#include "qfgl_ext.h" #include "QF/vfs.h" #include "QF/vid.h" +#include "QF/sys.h" + +#include "QF/GL/qf_ext.h" +#include "QF/GL/funcs.h" +#include "QF/GL/defines.h" -#include "glquake.h" #include "sbar.h" #define WARP_WIDTH 320 @@ -65,6 +69,7 @@ unsigned char d_15to8table[65536]; cvar_t *vid_mode; cvar_t *gl_multitexture; extern byte gammatable[256]; +extern qboolean GLF_Init (); QF_glActiveTextureARB qglActiveTexture = NULL; QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL; @@ -116,7 +121,7 @@ CheckMultiTextureExtensions (void) int max_texture_units = 0; - glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units); + QFGL_glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units); if (max_texture_units >= 2) { Con_Printf ("enabled, %d TMUs.\n", max_texture_units); qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB"); @@ -221,36 +226,41 @@ GL_Init_Common (void) { GL_Common_Init_Cvars (); - gl_vendor = glGetString (GL_VENDOR); + if (!GLF_Init()) { + Sys_Error("Can't init video.\n"); + return; + } + + gl_vendor = QFGL_glGetString (GL_VENDOR); Con_Printf ("GL_VENDOR: %s\n", gl_vendor); - gl_renderer = glGetString (GL_RENDERER); + gl_renderer = QFGL_glGetString (GL_RENDERER); Con_Printf ("GL_RENDERER: %s\n", gl_renderer); - gl_version = glGetString (GL_VERSION); + gl_version = QFGL_glGetString (GL_VERSION); Con_Printf ("GL_VERSION: %s\n", gl_version); - gl_extensions = glGetString (GL_EXTENSIONS); + gl_extensions = QFGL_glGetString (GL_EXTENSIONS); Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions); - glClearColor (0, 0, 0, 0); - glCullFace (GL_FRONT); - glEnable (GL_TEXTURE_2D); + QFGL_glClearColor (0, 0, 0, 0); + QFGL_glCullFace (GL_FRONT); + QFGL_glEnable (GL_TEXTURE_2D); - glEnable (GL_ALPHA_TEST); - glAlphaFunc (GL_GREATER, 0.666); + QFGL_glEnable (GL_ALPHA_TEST); + QFGL_glAlphaFunc (GL_GREATER, 0.666); - glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); + QFGL_glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); - glShadeModel (GL_FLAT); + QFGL_glShadeModel (GL_FLAT); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glEnable (GL_BLEND); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + QFGL_glEnable (GL_BLEND); + QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); CheckMultiTextureExtensions (); } @@ -305,7 +315,7 @@ Tdfx_Init8bitPalette (void) table[i][3] = 255; oldpal++; } - glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); + QFGL_glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); qgl3DfxSetPaletteEXT ((GLuint *) table); is8bit = true; } else { @@ -341,7 +351,7 @@ Shared_Init8bitPalette (void) Con_Printf ("GL_EXT_shared_texture_palette\n"); - glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); + QFGL_glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx; newPalette = thePalette; for (i = 0; i < 256; i++) { diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 94a6afe0d..e7e62867f 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -37,8 +37,7 @@ # include #endif -#include - +#include #include #include @@ -46,6 +45,8 @@ # include #endif +#include + #include "QF/cmd.h" #include "compat.h" #include "QF/console.h" @@ -54,15 +55,38 @@ #include "QF/qendian.h" #include "QF/va.h" #include "QF/vid.h" +#include "QF/GL/funcs.h" +#include "QF/sys.h" #include "context_x11.h" -#include "glquake.h" #include "sbar.h" +#include "QF/cvar.h" +#include "r_cvar.h" #define WARP_WIDTH 320 #define WARP_HEIGHT 200 +/* +** GLXContext is a pointer to opaque data. +*/ +typedef struct __GLXcontextRec *GLXContext; + +#define GLX_RGBA 4 /* true if RGBA mode */ +#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ +#define GLX_RED_SIZE 8 /* number of red component bits */ +#define GLX_GREEN_SIZE 9 /* number of green component bits */ +#define GLX_BLUE_SIZE 10 /* number of blue component bits */ +#define GLX_DEPTH_SIZE 12 /* number of depth bits */ + static GLXContext ctx = NULL; +typedef XID GLXDrawable; + +void (* QFGLX_glXSwapBuffers) (Display *dpy, GLXDrawable drawable); +XVisualInfo* (* QFGLX_glXChooseVisual) (Display *dpy, int screen, int *attribList); +GLXContext (* QFGLX_glXCreateContext) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); +Bool (* QFGLX_glXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx); + + extern void GL_Init_Common (void); extern void VID_Init8bitPalette (void); @@ -73,6 +97,7 @@ const char *gl_vendor; const char *gl_renderer; const char *gl_version; const char *gl_extensions; +void *libgl_handle; void VID_Shutdown (void) @@ -123,8 +148,8 @@ GL_Init (void) void GL_EndRendering (void) { - glFlush (); - glXSwapBuffers (x_disp, x_win); + QFGL_glFlush (); + QFGLX_glXSwapBuffers (x_disp, x_win); Sbar_Changed (); } @@ -147,6 +172,36 @@ VID_Init (unsigned char *palette) None }; + libgl_handle = dlopen (gl_libgl->string, RTLD_NOW); + if (!libgl_handle) { + Con_Printf("Can't open libgl %s: %s\n", gl_libgl->string, dlerror()); + return; + } + + QFGLX_glXSwapBuffers = dlsym(libgl_handle, "glXSwapBuffers"); + if (!QFGLX_glXSwapBuffers) { + Sys_Error(va("Can't load symbol glXSwapBuffers: %s\n", dlerror())); + return; + } + + QFGLX_glXChooseVisual = dlsym(libgl_handle, "glXChooseVisual"); + if (!QFGLX_glXChooseVisual) { + Sys_Error(va("Can't load symbol glXChooseVisual: %s\n", dlerror())); + return; + } + + QFGLX_glXCreateContext = dlsym(libgl_handle, "glXCreateContext"); + if (!QFGLX_glXCreateContext) { + Sys_Error(va("Can't load symbol glXCreateContext: %s\n", dlerror())); + return; + } + + QFGLX_glXMakeCurrent = dlsym(libgl_handle, "glXMakeCurrent"); + if (!QFGLX_glXMakeCurrent) { + Sys_Error(va("Can't load symbol glXMakeCurrent: %s\n", dlerror())); + return; + } + Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the quake window in a virtual desktop.\n"); VID_GetWindowSize (640, 480); @@ -179,7 +234,7 @@ VID_Init (unsigned char *palette) X11_OpenDisplay (); - x_visinfo = glXChooseVisual (x_disp, x_screen, attrib); + x_visinfo = QFGLX_glXChooseVisual (x_disp, x_screen, attrib); if (!x_visinfo) { fprintf (stderr, "Error couldn't get an RGB, Double-buffered, Depth visual\n"); @@ -196,9 +251,9 @@ VID_Init (unsigned char *palette) XSync (x_disp, 0); - ctx = glXCreateContext (x_disp, x_visinfo, NULL, True); + ctx = QFGLX_glXCreateContext (x_disp, x_visinfo, NULL, True); - glXMakeCurrent (x_disp, x_win, ctx); + QFGLX_glXMakeCurrent (x_disp, x_win, ctx); vid.height = vid.conheight = min (vid.conheight, scr_height); vid.width = vid.conwidth = min (vid.conwidth, scr_width); diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index ec2b8cbe1..936d574a7 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -142,7 +142,7 @@ GL_Init (void) void GL_EndRendering (void) { - glFlush (); + QFGL_glFlush (); SDL_GL_SwapBuffers (); Sbar_Changed (); } diff --git a/nq/source/.gitignore b/nq/source/.gitignore index cad3ff0c4..08853232e 100644 --- a/nq/source/.gitignore +++ b/nq/source/.gitignore @@ -2,6 +2,8 @@ *.d *.o *.obj +*.lo +*.la .deps .libs .vimrc diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index 5eb99a50e..2855e41c6 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -87,10 +87,6 @@ server_SOURCES= host.c host_cmd.c pr_cmds.c sv_cvar.c sv_main.c \ combined_SOURCES= $(common_SOURCES) $(client_SOURCES) $(server_SOURCES) \ $(qfsys_SRC) -if BUILD_GL -AM_CFLAGS = $(GLX_CFLAGS) -endif - # Software-rendering targets # # ... Common stuff @@ -139,19 +135,19 @@ nq_3dfx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/mo # ... OpenGL in X Window nq_glx_SOURCES= $(combined_SOURCES) $(ogl_SOURCES) -nq_glx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIBS) $(GLX_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(DL_LIBS) +nq_glx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) $(DL_LIBS) nq_glx_LDFLAGS= $(common_ldflags) nq_glx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIB_DEPS) # ... Simple Directmedia Layer, version 1.1 and higher, in GL mode nq_sgl_SOURCES= $(combined_SOURCES) $(ogl_SOURCES) -nq_sgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIBS) $(X_LIBS) $(SDL_LIBS) $(GLX_LIBS) $(DL_LIBS) +nq_sgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIBS) $(X_LIBS) $(SDL_LIBS) $(DL_LIBS) nq_sgl_LDFLAGS= $(common_ldflags) nq_sgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIB_DEPS) # ... SGI/Microsoft WGL (Windows OpenGL) nq_wgl_SOURCES= $(combined_SOURCES) $(ogl_SOURCES) conproc.c -nq_wgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIBS) $(GLX_LIBS) -lgdi32 -lcomctl32 -lwinmm +nq_wgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIBS) -lgdi32 -lcomctl32 -lwinmm nq_wgl_LDFLAGS= $(common_ldflags) nq_wgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIB_DEPS) diff --git a/nq/source/gl_view.c b/nq/source/gl_view.c index f34be9b73..cab692285 100644 --- a/nq/source/gl_view.c +++ b/nq/source/gl_view.c @@ -43,8 +43,8 @@ #include "QF/info.h" #include "client.h" -#include "glquake.h" #include "view.h" +#include "r_cvar.h" extern double host_frametime; diff --git a/nq/source/sbar.c b/nq/source/sbar.c index 6c9b68311..f1ba03362 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -781,7 +781,6 @@ Sbar_DrawNormal (void) // armor if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) { Sbar_DrawNum (24, 0, 666, 3, 1); - Sbar_DrawPic (0, 0, draw_disc); } else { // FIXME: MISSIONHUD // if (rogue) { diff --git a/qw/source/.gitignore b/qw/source/.gitignore index 6d9bc945c..f83eaaeb1 100644 --- a/qw/source/.gitignore +++ b/qw/source/.gitignore @@ -4,6 +4,8 @@ *.o *.obj *.s +*.lo +*.la .deps .libs .vimrc diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index 135040f1b..4184e3396 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -111,10 +111,6 @@ client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \ r_view.c sbar.c skin.c teamplay.c \ $(syscl_SRC) -if BUILD_GL -AM_CFLAGS = $(GLX_CFLAGS) -endif - # Software-rendering clients # # ... Common stuff @@ -165,19 +161,19 @@ qw_client_3dfx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../ # ... OpenGL in X Window qw_client_glx_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) -qw_client_glx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIBS) $(GLX_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(DL_LIBS) +qw_client_glx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) $(DL_LIBS) qw_client_glx_LDFLAGS= $(common_ldflags) qw_client_glx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIB_DEPS) # ... Simple DirectMedia Layer, version 1.1 and higher, in GL mode qw_client_sgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) -qw_client_sgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIBS) $(SDL_LIBS) $(X_LIBS) $(GLX_LIBS) $(DL_LIBS) +qw_client_sgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIBS) $(SDL_LIBS) $(X_LIBS) $(DL_LIBS) qw_client_sgl_LDFLAGS= $(common_ldflags) qw_client_sgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIB_DEPS) # ... SGI/Microsoft WGL (Windows OpenGL) qw_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) -qw_client_wgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIBS) $(GLX_LIBS) -lgdi32 -lwinmm +qw_client_wgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIBS) -lgdi32 -lwinmm qw_client_wgl_LDFLAGS= $(common_ldflags) qw_client_wgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIB_DEPS) diff --git a/qw/source/gl_view.c b/qw/source/gl_view.c index f2bddf017..229791e52 100644 --- a/qw/source/gl_view.c +++ b/qw/source/gl_view.c @@ -44,8 +44,8 @@ #include "bothdefs.h" #include "client.h" -#include "glquake.h" #include "view.h" +#include "r_cvar.h" extern double host_frametime; diff --git a/qw/source/sbar.c b/qw/source/sbar.c index 60645c9f1..c615a8883 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -691,7 +691,6 @@ Sbar_DrawNormal (void) // armor if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) { Sbar_DrawNum (24, 0, 666, 3, 1); - Sbar_DrawPic (0, 0, draw_disc); } else { Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25); diff --git a/tools/qfgl_gen.pl b/tools/qfgl_gen.pl new file mode 100755 index 000000000..9e70ce1a0 --- /dev/null +++ b/tools/qfgl_gen.pl @@ -0,0 +1,77 @@ +#! /usr/bin/perl -w +use strict; + +&main(@ARGV); + +sub main () { + my ($input_file, $funcs_file, $header_file, $footer_file) = @_; + my (@input, @funcs, $funcs, @header, @footer, $line); + + if ($#ARGV != 3) { + die("Usage: $0