The Quake 2 Rendering Library written by Q2DP Version 0.3 of 18. March 1998 This document deals with is the Quake 2 rendering/refresh libraries, that is, it describes the basic architecture, the three main libraries known and the Glide/OpenGL/Mesa/minidriver requirements. It lists what is known about the API, the dependecies on other components of the Quake 2 architecture, and the way the Quake rendering engine basically works. ______________________________________________________________________ Table of Contents 1. Introduction 1.1 About the Quake 2 Documentation Project 2. Quake2 Graphics Refresh Architecture 2.1 The Ref Interface struct 2.2 Interface details 2.2.1 api_version 2.2.2 Init/Shutdown 2.2.3 Registration Functions 2.2.4 SetSky 2.2.5 Draw Functions 2.2.5.1 The 2D functions 2.2.5.2 DrawStretchRaw 2.2.6 Menu Functions 2.2.7 CinematicSetPalette 2.2.8 Rendering 2.2.8.1 BeginFrame 2.2.8.2 RenderFrame 2.2.8.3 EndFrame 2.2.9 AppActivate 2.3 Loading A Refresh 2.4 Managing Refreshs 2.5 Refresh Library Miscellaneous 2.5.1 Software Library 2.5.2 OpenGl Library 2.5.2.1 Status variable gl_driver 2.5.2.2 Status variable gl_3dlabs_broken 2.5.2.3 OpenGL EXTensions used 3. Linkage Information 3.1 Main Executable 3.2 Loading the Rendering DLL 3.3 OpenGL Rendering 3.3.1 Draw functions 3.3.2 Miscellaneous 3.3.3 GL Functions 3.3.4 Exporting Refresh functions 3.3.5 Memory allocation 3.3.6 Info functions 3.3.7 KBD functions 3.3.8 Mod functions 3.3.9 Game DLL Lookalikes 3.3.10 Refresh Module 3.3.11 System Interface 3.3.12 Interfacing X11 3.3.13 Mesa 3Dfx functions 3.3.14 Quake GL wrapper 3.3.15 OpenGL API 3.3.16 SVGAlib references 4. Misc. 4.1 Multitexture EXTension 4.1.1 Fake_glColorTableEXT 4.2 The Quake/Quake2 MiniGL 4.2.1 Primitives/Calls that work 4.2.2 Primitives/calls that do not work 4.2.3 Supported Functions ______________________________________________________________________ 1. Introduction This document deals with is the Quake 2 rendering/refresh libraries, that is, it describes the basic architecture, the three main libraries known and the Glide/OpenGL/Mesa/minidriver requirements. It lists what is known about the API, the dependecies on other components of the Quake 2 architecture, and the way the Quake rendering engine basically works. Most information in this document was gained about the Quake engine, which was described in articles, book chapter and public talks by Michael Abrash, in explanations by John Carmack, and in the fairly complete "Unofficial Quake Specs". Im some aspects, the "Quake 2" engine has changed a bit, but the overall approach to rendering is the same. The more recent information deals with the Linux port of "Quake 2", as I have yet to receive contribution regarding the Win32 release. The other UNIX ports should be very similar. 1.1. About the Quake 2 Documentation Project There is a top level document describing the Q2DP that is mandatory to be distributed along with this document, which is part of the Q2DP collection. See the Q2DP main document for all details on Authors and Contributors, Contacts, Corrections, Submissions, Trademarks and Acknowledgments, Distribution Policy and Copyright. If the top level document is missing, please contact the current maintainer of the Q2DP project, Bernd Kreimeier (bk@gamers.org), as soon as possible. You will find the most recent version of this document at www.gamers.org/dEngine/quake2/Q2DP/. See the ChangeLog for most recent changes to the Q2DP collection, and the Q2DP Supplement for the latest contributions and errata that have not yet been processed. We rely on you, the reader and fellow developer, to make this collection useful. If you have any suggestions, corrections, or comments, please send them to the current maintainer, Bernd Kreimeier (bk@gamers.org). For details please read the section on how to submit a contribution in the Q2DP main document. 2. Quake2 Graphics Refresh Architecture This description was published by Brian Hook, id Software, as of September 18, 1997. The information herein might not be accurate anymore. 2.1. The Ref Interface struct Quake2's rendering architecture is abstracted at a very high level, enabling different rendering subsystems, known as refreshes, to be implemented efficiently. Currently there are two refreshes implemented, ref_gl and ref_soft. Refreshes are implemented as Win32 DLLs, and are dynamically linked. The refreshes are interfaced to through a single structure containing function pointers, the refexport_t structure. The refexport_t struct is defined in client/ref.h, and looks like this: ______________________________________________________________________ typedef struct { int api_version; qboolean (*Init) ( void *hinstance, void *wndproc ); void (*Shutdown) (void); void (*BeginRegistration) (char *map); struct model_s *(*RegisterModel) (char *name); struct image_s *(*RegisterSkin) (char *name); struct image_s *(*RegisterPic) (char *name); void (*SetSky) (char *name, float rotate, vec3_t axis); void (*EndRegistration) (void); void (*RenderFrame) (refdef_t *fd); void (*DrawGetPicSize) (int *w, int *h, char *name); void (*DrawPic) (int x, int y, char *name); void (*DrawStretchPic) (int x, int y, int w, int h, char *name); void (*DrawChar) (int x, int y, int c); void (*DrawTileClear) (int x, int y, int w, int h, char *name); void (*DrawFill) (int x, int y, int w, int h, int c); void (*DrawFadeScreen) (void); void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, byte *data); void (*MenuDraw) (void); void (*MenuKey) (int key); /* ** video mode and refresh state management entry points */ void (*CinematicSetPalette)( const unsigned char *palette); // NULL = game palette void (*BeginFrame)( void ); void (*EndFrame) (void); void (*AppActivate)( qboolean activate ); } refexport_t; ______________________________________________________________________ 2.2. Interface details 2.2.1. api_version This variable specifies the API revision under which the ref was built. This value is checked by the client code when it loads the refresh to make sure that the DLL is not out of date. 2.2.2. Init/Shutdown These two routines are responsible for one-time initialization and shutdown of the refreshes. For example, ref_gl's Init function deals with creating the application window, initializing OpenGL, register cvars, and other one-time initialization functions. 2.2.3. Registration Functions These functions are responsible for object and map registration. BeginRegistration is called first and specifies what model (.BSP) is used as the world model. The other registration functions are used to load models, skins, and images. EndRegistration performs garbage collection, deleting any unused models, skins, or pics from the internal registry. ˇ BeginRegistration ˇ EndRegistration ˇ RegisterModel ˇ RegisterSkin ˇ RegisterPic 2.2.4. SetSky This routine specifies the image used for the sky box, the rotation speed in degrees/second, and the axis about which the sky is rotated. 2.2.5. Draw Functions 2.2.5.1. The 2D functions These Draw functions are used to handle all 2D rendering functions and are self-explanatory. ˇ DrawGetPicSize ˇ DrawPic ˇ DrawStretchPic ˇ DrawChar ˇ DrawTileClear ˇ DrawFill ˇ DrawFadeScreen 2.2.5.2. DrawStretchRaw This Draw function is used by the cinematics to render a stretched image to the desktop. 2.2.6. Menu Functions These two entry points are used to handle the video options menu interface. Each refresh is responsible for defining its own menu subsystem. ˇ MenuDraw ˇ MenuKey 2.2.7. CinematicSetPalette This is the palette setting routine that is used by the cinematics subsystem. 2.2.8. Rendering 2.2.8.1. BeginFrame This must be called once per frame before any rendering is performed. This allows a refresh to perform any necessary pre-rendering setup. 2.2.8.2. RenderFrame This does the majority of the work a refresh performs. RenderFrame accepts a refdef_t structure which contains all information necessary to render a scene, including the view position, view angles, field of view, screen dimensions, etc. Each refresh is responsible for implementing this in the most efficient and appropriate manner given their technology. 2.2.8.3. EndFrame This must be called once per frame after all rendering is performed. This allows a refresh to perform any necessary post-rendering operations, including buffer blits/swaps. 2.2.9. AppActivate When an application is activated or deactivated, the client WndProc takes the WM_ACTIVATE message and calls AppActivate as necessary. This allows the refresh to handle activation and deactivation cleanly. These currently do not do anything. 2.3. Loading A Refresh The function VID_LoadRefresh within win32/vid_dll.c is responsible for loading a refresh. The first thing it does is shut down and unload the current refresh, if one exists. It then loads the appropriate refresh DLL using the Win32 system call LoadLibrary, which returns a handle to the loaded library. The only function that needs to be fetched from the refresh is GetRefAPI, which accepts a refimport_t structure (used to communicate back to the client) and returns the refexport_t structure that the client will use for all rendering. After retrieving the refexport_t struct, the client verifies that refresh's API version matches the client's expected API version. If they do match, then the client initializes the refresh by passing the application's hInstance and the application's WndProc. These are necessary since the refresh is responsible for creating and destroying the application's window. 2.4. Managing Refreshs Refs are loaded whenever the vid_ref cvar is changed. Whatever value vid_ref is set to is automatically prepended with 'ref_' before loading. For example, The function VID_CheckChanges within the file win32/vid_dll.c contains the logic associated with detecting a change in refresh and handling things appropriately. The current refresh can be restarted by simply issuing the vid_restart command. Choice of fullscreen vs. windowed rendering is controlled by the vid_fullscreen variable. It can be toggled manually at the console, or it can be toggled by using the Alt-Enter key combination. The position of a window's upper left corner is controlled by the variables vid_xpos and vid_ypos. 2.5. Refresh Library Miscellaneous 2.5.1. Software Library ref_soft.dll only uses GDI's DIB section interface when rendering to a window, and only uses DirectDraw when rendering in a fullscreen mode. The sw_allow_modex variable controls whether ModeX modes are used. The logic within ref_soft will select linear 320x240 modes before selecting ModeX modes; there is currently no capability to force a preference of ModeX over linear modes. In theory, ref_soft should work with any incarnation of DirectDraw (GameSDK through DX5). The current video mode used by the software refresh is determined by the value of sw_mode. Both ref_soft and ref_gl use the same list of modes. Only modes with a 1:1 aspect ratio are supported. ______________________________________________________________________ 0 - 320x240 1 - 400x300 2 - 512x384 3 - 640x480 4 - 800x600 5 - 960x720 6 - 1024x768 7 - 1152x864 8 - 1280x960 9 - 1600x1200 ______________________________________________________________________ 2.5.2. OpenGl Library 2.5.2.1. Status variable gl_driver This variable determines which OpenGL driver is loaded by the GL refresh. The default value is 'opengl32' and will thus use the default OpenGL driver installed on a system. Other reasonable values might be '3dfxgl' or 'pvrgl'. 2.5.2.2. Status variable gl_3dlabs_broken Because of issues with the current set of drivers that 3Dlabs is shipping, we've implemented a variable that informs the ref_gl that any installed 3Dlabs drivers do not work correctly. By default this variable is '1'. Note that other drivers, including MCD, ICD, or mini- GL drivers. This particular variable will prevent the toggling of fullscreen/windowed when running on a 3Dlabs driver. If 3Dlabs ships a working driver, a user can manually clear this variable and the ability to toggle between fullscreen and windowed modes will be available. 2.5.2.3. OpenGL EXTensions used ˇ wglGet/SetDeviceGammaRamp for screen flashes. This will help level performance, especially during death matches. This will be an extension that only makes sense for some hardware. It should help a lot with anyone with a full GDI/Win32/3D accelerator, and it will also help with 3Dfx. ˇ glColorTableEXT revved up and/or extended to support a single global texture palette. This will allow us to use 8-bit paletted textures on hardware that supports paletted textures, including 3Dfx, Permedia2, and some others. This gives us faster texture download performance (good for deathmatch), and this may make a pretty significant difference in performance for Permedia2. ˇ wglSwapIntervalEXT so that we can control frame rate very tightly. ˇ EXT_point_parameters for particle rendering. This will probably only make a big difference for deathmatch performance, but it should be a reasonable performance boost across the board. ˇ multitexture support. This one is important for Voodoo2, was previously ranked at a low priority. All of these extensions will be optional. 3. Linkage Information 3.1. Main Executable The dynamic linkage information from the main engine, which was stripped, just gives dependencies on libc and other system libraries. ______________________________________________________________________ 080925a4 A _DYNAMIC 08092424 A _GLOBAL_OFFSET_TABLE_ 080926a0 B _IO_stderr_ 08092648 B _IO_stdout_ U __assert_fail [...] U vsprintf ______________________________________________________________________ The executable has been stripped, and no other function names are available. 3.2. Loading the Rendering DLL Judging from the string information left in the main engine, the basic sequence is as such: 1. LoadLibrary is called 2. GetRefAPI is called and assigns RW_IN functions ˇ RW_IN_Init ˇ RW_IN_Shutdown ˇ RW_IN_Activate ˇ RW_IN_Commands ˇ RW_IN_Move ˇ RW_IN_Frame 3. GetRefAPI is called and assigns KBD functions ˇ KBD_Init ˇ KBD_Update ˇ KBD_Close There is a couple of variables involved supposedly set immediately after this during initialization: ˇ sw_mode ˇ vid_ref ˇ DISPLAY ˇ vid_xpos ˇ vid_ypos ˇ vid_fullscreen ˇ vid_gamma ˇ vid_restart 3.3. OpenGL Rendering This list dynamic linkage information from ref_gl.so. Again, libc and other system dependencies are omitted. 3.3.1. Draw functions In analogy to DOOM, this is the actual refresh/draw module interface. ______________________________________________________________________ 0001fea4 T DrawGLPoly 00020098 T DrawGLPolyChain 00023ec8 T DrawSkyPolygon 00020dbc T DrawTextureChains 0000ee60 T Draw_Char 0000f85c T Draw_FadeScreen 0000f6c4 T Draw_Fill 0000efd8 T Draw_FindPic 00013ea8 T Draw_GetPalette 0000f034 T Draw_GetPicSize 0000edf8 T Draw_InitLocal 0000f2a4 T Draw_Pic 0000f0c0 T Draw_StretchPic 0000f984 T Draw_StretchRaw 0000f49c T Draw_TileClear ______________________________________________________________________ 3.3.2. Miscellaneous I am not sure where these belong. ______________________________________________________________________ 0003bd00 A _DYNAMIC 0003a734 A _GLOBAL_OFFSET_TABLE_ 00023104 T BoundPoly 00019204 T CalcSurfaceExtents 00024258 T ClipSkyPolygon 00023d04 T EmitWaterPolys 000311f0 T FloatNoSwap 000311b0 T FloatSwap 00010814 T LoadPCX 00010a0c T LoadTGA 000311a8 T LongNoSwap 00031168 T LongSwap 0002492c T MakeSkyVec 000189cc T RadiusFromBounds 00014880 T RecursiveLightPoint 000104e8 T Scrap_AllocBlock 0001077c T Scrap_Upload 00031160 T ShortNoSwap 00031144 T ShortSwap 0001c7e4 T SignbitsForPlane 00023344 T SubdividePolygon 000311f8 T Swap_Init 000307ec T anglemod 00088dac B base_textureid 000e9f88 B bigendien 000e9350 B c_alias_polys 000e98fc B c_brush_polys 000e9998 B c_sky 000e9918 B c_visible_lightmaps 000e9910 B c_visible_textures 000e9f8c B com_token 000ea00c B corners 000ea02c B curhunksize 000e92cc B currententity 000e9290 B currentmodel 000889a4 B d_8to24table 0003a19c D dottexture 0005998c B draw_chars 000e923c B frustum ______________________________________________________________________ ______________________________________________________________________ 000e9f7c B i 00088da4 B intensity 000891bc B lightplane 000891b0 B lightspot 000e91f8 B loadmodel 000ea028 B maxhunksize 000ea030 B membase 000359b8 D modes 000ba1f0 B modfilelen 00078990 B numgltextures 000e9f6c B paged_total 000891c0 B pointcolor 000e91f4 B registration_sequence 000e9874 B ri 00088db0 B scrap_allocated 00078994 B scrap_dirty 0007899c B scrap_texels 00088da8 B scrap_uploads 0003a198 D shadedots 000891d0 B shadelight 000891dc B shadevector 000e999c B sky_images 000e991c B sky_max 000e9920 B sky_min 000e99e8 B skyaxis 0003a5dc D skyclip 000e99b8 B skymaxs 000e9968 B skymins 000e9924 B skyname 000e99b4 B skyrotate 0003a6b4 D skytexorder 0003a624 D st_to_vec 00031ce8 T strlwr 0003a6cc D suf 000889a0 B upload_height 0008899c B upload_width 00078998 B uploaded_paletted 000e92d8 B v_blend 000312f4 T va 0003a718 D vec3_origin 0003a66c D vec_to_st 000e9378 B vid 000e928c B vid_fullscreen 000e92d4 B vid_gamma 000e9864 B vid_ref 000e98d0 B vpn 000e935c B vright 000e97c8 B vup 000e9964 B warpface ______________________________________________________________________ 3.3.3. GL Functions This is the Quake 2 Graphic Library, it is not OpenGL, but the renderer built on top of an OpenGL-like API. ______________________________________________________________________ 00022e28 T GL_BeginBuildingLightmaps 000100e8 T GL_Bind 00011d8c T GL_BuildPalettedTexture 000227e8 T GL_BuildPolygonFromSurface 000229fc T GL_CreateSurfaceLightmap 00016964 T GL_DrawAliasFrameLerp 00017028 T GL_DrawAliasShadow 0001c234 T GL_DrawParticles 0000ffa4 T GL_EnableMultitexture 000230e4 T GL_EndBuildingLightmaps 00013bd8 T GL_FindImage 00013e1c T GL_FreeUnusedImages 00010384 T GL_ImageList_f 00013fe0 T GL_InitImages 00016570 T GL_LerpVerts 0001188c T GL_LightScaleTexture 000134f8 T GL_LoadPic 00013b20 T GL_LoadWal 0001014c T GL_MBind 00011c78 T GL_MipMap 000114dc T GL_ResampleTexture 0001f8d4 T GL_ScreenShot_f 00010018 T GL_SelectTexture 0001fb7c T GL_SetDefaultState 0000fe7c T GL_SetTexturePalette 000143b0 T GL_ShutdownImages 0001fafc T GL_Strings_f 00023c14 T GL_SubdivideSurface 0001006c T GL_TexEnv 0001021c T GL_TextureMode 0001fe08 T GL_UpdateSwapInterval 00012028 T GL_Upload32 00013318 T GL_Upload8 0002f594 T GLimp_AppActivate 0002f574 T GLimp_BeginFrame 00027984 T GLimp_EnableLogging 0002f578 T GLimp_EndFrame 0002f504 T GLimp_Init 00029ee4 T GLimp_LogNewFrame 0002f2c8 T GLimp_SetMode 0002f4d8 T GLimp_Shutdown ______________________________________________________________________ Related functions would be ______________________________________________________________________ 0002f598 T Fake_glColorTableEXT 0001ccdc T MYgluPerspective 00025f0c T QGL_Init 00024f3c T QGL_Shutdown 000e9b78 B dllAreTexturesResident 000e9ecc B dllGenLists 000e9a68 B dllGetError 000e9eb0 B dllGetString 000e9f08 B dllIsEnabled 000e9f00 B dllIsList 000e9c34 B dllIsTexture 000e9be0 B dllRenderMode ______________________________________________________________________ The following are supposedly wrapper to access EXTensions, or, if not available, emulate them. They are also related to GL based special effects, and to handle vendor specific problems (lack of colored lighting, wgl gamma EXTension). ______________________________________________________________________ 000e9208 B gl_3dfx_no_gamma 000e92c4 B gl_3dlabs_broken 000e9238 B gl_allow_software 000359a4 D gl_alpha_format 000e9870 B gl_bitdepth 000e97dc B gl_clear 000e98e4 B gl_config 000e9230 B gl_cull 000e934c B gl_drawbuffer 000e98b4 B gl_driver 000e9348 B gl_dynamic 000e9368 B gl_ext_gamma 000e9344 B gl_ext_multitexture 000e9900 B gl_ext_palettedtexture 000e98e0 B gl_ext_pointparameters 000e98b8 B gl_ext_swapinterval 000359ac D gl_filter_max 000359a8 D gl_filter_min 000e98c4 B gl_finish 000e92f0 B gl_flashblend 000e922c B gl_lightmap 000e9214 B gl_lockpvs 000e97d8 B gl_log 000e92c8 B gl_mode 000e9294 B gl_modulate 000e933c B gl_monolightmap 000e92d0 B gl_nobind 000e9298 B gl_nosubimage 000e936c B gl_particle_att_a 000e98cc B gl_particle_att_b 000e9868 B gl_particle_att_c 000e9228 B gl_particle_max_size 000e92e8 B gl_particle_min_size 000e9354 B gl_particle_size 000e9358 B gl_picmip 000e921c B gl_playermip 000e9224 B gl_polyblend 000e9338 B gl_round_down 000e920c B gl_saturatelighting 000e98bc B gl_shadows 000e98c0 B gl_showtris 000e92f4 B gl_skymip 000359a0 D gl_solid_format 000e929c B gl_state 000e9340 B gl_swapinterval 000e97d4 B gl_texturemode 000e9380 B gl_ztrick 000e97ec B gldepthmax 000e9908 B gldepthmin 0003208c T glob_match 00059990 B gltextures ______________________________________________________________________ 3.3.4. Exporting Refresh functions For the main executable to interface to the rendering library, a mechanism similar to GetGameApi is used. ______________________________________________________________________ 0001f4d8 T GetRefAPI ______________________________________________________________________ 3.3.5. Memory allocation This is possibly the Q2 internal zone memory allocation interface. ______________________________________________________________________ 00031b00 T Hunk_Alloc 00031a84 T Hunk_Begin 00031b5c T Hunk_End 00031bd8 T Hunk_Free ______________________________________________________________________ 3.3.6. Info functions ______________________________________________________________________ 000316d4 T Info_RemoveKey 000317d8 T Info_SetValueForKey 00031788 T Info_Validate 00031608 T Info_ValueForKey ______________________________________________________________________ 3.3.7. KBD functions ______________________________________________________________________ 0002fa08 T KBD_Close 0002f694 T KBD_Init 0002f9ec T KBD_Update ______________________________________________________________________ and ______________________________________________________________________ 000e9f68 B Key_Event_fp ______________________________________________________________________ 3.3.8. Mod functions Handles PVS, BSP, Models, textures etc. ______________________________________________________________________ 00018130 T Mod_ClusterPVS 00018038 T Mod_DecompressVis 0001831c T Mod_ForName 0001b690 T Mod_Free 0001b6c4 T Mod_FreeAll 000182f4 T Mod_Init 0001ad58 T Mod_LoadAliasModel 0001a22c T Mod_LoadBrushModel 00018cbc T Mod_LoadEdges 0001944c T Mod_LoadFaces 000199bc T Mod_LoadLeafs 000185a0 T Mod_LoadLighting 00019bb0 T Mod_LoadMarksurfaces 000196f8 T Mod_LoadNodes 00019ef8 T Mod_LoadPlanes 0001b2bc T Mod_LoadSpriteModel 00018a64 T Mod_LoadSubmodels 00019d78 T Mod_LoadSurfedges 00018e6c T Mod_LoadTexinfo 0001870c T Mod_LoadVertexes 00018604 T Mod_LoadVisibility 00018240 T Mod_Modellist_f 00017fac T Mod_PointInLeaf 000196c0 T Mod_SetParent ______________________________________________________________________ ______________________________________________________________________ 000ba1ec B mod_base 000ba1f4 B mod_inline 000891e8 B mod_known 000b81ec B mod_novis 000b81e8 B mod_numknown ______________________________________________________________________ 3.3.9. Game DLL Lookalikes It is save to assume that the actual refresh library/main engine was compiled against parts of the GameDLL, or source duplicates. ______________________________________________________________________ 00030bd0 T AddPointToBounds 0003023c T AngleVectors 000310fc T BigFloat 000310b4 T BigLong 0003106c T BigShort 000e9f78 B _BigFloat 000e9f80 B _BigLong 000e9f70 B _BigShort 00030958 T BoxOnPlaneSide 00030848 T BoxOnPlaneSide2 00030b98 T ClearBounds 00031014 T COM_DefaultExtension 00030f48 T COM_FileBase 00030ef4 T COM_FileExtension 00030fc0 T COM_FilePath 00031320 T COM_Parse 00030eb0 T COM_SkipPath 00030ed0 T COM_StripExtension 000313f4 T Com_PageInMemory 0001f648 T Com_Printf 00031598 T Com_sprintf 00030df8 T CrossProduct 00030d6c T _DotProduct 00030788 T LerpAngle 00031120 T LittleFloat 000310d8 T LittleLong 00031090 T LittleShort 000ea024 B _LittleFloat 000e9f74 B _LittleLong 000e9f84 B _LittleShort 0003042c T PerpendicularVector 000303b4 T ProjectPointOnPlane 00030770 T Q_fabs 00030ea0 T Q_log2 0003153c T Q_strcasecmp 000314bc T Q_stricmp 000314e0 T Q_strncasecmp 0003000c T RotatePointAroundVector 00030c54 T VectorCompare 00030e60 T VectorInverse 00030e34 T VectorLength 00030d3c T VectorMA 00030ca0 T VectorNormalize 00030cec T VectorNormalize2 00030e7c T VectorScale 00030db4 T _VectorAdd 00030ddc T _VectorCopy 00030d8c T _VectorSubtract RW Functions

0002ff3c T RW_IN_Activate 0002fc3c T RW_IN_Commands 0002ff38 T RW_IN_Frame 0002fa1c T RW_IN_Init 0002fd24 T RW_IN_Move 0002fc28 T RW_IN_Shutdown ______________________________________________________________________ 3.3.10. Refresh Module ______________________________________________________________________ 00014e80 T R_AddDynamicLights 000247cc T R_AddSkySurface 0001eb04 T R_BeginFrame 0001b47c T R_BeginRegistration 000201d4 T R_BlendLightmaps 00015354 T R_BuildLightMap 0001d240 T R_Clear 00024860 T R_ClearSkyBox 0003054c T R_ConcatRotations 00030634 T R_ConcatTransforms 0001b72c T R_CullBox 000177a8 T R_DrawAliasModel 00020c04 T R_DrawAlphaSurfaces 0001f060 T R_DrawBeam 00021964 T R_DrawBrushModel 0001c07c T R_DrawEntitiesOnList 00021734 T R_DrawInlineBModel 0001bbec T R_DrawNullModel 0001c4a8 T R_DrawParticles 00024ab8 T R_DrawSkyBox 0001b8d0 T R_DrawSpriteModel 0001ff18 T R_DrawTriangleOutlines 00021fac T R_DrawWorld 0001b63c T R_EndRegistration 000111fc T R_FloodFillSkin 0001e51c T R_Init 0001f698 T R_InitParticleTexture 00014cdc T R_LightPoint 00022174 T R_MarkLeaves 000146ec T R_MarkLights 0001c63c T R_PolyBlend 000147f4 T R_PushDlights 00021c38 T R_RecursiveWorldNode 0001dc48 T R_Register 0001b538 T R_RegisterModel 00013dfc T R_RegisterSkin 0002088c T R_RenderBrushPoly 00014410 T R_RenderDlight 000145dc T R_RenderDlights 0001dbac T R_RenderFrame 0001d378 T R_RenderView 0001b84c T R_RotateForEntity 00015310 T R_SetCacheState 0001c82c T R_SetFrustum 0001d4dc T R_SetGL2D 0001db24 T R_SetLightLevel 0001e2bc T R_SetMode 0001ee4c T R_SetPalette 00024d70 T R_SetSky 0001ca60 T R_SetupFrame 0001cd80 T R_SetupGL 0001eaa4 T R_Shutdown 0001fe2c T R_TextureAnimation ______________________________________________________________________ ______________________________________________________________________ 000e9914 B r_alpha_surfaces 00036198 D r_avertexnormal_dots 00035a00 D r_avertexnormals 000e9388 B r_base_world_matrix 000891cc B r_dlightframecount 000e9204 B r_drawentities 000e9384 B r_drawworld 000e91fc B r_framecount 000e990c B r_fullbright 000e9234 B r_lefthand 000e9220 B r_lerpmodels 000e986c B r_lightlevel 000e97f0 B r_newrefdef 000e9200 B r_nocull 000e92ec B r_norefresh 000e9858 B r_notexture 000e98dc B r_novis 000e98c8 B r_oldviewcluster 000e9210 B r_oldviewcluster2 000e97e0 B r_origin 000e9218 B r_particletexture 000e93c8 B r_rawpalette 000e985c B r_speeds 0003a1dc D r_turbsin 000e9370 B r_viewcluster 000e9374 B r_viewcluster2 000e9904 B r_visframecount 000e92f8 B r_world_matrix 000e9860 B r_worldmodel ______________________________________________________________________ 3.3.11. System Interface ______________________________________________________________________ 0001f5f8 T Sys_Error 00032060 T Sys_FindClose 00031d18 T Sys_FindFirst 00031f08 T Sys_FindNext 00031c20 T Sys_Milliseconds 00031cc4 T Sys_Mkdir ______________________________________________________________________ 3.3.12. Interfacing X11 The Linux OpenGL refresh module does not use GLX. ______________________________________________________________________ U XFlush U XFree ______________________________________________________________________ 3.3.13. Mesa 3Dfx functions This creates the Mesa/X11 drivers context, and swap tzhe front/back buffer. ______________________________________________________________________ U gl3DfxSetPaletteEXT U fxMesaCreateContext U fxMesaDestroyContext U fxMesaMakeCurrent U fxMesaSwapBuffers ______________________________________________________________________ 3.3.14. Quake GL wrapper Due to the dynamic switching of rendering libraries, and to handle different headers from different vendors with different OpenGL revisions, there is a wrapper for every OpenGL function, e.g. ______________________________________________________________________ 000e9bc8 B qglAccum 000e9ec4 B qglAlphaFunc 000e9b24 B qglAreTexturesResident 000e9f18 B qglArrayElement ______________________________________________________________________ 3.3.15. OpenGL API Below is the list of references to OpenGL functions, as they have been visible at compile time. Only a subset is actually used. This should basically be the Mesa 2.6 implementation of the OpenGL 1.1 API. ______________________________________________________________________ glAccum glAlphaFunc glAreTexturesResident glArrayElement glBegin glBindTexture glBitmap glBlendFunc glCallList glCallLists glClear glClearAccum glClearColor glClearDepth glClearIndex glClearStencil glClipPlane glColor3/4 (several) glColorMask glColorMaterial glColorPointer glCopyPixels glCopyTexImage1D glCopyTexImage2D glCopyTexSubImage1D glCopyTexSubImage2D glCullFace glDeleteLists glDeleteTextures glDepthFunc glDepthMask glDepthRange glDisable glDisableClientState glDrawArrays glDrawBuffer glDrawElements glDrawPixels glEdgeFlag glEdgeFlagPointer glEdgeFlagv glEnable glEnableClientState glEnd glEndList glEvalCoord (several) glEvalMesh (several) glEvalPoint1/2 glFeedbackBuffer glFinish glFlush glFog (several) glFrontFace glFrustum glGenLists glGenTextures glGetBooleanv glGetClipPlane glGetDoublev glGetError glGetFloatv glGetIntegerv glGetLightf/iv glGetMapd/f/iv glGetMaterialf/iv glGetPixelMapf/ui/usv glGetPointerv glGetPolygonStipple glGetString glGetTexEnvf/iv glGetTexGend/f/iv glGetTexImage glGetTexParameterf/iv glHint glIndexMask glIndexPointer glIndex (several) glInitNames glInterleavedArrays glIsEnabled glIsList glIsTexture glLightModel (several) glLight (several) glLineStipple glLineWidth glListBase glLoadIdentity glLoadMatrixd glLoadMatrixf glLoadName glLogicOp glMap (several) glMapGrid (several) glMaterial (several) glMatrixMode glMultMatrixd/f glNewList glNormal (several) glNormalPointer glOrtho glPassThrough glPixelMapf/ui/usv glPixelStoref/i glPixelTransferf/i glPixelZoom glPointSize glPolygonMode glPolygonOffset glPolygonStipple glPopAttrib glPopClientAttrib glPopMatrix glPopName glPrioritizeTextures glPushAttrib glPushClientAttrib glPushMatrix glPushName glRasterPos (several) glReadBuffer glReadPixels glRect (several) glRenderMode glRotated/f glScaled/f glScissor glSelectBuffer glShadeModel glStencilFunc glStencilMask glStencilOp glTexCoord (several) glTexCoordPointer glTexEnv (several) glTexGen (several) glTexImage1D glTexImage2D glTexParameter (several) glTexSubImage1D glTexSubImage2D glTranslated/f glVertex2/3/4 (several) glVertexPointer glViewport ______________________________________________________________________ 3.3.16. SVGAlib references For arcane reasons, SVGAlib is used to access mouse and keyboard with the Mesa/OpenGL version. ______________________________________________________________________ U keyboard_close U keyboard_init U keyboard_seteventhandler U keyboard_update U mouse_close U mouse_init U mouse_seteventhandler U mouse_update U vga_getmousetype ______________________________________________________________________ 4. Misc. 4.1. Multitexture EXTension GLQuake and probably GLQuake2 use the SGI version of the OpenGL Multitexture EXTension to do single pass dual source texturing, aka multitexturing, as explained above. The SGI EXTension was one of two proposals, and the final OpenGL 1.2 specification as supported in Mesa 3.0 is (unfortunately) a bit different. ______________________________________________________________________ wgl.c: glSelectTextureSGIS : glSelectTextureSGIS glMultiTexCoord2fSGIS : glMTexCoord2fSGIS glMultiTexCoord2fvSGIS : glMTexCoord2fvSGIS ______________________________________________________________________ GLQuake uses only these 3 functions. In addition, the enum used is different. ______________________________________________________________________ GL_MAX_TEXTURES_SGIS = 0x8360, // 0x835E, // Unused, so differences do no matter. GL_TEXTURE0_SGIS = 0x835F, GL_TEXTURE1_SGIS = 0x835F, // 0x8360, ______________________________________________________________________ GLQuake uses only the GL_TEXTURE0_SGIS and GL_TEXTURE1_SGIS tokens. SGI has probably broken the compatibility with a previous version. The problem is that emluating the old tokens is really hard (the glMulti­ TexCoord2 functions are called for each vertex). 4.1.1. Fake_glColorTableEXT This is probably a function used by ref_gl.so to emuate the recent OpenGL palette extension that might not be available with some OpenGL drivers. 4.2. The Quake/Quake2 MiniGL The 3Dfx Voodoo is supported under Win32 using a so called "minigl driver", as the 3Dfx OpenGL is still in Beta. It is safe to assume that this driver implements more or less only the funtions as needed by Quake and Quake2. For Voodoo2, the multitexture extension had to be added. Here is a list available on the web about the partial implementation of OpenGL in the 3Dfx opengl32.dll library. This list is far from complete. If you have any information about which functions work, an how, please let me know. 4.2.1. Primitives/Calls that work ˇ Triangles ˇ Triangle strips ˇ Triangle fans ˇ Quads ˇ Quad strips ˇ Polygons ˇ GL_RGBA + GL_UNSIGNED_BYTE textures ˇ Double buffer mode ˇ Depth buffer ˇ Smooth shading 4.2.2. Primitives/calls that do not work ˇ Lines ˇ Line loops ˇ Points ˇ GL_RGB textures ˇ Single buffer mode ˇ Flat shading ˇ Display lists 4.2.3. Supported Functions Here is a list of OpenGL functions. The functions in the "DOES NOT WORK" list appear to be nops. The functions in the "WORKS" list appear to work at least partially. If you find errors in the list or figure out in which situations the functions work or don't work (e.g., GL_RBGA textures in GL_UNSIGNED_BYTE format), please us know. ______________________________________________________________________ DOES NOT WORK WORKS (at least partially) ------------- -------------------------- glAccum glAlphaFunc glAreTexturesResident glArrayElement glBegin glBindTexture glBitmap glBlendFunc glCallList glCallLists glClear glClearAccum glClearColor glClearDepth glClearIndex glClearStencil glClipPlane glColor3{bdis ub ui us} glColor3f glColor3{bdis ui us}v glColor3{f ub}[v] glColor4{bdis ub ui us}[v] glColor4f[v] glColorMask glColorMaterial glColorPointer glCopyPixels glCopyTexImage1D glCopyTexImage2D glCopyTexSubImage1D glCopyTexSubImage2D glCullFace glDeleteLists glDeleteTextures glDepthFunc glDepthMask glDepthRange glDisable glDisableClientState glDrawArrays glDrawBuffer glDrawElements glDrawPixels glEdgeFlag[v] glEdgeFlagPointer glEnable glEnableClientState glEnd glEndList glEvalCoord{12}{df}[v] glEvalMesh{12} glEvalPoint{12} glFeedbackBuffer glFinish glFlush glFog{fi}[v] glFrontFace glFrustum glGenLists glGenTextures glGetBooleanv glGetClipPlane glGetDoublev glGetError glGetFloatv glGetIntegerv glGetLight{fi}v glGetMap{dfi}v glGetMaterial{fi}v glGetPixelMap{f ui us}v glGetPointerv glGetPolygonStipple glGetString glGetTexEnv{fi}v glGetTexGen{dfi}v glGetTexImage glGetTexLevelParameter{fi}v glGetTexParameter{fi}v glHint glIndexMask glIndexPointer glIndex{dfis ub}[v] glInitNames glInterleavedArrays glIsEnabled glIsList glIsTexture glLightModel{fi}[v] glLight{fi}[v] glLineStipple glLineWidth glListBase glLoadIdentity glLoadMatrixd glLoadMatrixf glLoadName glLogicOp glMap{12}{df} glMapGrid{12}{df} glMaterial{fi}[v] glMatrixMode glMultMatrix{df} glNewList glNormal3{bdfis}[v] glNormalPointer glOrtho glPassThrough glPixelMap{f ui us}v glPixelStore{fi} glPixelTransfer{fi} glPixelZoom glPointSize glPolygonMode glPolygonOffset glPolygonStipple glPopAttrib glPopClientAttrib glPopMatrix glPopName glPrioritizeTextures glPushAttrib glPushClientAttrib glPushMatrix glPushName glRasterPos{234}{dfis}[v] glReadBuffer glReadPixels glRect{dfis}[v] glRenderMode glRotated glRotatef glScaled glScalef glScissor glSelectBuffer glShadeModel glStencilFunc glStencilMask glStencilOp glTexCoord{134}{dfis}[v] glTexCoord2{dfis}v glTexCoord2{dis} glTexCoord2f glTexCoordPointer glTexEnvfv glTexEnvf glTexEnvi[v] glTexGen{dfi}[v] glTexImage1D glTexImage2D glTexParameterfv glTexParameterf glTexParameteri[v] glTexSubImage1D glTexSubImage2D glTranslated glTranslatef glVertex2{is}[v] glVertex2d[v] glVertex2fv glVertex2f glVertex3{dis}[v] glVertex3f[v] glVertex4{dfis}[v] glVertexPointer glViewport wglChoosePixelFormat wglCopyContext wglCreateContext wglCreateLayerContext wglDeleteContext wglDescribeLayerPlane wglDescribePixelFormat wglGetCurrentContext wglGetCurrentDC wglGetDefaultProcAddress wglGetLayerPaletteEntries wglGetPixelFormat wglGetProcAddress wglMakeCurrent wglRealizeLayerPalette wglSetLayerPaletteEntries wglSetPixelFormat wglShareLists wglSwapBuffers wglSwapLayerBuffers wglUseFontBitmapsA wglUseFontBitmapsW wglUseFontOutlinesA wglUseFontOutlinesW ______________________________________________________________________