18 Jul 2009
This commit is contained in:
parent
3102b03434
commit
eb92ce94e8
|
@ -72,5 +72,5 @@ if exist xtools\xtools.plg del /f /q xtools\xtools.plg
|
|||
echo Build succeeded!
|
||||
echo Please wait. Xash is now loading
|
||||
cd D:\Xash3D\
|
||||
xash.exe -log -dev 5 +map newmap
|
||||
xash.exe -log -dev 3 +map newmap
|
||||
:done
|
|
@ -209,7 +209,7 @@ bool V_PreRender( void )
|
|||
{
|
||||
// too early
|
||||
if( !re ) return false;
|
||||
|
||||
|
||||
re->BeginFrame();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: engine - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP652.tmp" with contents
|
||||
[
|
||||
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "server" /I "client" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\engine\!debug/" /Fo"..\temp\engine\!debug/" /Fd"..\temp\engine\!debug/" /FD /c
|
||||
"D:\Xash3D\src_main\engine\client\cl_view.c"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP652.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP653.tmp" with contents
|
||||
[
|
||||
user32.lib msvcrtd.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\engine\!debug/engine.pdb" /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\temp\engine\!debug/engine.dll" /implib:"..\temp\engine\!debug/engine.lib" /pdbtype:sept
|
||||
"\Xash3D\src_main\temp\engine\!debug\cinematic.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_cmds.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_demo.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_effects.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_frame.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_game.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_input.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_main.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_parse.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_phys.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_scrn.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\cl_view.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\com_library.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\con_keys.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\con_main.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\con_utils.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\engfuncs.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\engine.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\host.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\infostring.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\input.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\menu.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\net_chan.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\net_huff.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\net_msg.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_client.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_cmds.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_frame.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_game.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_init.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_main.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_move.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_phys.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_save.obj"
|
||||
"\Xash3D\src_main\temp\engine\!debug\sv_world.obj"
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP653.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP654.bat" with contents
|
||||
[
|
||||
@echo off
|
||||
copy \Xash3D\src_main\temp\engine\!debug\engine.dll "D:\Xash3D\bin\engine.dll"
|
||||
]
|
||||
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP654.bat"
|
||||
Compiling...
|
||||
cl_view.c
|
||||
Linking...
|
||||
<h3>Output Window</h3>
|
||||
Performing Custom Build Step on \Xash3D\src_main\temp\engine\!debug\engine.dll
|
||||
‘ª®¯¨à®¢ ® ä ©«®¢: 1.
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
engine.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: physic - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP551.tmp" with contents
|
||||
[
|
||||
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\physic\!debug/" /Fo"..\temp\physic\!debug/" /Fd"..\temp\physic\!debug/" /FD /GZ /c
|
||||
"D:\Xash3D\src_main\physic\cm_portals.c"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP551.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP552.tmp" with contents
|
||||
[
|
||||
user32.lib msvcrtd.lib newton.lib opengl32.lib /nologo /dll /incremental:yes /pdb:"..\temp\physic\!debug/physic.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\physic\!debug/physic.dll" /implib:"..\temp\physic\!debug/physic.lib" /pdbtype:sept
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_callback.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_collision.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_debug.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_materials.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_model.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_pmove.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_polygon.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_portals.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_rigidbody.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_test.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_trace.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\cm_utils.obj"
|
||||
"\Xash3D\src_main\temp\physic\!debug\physic.obj"
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP552.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP553.bat" with contents
|
||||
[
|
||||
@echo off
|
||||
copy \Xash3D\src_main\temp\physic\!debug\physic.dll "D:\Xash3D\bin\physic.dll"
|
||||
]
|
||||
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP553.bat"
|
||||
Compiling...
|
||||
cm_portals.c
|
||||
Linking...
|
||||
<h3>Output Window</h3>
|
||||
Performing Custom Build Step on \Xash3D\src_main\temp\physic\!debug\physic.dll
|
||||
‘ª®¯¨à®¢ ® ä ©«®¢: 1.
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
physic.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
776
render/glw_imp.c
776
render/glw_imp.c
|
@ -1,776 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 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 the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
/*
|
||||
** GLW_IMP.C
|
||||
**
|
||||
** This file contains ALL Win32 specific stuff having to do with the
|
||||
** OpenGL refresh. When a port is being made the following functions
|
||||
** must be implemented by the port:
|
||||
**
|
||||
** GLimp_EndFrame
|
||||
** GLimp_Init
|
||||
** GLimp_Shutdown
|
||||
**
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include "launch_api.h"
|
||||
#include "r_glimp.h"
|
||||
#include "glw_win.h"
|
||||
|
||||
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE|WS_SYSMENU)
|
||||
#define VID_NUM_MODES (int)( sizeof( vid_modes ) / sizeof( vid_modes[0] ) )
|
||||
|
||||
|
||||
extern stdlib_api_t com; // engine toolbox
|
||||
#define Host_Error com.error
|
||||
int GLimp_InitGL (void);
|
||||
|
||||
glwstate_t glw_state;
|
||||
|
||||
/*
|
||||
** VID_GetModeInfo
|
||||
*/
|
||||
typedef struct vidmode_s
|
||||
{
|
||||
int width, height;
|
||||
bool wideScreen;
|
||||
} vidmode_t;
|
||||
|
||||
vidmode_t vid_modes[] =
|
||||
{
|
||||
// { 320, 240, false },
|
||||
// { 400, 300, false },
|
||||
// { 512, 384, false },
|
||||
{ 640, 480, false },
|
||||
{ 800, 600, false },
|
||||
{ 960, 720, false },
|
||||
{ 1024, 768, false },
|
||||
{ 1152, 864, false },
|
||||
{ 1280, 800, false },
|
||||
{ 1280, 960, false },
|
||||
{ 1280, 1024, false },
|
||||
{ 1600, 1200, false },
|
||||
{ 2048, 1536, false },
|
||||
|
||||
{ 856, 480, true },
|
||||
{ 1024, 576, true },
|
||||
{ 1440, 900, true },
|
||||
{ 1680, 1050, true },
|
||||
{ 1920, 1200, true },
|
||||
{ 2560, 1600, true },
|
||||
|
||||
{ 2400, 600, false },
|
||||
{ 3072, 768, false },
|
||||
{ 3840, 720, false },
|
||||
{ 3840, 1024, false },
|
||||
{ 4800, 1200, false },
|
||||
{ 6144, 1536, false }
|
||||
};
|
||||
|
||||
bool VID_GetModeInfo( int *width, int *height, bool *wideScreen, int mode )
|
||||
{
|
||||
if( mode < -1 || mode >= VID_NUM_MODES )
|
||||
return false;
|
||||
|
||||
if( mode == -1 )
|
||||
{
|
||||
*width = 640;
|
||||
*height = 480;
|
||||
*wideScreen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = vid_modes[mode].width;
|
||||
*height = vid_modes[mode].height;
|
||||
*wideScreen = vid_modes[mode].wideScreen;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool VerifyDriver( void )
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
com.strncpy( buffer, pglGetString( GL_RENDERER ), sizeof(buffer) );
|
||||
com.strlwr( buffer, buffer );
|
||||
if ( strcmp( buffer, "gdi generic" ) == 0 )
|
||||
if ( !glw_state.mcd_accelerated )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
** VID_CreateWindow
|
||||
*/
|
||||
#define WINDOW_CLASS_NAME "Xash3D""WndClass"
|
||||
|
||||
bool VID_CreateWindow( int width, int height, bool fullscreen )
|
||||
{
|
||||
WNDCLASS wc;
|
||||
RECT r;
|
||||
cvar_t *vid_xpos, *vid_ypos;
|
||||
int stylebits;
|
||||
int x, y, w, h;
|
||||
int exstyle;
|
||||
|
||||
/* Register the frame class */
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = (WNDPROC)glw_state.wndproc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = glw_state.hInstance;
|
||||
wc.hIcon = LoadIcon( glw_state.hInstance, MAKEINTRESOURCE( 101 ) );
|
||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
|
||||
wc.lpszMenuName = 0;
|
||||
wc.lpszClassName = WINDOW_CLASS_NAME;
|
||||
|
||||
if (!RegisterClass (&wc) )
|
||||
Host_Error ("Couldn't register window class\n");
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
exstyle = WS_EX_TOPMOST;
|
||||
stylebits = (WS_POPUP|WS_VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
exstyle = 0;
|
||||
stylebits = WINDOW_STYLE;
|
||||
}
|
||||
|
||||
r.left = 0;
|
||||
r.top = 0;
|
||||
r.right = width;
|
||||
r.bottom = height;
|
||||
|
||||
AdjustWindowRect (&r, stylebits, FALSE);
|
||||
|
||||
w = r.right - r.left;
|
||||
h = r.bottom - r.top;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
vid_xpos = Cvar_Get( "r_xpos", "3", CVAR_ARCHIVE, "window position by horizontal" );
|
||||
vid_ypos = Cvar_Get( "r_ypos", "22", CVAR_ARCHIVE, "window position by vertical" );
|
||||
x = vid_xpos->integer;
|
||||
y = vid_ypos->integer;
|
||||
}
|
||||
|
||||
glw_state.hWnd = CreateWindowEx (
|
||||
exstyle,
|
||||
WINDOW_CLASS_NAME,
|
||||
"Xash3D",
|
||||
stylebits,
|
||||
x, y, w, h,
|
||||
NULL,
|
||||
NULL,
|
||||
glw_state.hInstance,
|
||||
NULL);
|
||||
|
||||
if (!glw_state.hWnd)
|
||||
Host_Error ("Couldn't create window\n");
|
||||
|
||||
ShowWindow( glw_state.hWnd, SW_SHOW );
|
||||
UpdateWindow( glw_state.hWnd );
|
||||
|
||||
// init all the gl stuff for the window
|
||||
if (!GLimp_InitGL ())
|
||||
{
|
||||
MsgDev ( D_ERROR, "VID_CreateWindow() - GLimp_InitGL failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
SetForegroundWindow( glw_state.hWnd );
|
||||
SetFocus( glw_state.hWnd );
|
||||
|
||||
// let the sound and input subsystems know about the new window
|
||||
Cvar_FullSet( "width", va( "%i", width ), CVAR_READ_ONLY );
|
||||
Cvar_FullSet( "height", va( "%i", height ), CVAR_READ_ONLY );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLimp_SetMode
|
||||
*/
|
||||
int GLimp_SetMode( int mode, bool fullscreen )
|
||||
{
|
||||
int width, height;
|
||||
bool wideScreen;
|
||||
const char *win_fs[] = { "W", "FS" };
|
||||
|
||||
Msg ( "Initializing OpenGL display\n");
|
||||
|
||||
Msg ( "...setting mode %d:", mode );
|
||||
|
||||
if ( !VID_GetModeInfo( &width, &height, &wideScreen, mode ) )
|
||||
{
|
||||
Msg ( " invalid mode\n" );
|
||||
return rserr_invalid_mode;
|
||||
}
|
||||
|
||||
Msg ( " %d %d %s\n", width, height, win_fs[fullscreen] );
|
||||
|
||||
// destroy the existing window
|
||||
if (glw_state.hWnd)
|
||||
{
|
||||
GLimp_Shutdown ();
|
||||
}
|
||||
|
||||
// do a CDS if needed
|
||||
if ( fullscreen )
|
||||
{
|
||||
DEVMODE dm;
|
||||
|
||||
Msg ( "...attempting fullscreen\n" );
|
||||
|
||||
memset( &dm, 0, sizeof( dm ) );
|
||||
|
||||
dm.dmSize = sizeof( dm );
|
||||
|
||||
dm.dmPelsWidth = width;
|
||||
dm.dmPelsHeight = height;
|
||||
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
if ( r_colorbits->integer != 0 )
|
||||
{
|
||||
dm.dmBitsPerPel = r_colorbits->integer;
|
||||
dm.dmFields |= DM_BITSPERPEL;
|
||||
Msg ( "...using r_bitdepth of %d\n", dm.dmBitsPerPel );
|
||||
}
|
||||
else
|
||||
{
|
||||
HDC hdc = GetDC( NULL );
|
||||
int bitspixel = GetDeviceCaps( hdc, BITSPIXEL );
|
||||
|
||||
Msg ( "...using desktop display depth of %d\n", bitspixel );
|
||||
|
||||
ReleaseDC( 0, hdc );
|
||||
}
|
||||
|
||||
if ( vid_displayfrequency->integer > 0 )
|
||||
{
|
||||
dm.dmFields |= DM_DISPLAYFREQUENCY;
|
||||
dm.dmDisplayFrequency = vid_displayfrequency->integer;
|
||||
Msg ( "...using display frequency %i\n", dm.dmDisplayFrequency );
|
||||
}
|
||||
|
||||
Msg ( "...calling CDS: " );
|
||||
if ( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) == DISP_CHANGE_SUCCESSFUL )
|
||||
{
|
||||
glState.width = width;
|
||||
glState.height = height;
|
||||
glState.fullScreen = true;
|
||||
|
||||
// tell engine about screen sizes
|
||||
Cvar_FullSet( "width", va( "%i", width ), CVAR_READ_ONLY );
|
||||
Cvar_FullSet( "height", va( "%i", height ), CVAR_READ_ONLY );
|
||||
|
||||
Msg ( "ok\n" );
|
||||
|
||||
if ( !VID_CreateWindow (width, height, true) )
|
||||
return rserr_invalid_mode;
|
||||
|
||||
return rserr_ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
glState.width = width;
|
||||
glState.height = height;
|
||||
|
||||
// tell engine about screen sizes
|
||||
Cvar_FullSet( "width", va( "%i", width ), CVAR_READ_ONLY );
|
||||
Cvar_FullSet( "height", va( "%i", height ), CVAR_READ_ONLY );
|
||||
|
||||
Msg ( "failed\n" );
|
||||
|
||||
Msg ( "...calling CDS assuming dual monitors:" );
|
||||
|
||||
dm.dmPelsWidth = width * 2;
|
||||
dm.dmPelsHeight = height;
|
||||
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
if ( r_colorbits->integer != 0 )
|
||||
{
|
||||
dm.dmBitsPerPel = r_colorbits->integer;
|
||||
dm.dmFields |= DM_BITSPERPEL;
|
||||
Msg ( "...using r_bitdepth of %d\n", dm.dmBitsPerPel );
|
||||
}
|
||||
|
||||
if ( vid_displayfrequency->integer > 0 )
|
||||
{
|
||||
dm.dmFields |= DM_DISPLAYFREQUENCY;
|
||||
dm.dmDisplayFrequency = vid_displayfrequency->integer;
|
||||
Msg ( "...using display frequency %i\n", dm.dmDisplayFrequency );
|
||||
}
|
||||
|
||||
/*
|
||||
** our first CDS failed, so maybe we're running on some weird dual monitor
|
||||
** system
|
||||
*/
|
||||
if ( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL )
|
||||
{
|
||||
Msg ( " failed\n" );
|
||||
|
||||
Msg ( "...setting windowed mode\n" );
|
||||
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
|
||||
glState.width = width;
|
||||
glState.height = height;
|
||||
glState.fullScreen = false;
|
||||
|
||||
// tell engine about screen sizes
|
||||
Cvar_FullSet( "width", va( "%i", width ), CVAR_READ_ONLY );
|
||||
Cvar_FullSet( "height", va( "%i", height ), CVAR_READ_ONLY );
|
||||
|
||||
if ( !VID_CreateWindow (width, height, false) )
|
||||
return rserr_invalid_mode;
|
||||
return rserr_invalid_fullscreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg ( " ok\n" );
|
||||
if ( !VID_CreateWindow (width, height, true) )
|
||||
return rserr_invalid_mode;
|
||||
|
||||
glState.fullScreen = true;
|
||||
return rserr_ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg ( "...setting windowed mode\n" );
|
||||
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
|
||||
glState.width = width;
|
||||
glState.height = height;
|
||||
glState.fullScreen = false;
|
||||
|
||||
// tell engine about screen sizes
|
||||
Cvar_FullSet( "width", va( "%i", width ), CVAR_READ_ONLY );
|
||||
Cvar_FullSet( "height", va( "%i", height ), CVAR_READ_ONLY );
|
||||
|
||||
if ( !VID_CreateWindow (width, height, false) )
|
||||
return rserr_invalid_mode;
|
||||
}
|
||||
|
||||
return rserr_ok;
|
||||
}
|
||||
|
||||
/*
|
||||
** GLimp_Shutdown
|
||||
**
|
||||
** This routine does all OS specific shutdown procedures for the OpenGL
|
||||
** subsystem. Under OpenGL this means NULLing out the current DC and
|
||||
** HGLRC, deleting the rendering context, and releasing the DC acquired
|
||||
** for the window. The state structure is also nulled out.
|
||||
**
|
||||
*/
|
||||
void GLimp_Shutdown( void )
|
||||
{
|
||||
if ( pwglMakeCurrent && !pwglMakeCurrent( NULL, NULL ) )
|
||||
Msg ( "ref_gl::R_Shutdown() - wglMakeCurrent failed\n");
|
||||
if ( glw_state.hGLRC )
|
||||
{
|
||||
if ( pwglDeleteContext && !pwglDeleteContext( glw_state.hGLRC ) )
|
||||
Msg ( "ref_gl::R_Shutdown() - wglDeleteContext failed\n");
|
||||
glw_state.hGLRC = NULL;
|
||||
}
|
||||
if (glw_state.hDC)
|
||||
{
|
||||
if ( !ReleaseDC( glw_state.hWnd, glw_state.hDC ) )
|
||||
Msg ( "ref_gl::R_Shutdown() - ReleaseDC failed\n" );
|
||||
glw_state.hDC = NULL;
|
||||
}
|
||||
if (glw_state.hWnd)
|
||||
{
|
||||
ShowWindow ( glw_state.hWnd, SW_HIDE );
|
||||
DestroyWindow ( glw_state.hWnd );
|
||||
glw_state.hWnd = NULL;
|
||||
}
|
||||
|
||||
UnregisterClass (WINDOW_CLASS_NAME, glw_state.hInstance);
|
||||
|
||||
if( glState.fullScreen ) {
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
glState.fullScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLimp_Init
|
||||
**
|
||||
** This routine is responsible for initializing the OS specific portions
|
||||
** of OpenGL. Under Win32 this means dealing with the pixelformats and
|
||||
** doing the wgl interface stuff.
|
||||
*/
|
||||
int GLimp_Init( void *hinstance, void *wndproc )
|
||||
{
|
||||
#define OSR2_BUILD_NUMBER 1111
|
||||
|
||||
OSVERSIONINFO vinfo;
|
||||
|
||||
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
|
||||
|
||||
glw_state.allowdisplaydepthchange = false;
|
||||
|
||||
if ( GetVersionEx( &vinfo) )
|
||||
{
|
||||
if ( vinfo.dwMajorVersion > 4 )
|
||||
{
|
||||
glw_state.allowdisplaydepthchange = true;
|
||||
}
|
||||
else if ( vinfo.dwMajorVersion == 4 )
|
||||
{
|
||||
if ( vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
|
||||
{
|
||||
glw_state.allowdisplaydepthchange = true;
|
||||
}
|
||||
else if ( vinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
||||
{
|
||||
if ( LOWORD( vinfo.dwBuildNumber ) >= OSR2_BUILD_NUMBER )
|
||||
{
|
||||
glw_state.allowdisplaydepthchange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg ( "GLimp_Init() - GetVersionEx failed\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
glw_state.hInstance = ( HINSTANCE ) hinstance;
|
||||
glw_state.wndproc = wndproc;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int GLimp_InitGL (void)
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd =
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
|
||||
1, // version number
|
||||
PFD_DRAW_TO_WINDOW | // support window
|
||||
PFD_SUPPORT_OPENGL | // support OpenGL
|
||||
PFD_DOUBLEBUFFER, // double buffered
|
||||
PFD_TYPE_RGBA, // RGBA type
|
||||
32, // 32-bit color depth
|
||||
0, 0, 0, 0, 0, 0, // color bits ignored
|
||||
0, // no alpha buffer
|
||||
0, // shift bit ignored
|
||||
0, // no accumulation buffer
|
||||
0, 0, 0, 0, // accum bits ignored
|
||||
24, // 32-bit z-buffer
|
||||
0, // no stencil buffer
|
||||
0, // no auxiliary buffer
|
||||
PFD_MAIN_PLANE, // main layer
|
||||
0, // reserved
|
||||
0, 0, 0 // layer masks ignored
|
||||
};
|
||||
int pixelformat;
|
||||
cvar_t *stereo;
|
||||
cvar_t *stencil;
|
||||
|
||||
stereo = Cvar_Get( "cl_stereo", "0", 0, "enable stereo rendering" );
|
||||
|
||||
stencil = Cvar_Get( "r_stencilbits", "0", 0, "pixelformat stencil bits (0 - auto)" );
|
||||
pfd.cStencilBits = max( 0, stencil->integer );
|
||||
|
||||
if ( pfd.cStencilBits != 0 )
|
||||
glState.stencilEnabled = true;
|
||||
else
|
||||
glState.stencilEnabled = false;
|
||||
|
||||
/*
|
||||
** set PFD_STEREO if necessary
|
||||
*/
|
||||
if ( stereo->integer != 0 )
|
||||
{
|
||||
Msg ( "...attempting to use stereo\n" );
|
||||
pfd.dwFlags |= PFD_STEREO;
|
||||
glState.stereoEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
glState.stereoEnabled = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** figure out if we're running on a minidriver or not
|
||||
*/
|
||||
if ( strstr( gl_driver->string, "opengl32" ) != 0 )
|
||||
glw_state.minidriver = false;
|
||||
else
|
||||
glw_state.minidriver = true;
|
||||
|
||||
/*
|
||||
** Get a DC for the specified window
|
||||
*/
|
||||
if ( glw_state.hDC != NULL )
|
||||
Msg ( "GLimp_Init() - non-NULL DC exists\n" );
|
||||
|
||||
if ( ( glw_state.hDC = GetDC( glw_state.hWnd ) ) == NULL )
|
||||
{
|
||||
Msg ( "GLimp_Init() - GetDC failed\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( glw_state.minidriver )
|
||||
{
|
||||
if ( (pixelformat = pwglChoosePixelFormat( glw_state.hDC, &pfd)) == 0 )
|
||||
{
|
||||
Msg ( "GLimp_Init() - pwglChoosePixelFormat failed\n");
|
||||
return false;
|
||||
}
|
||||
if ( pwglSetPixelFormat( glw_state.hDC, pixelformat, &pfd) == FALSE )
|
||||
{
|
||||
Msg ( "GLimp_Init() - pwglSetPixelFormat failed\n");
|
||||
return false;
|
||||
}
|
||||
pwglDescribePixelFormat( glw_state.hDC, pixelformat, sizeof( pfd ), &pfd );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ( pixelformat = ChoosePixelFormat( glw_state.hDC, &pfd)) == 0 )
|
||||
{
|
||||
Msg ( "GLimp_Init() - ChoosePixelFormat failed\n");
|
||||
return false;
|
||||
}
|
||||
if ( SetPixelFormat( glw_state.hDC, pixelformat, &pfd) == FALSE )
|
||||
{
|
||||
Msg ( "GLimp_Init() - SetPixelFormat failed\n");
|
||||
return false;
|
||||
}
|
||||
DescribePixelFormat( glw_state.hDC, pixelformat, sizeof( pfd ), &pfd );
|
||||
|
||||
if ( !( pfd.dwFlags & PFD_GENERIC_ACCELERATED ) )
|
||||
{
|
||||
extern cvar_t *r_allow_software;
|
||||
|
||||
if ( r_allow_software->integer )
|
||||
glw_state.mcd_accelerated = true;
|
||||
else
|
||||
glw_state.mcd_accelerated = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
glw_state.mcd_accelerated = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** report if stereo is desired but unavailable
|
||||
*/
|
||||
if ( !( pfd.dwFlags & PFD_STEREO ) && ( stereo->integer != 0 ) )
|
||||
{
|
||||
Msg ( "...failed to select stereo pixel format\n" );
|
||||
Cvar_SetValue( "cl_stereo", 0 );
|
||||
glState.stereoEnabled = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** startup the OpenGL subsystem by creating a context and making
|
||||
** it current
|
||||
*/
|
||||
if ( ( glw_state.hGLRC = pwglCreateContext( glw_state.hDC ) ) == 0 )
|
||||
{
|
||||
Msg ( "GLimp_Init() - pwglCreateContext failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ( !pwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) )
|
||||
{
|
||||
Msg ( "GLimp_Init() - pwglMakeCurrent failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ( !VerifyDriver() )
|
||||
{
|
||||
Msg ( "GLimp_Init() - no hardware acceleration detected\n" );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
** print out PFD specifics
|
||||
*/
|
||||
Msg ( "GL PFD: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", ( int ) pfd.cColorBits, ( int ) pfd.cDepthBits, ( int )pfd.cStencilBits );
|
||||
|
||||
return true;
|
||||
|
||||
fail:
|
||||
if ( glw_state.hGLRC )
|
||||
{
|
||||
pwglDeleteContext( glw_state.hGLRC );
|
||||
glw_state.hGLRC = NULL;
|
||||
}
|
||||
|
||||
if ( glw_state.hDC )
|
||||
{
|
||||
ReleaseDC( glw_state.hWnd, glw_state.hDC );
|
||||
glw_state.hDC = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
** GLimp_UpdateGammaRamp
|
||||
*/
|
||||
bool GLimp_GetGammaRamp( size_t stride, unsigned short *ramp )
|
||||
{
|
||||
if( pwglGetDeviceGammaRamp3DFX ) {
|
||||
if( pwglGetDeviceGammaRamp3DFX( glw_state.hDC, ramp ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( GetDeviceGammaRamp ( glw_state.hDC, ramp ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
** GLimp_SetGammaRamp
|
||||
*/
|
||||
void GLimp_SetGammaRamp( size_t stride, unsigned short *ramp )
|
||||
{
|
||||
if( pwglGetDeviceGammaRamp3DFX )
|
||||
pwglSetDeviceGammaRamp3DFX( glw_state.hDC, ramp );
|
||||
else
|
||||
SetDeviceGammaRamp( glw_state.hDC, ramp );
|
||||
}
|
||||
/*
|
||||
=================
|
||||
RB_CheckForErrors
|
||||
=================
|
||||
*/
|
||||
|
||||
void R_CheckForErrors( const char *filename, const int fileline )
|
||||
{
|
||||
int err;
|
||||
char *str;
|
||||
|
||||
if((err = pglGetError()) == GL_NO_ERROR )
|
||||
return;
|
||||
|
||||
switch( err )
|
||||
{
|
||||
case GL_STACK_OVERFLOW:
|
||||
str = "GL_STACK_OVERFLOW";
|
||||
break;
|
||||
case GL_STACK_UNDERFLOW:
|
||||
str = "GL_STACK_UNDERFLOW";
|
||||
break;
|
||||
case GL_INVALID_ENUM:
|
||||
str = "GL_INVALID_ENUM";
|
||||
break;
|
||||
case GL_INVALID_VALUE:
|
||||
str = "GL_INVALID_VALUE";
|
||||
break;
|
||||
case GL_INVALID_OPERATION:
|
||||
str = "GL_INVALID_OPERATION";
|
||||
break;
|
||||
case GL_OUT_OF_MEMORY:
|
||||
str = "GL_OUT_OF_MEMORY";
|
||||
break;
|
||||
default:
|
||||
str = "UNKNOWN ERROR";
|
||||
break;
|
||||
}
|
||||
Host_Error( "R_CheckForErrors: %s (called at %s:%i)\n", str, filename, fileline );
|
||||
}
|
||||
|
||||
/*
|
||||
** GLimp_BeginFrame
|
||||
*/
|
||||
void GLimp_BeginFrame( void )
|
||||
{
|
||||
if ( r_colorbits->modified )
|
||||
{
|
||||
if ( r_colorbits->integer != 0 && !glw_state.allowdisplaydepthchange )
|
||||
{
|
||||
Cvar_SetValue( "r_colorbits", 0 );
|
||||
Msg ( "r_colorbits requires Win95 OSR2.x or WinNT 4.x\n" );
|
||||
}
|
||||
r_colorbits->modified = false;
|
||||
}
|
||||
|
||||
if ( glState.cameraSeparation < 0 && glState.stereoEnabled )
|
||||
{
|
||||
pglDrawBuffer( GL_BACK_LEFT );
|
||||
}
|
||||
else if ( glState.cameraSeparation > 0 && glState.stereoEnabled )
|
||||
{
|
||||
pglDrawBuffer( GL_BACK_RIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
pglDrawBuffer( GL_BACK );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** GLimp_EndFrame
|
||||
**
|
||||
** Responsible for doing a swapbuffers and possibly for other stuff
|
||||
** as yet to be determined. Probably better not to make this a GLimp
|
||||
** function and instead do a call to GLimp_SwapBuffers.
|
||||
*/
|
||||
void GLimp_EndFrame (void)
|
||||
{
|
||||
R_CheckForErrors( __FILE__, __LINE__ );
|
||||
|
||||
if ( com.stricmp( gl_drawbuffer->string, "GL_BACK" ) == 0 )
|
||||
{
|
||||
if ( !pwglSwapBuffers( glw_state.hDC ) )
|
||||
Host_Error( "GLimp_EndFrame() - SwapBuffers() failed!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** GLimp_AppActivate
|
||||
*/
|
||||
void GLimp_AppActivate( bool active )
|
||||
{
|
||||
if ( active )
|
||||
{
|
||||
SetForegroundWindow( glw_state.hWnd );
|
||||
ShowWindow( glw_state.hWnd, SW_RESTORE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( vid_fullscreen->integer )
|
||||
ShowWindow( glw_state.hWnd, SW_MINIMIZE );
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 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 the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
#ifndef _WIN32
|
||||
# error You should not be including this file on this platform
|
||||
#endif
|
||||
|
||||
#ifndef __GLW_WIN_H__
|
||||
#define __GLW_WIN_H__
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HINSTANCE hInstance;
|
||||
void *wndproc;
|
||||
|
||||
HDC hDC; // handle to device context
|
||||
HWND hWnd; // handle to window
|
||||
HGLRC hGLRC; // handle to GL rendering context
|
||||
|
||||
HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library
|
||||
|
||||
bool minidriver;
|
||||
bool allowdisplaydepthchange;
|
||||
bool mcd_accelerated;
|
||||
|
||||
} glwstate_t;
|
||||
|
||||
extern glwstate_t glw_state;
|
||||
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_displayfrequency;
|
||||
|
||||
#endif
|
550
render/qgl.h
550
render/qgl.h
|
@ -1,550 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 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 the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright (C) 1999-2000 Brian Paul, All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
The Mesa OpenGL headers were originally adapted in 2001 for dynamic OpenGL
|
||||
binding by Zephaniah E. Hull and later rewritten by Joseph Carter. This
|
||||
version of the file is for the generation 3 DynGL code, and has been
|
||||
adapted by Joseph Carter. He and Zeph have decided to hereby disclaim all
|
||||
Copyright of this work. It is released to the Public Domain WITHOUT ANY
|
||||
WARRANTY whatsoever, express or implied, in the hopes that others will use
|
||||
it instead of other less-evolved hacks which usually don't work right. ;)
|
||||
*/
|
||||
|
||||
/*
|
||||
The following code is loosely based on DynGL code by Joseph Carter
|
||||
and Zephaniah E. Hull. Adapted by Victor Luchits for qfusion project.
|
||||
*/
|
||||
|
||||
/*
|
||||
** QGL.H
|
||||
*/
|
||||
#ifndef __QGL_H__
|
||||
#define __QGL_H__
|
||||
|
||||
#define GL_GLEXT_LEGACY
|
||||
#define GLX_GLXEXT_LEGACY
|
||||
|
||||
#if !defined (__MACOSX__)
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#if defined (__linux__) || defined (__FreeBSD__)
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#if defined (__MACOSX__)
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/glext.h>
|
||||
#endif
|
||||
|
||||
#undef GL_GLEXT_LEGACY
|
||||
#undef GLX_GLXEXT_LEGACY
|
||||
|
||||
QGL_EXTERN bool QGL_Init( const char *dllname );
|
||||
QGL_EXTERN void QGL_Shutdown( void );
|
||||
|
||||
QGL_EXTERN void *pglGetProcAddress( const GLubyte * );
|
||||
QGL_EXTERN const char *(*pglGetGLWExtensionsString)( void );
|
||||
|
||||
/*
|
||||
** extension constants
|
||||
*/
|
||||
|
||||
#define GL_TEXTURE0_SGIS 0x835E
|
||||
#define GL_TEXTURE1_SGIS 0x835F
|
||||
#define GL_TEXTURE0_ARB 0x84C0
|
||||
#define GL_TEXTURE1_ARB 0x84C1
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
|
||||
|
||||
#ifndef GL_POLYGON_OFFSET
|
||||
#define GL_POLYGON_OFFSET 0x8037
|
||||
#endif
|
||||
|
||||
/* GL_ARB_texture_env_combine */
|
||||
#ifndef GL_ARB_texture_env_combine
|
||||
#define GL_ARB_texture_env_combine
|
||||
|
||||
#define GL_COMBINE_ARB 0x8570
|
||||
#define GL_COMBINE_RGB_ARB 0x8571
|
||||
#define GL_COMBINE_ALPHA_ARB 0x8572
|
||||
#define GL_RGB_SCALE_ARB 0x8573
|
||||
#define GL_ADD_SIGNED_ARB 0x8574
|
||||
#define GL_INTERPOLATE_ARB 0x8575
|
||||
#define GL_CONSTANT_ARB 0x8576
|
||||
#define GL_PRIMARY_COLOR_ARB 0x8577
|
||||
#define GL_PREVIOUS_ARB 0x8578
|
||||
#define GL_SOURCE0_RGB_ARB 0x8580
|
||||
#define GL_SOURCE1_RGB_ARB 0x8581
|
||||
#define GL_SOURCE2_RGB_ARB 0x8582
|
||||
#define GL_SOURCE0_ALPHA_ARB 0x8588
|
||||
#define GL_SOURCE1_ALPHA_ARB 0x8589
|
||||
#define GL_SOURCE2_ALPHA_ARB 0x858A
|
||||
#define GL_OPERAND0_RGB_ARB 0x8590
|
||||
#define GL_OPERAND1_RGB_ARB 0x8591
|
||||
#define GL_OPERAND2_RGB_ARB 0x8592
|
||||
#define GL_OPERAND0_ALPHA_ARB 0x8598
|
||||
#define GL_OPERAND1_ALPHA_ARB 0x8599
|
||||
#define GL_OPERAND2_ALPHA_ARB 0x859A
|
||||
#endif /* GL_ARB_texture_env_combine */
|
||||
|
||||
/* GL_ARB_texture_compression */
|
||||
#ifndef GL_ARB_texture_compression
|
||||
#define GL_ARB_texture_compression
|
||||
|
||||
#define GL_COMPRESSED_ALPHA_ARB 0x84E9
|
||||
#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
|
||||
#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
|
||||
#define GL_COMPRESSED_RGB_ARB 0x84ED
|
||||
#define GL_COMPRESSED_RGBA_ARB 0x84EE
|
||||
#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
|
||||
#define GL_TEXTURE_IMAGE_SIZE_ARB 0x86A0
|
||||
#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
|
||||
#endif /* GL_ARB_texture_compression */
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_EXT_texture_filter_anisotropic
|
||||
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#endif /* GL_EXT_texture_filter_anisotropic */
|
||||
|
||||
/* GL_EXT_texture_edge_clamp */
|
||||
#ifndef GL_EXT_texture_edge_clamp
|
||||
#define GL_EXT_texture_edge_clamp
|
||||
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#endif /* GL_EXT_texture_edge_clamp */
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
#define GL_ARB_vertex_buffer_object
|
||||
|
||||
typedef int GLintptrARB;
|
||||
typedef int GLsizeiptrARB;
|
||||
|
||||
#define GL_ARRAY_BUFFER_ARB 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
|
||||
#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
|
||||
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
|
||||
#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
|
||||
#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
|
||||
#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
|
||||
#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
|
||||
#define GL_STREAM_DRAW_ARB 0x88E0
|
||||
#define GL_STREAM_READ_ARB 0x88E1
|
||||
#define GL_STREAM_COPY_ARB 0x88E2
|
||||
#define GL_STATIC_DRAW_ARB 0x88E4
|
||||
#define GL_STATIC_READ_ARB 0x88E5
|
||||
#define GL_STATIC_COPY_ARB 0x88E6
|
||||
#define GL_DYNAMIC_DRAW_ARB 0x88E8
|
||||
#define GL_DYNAMIC_READ_ARB 0x88E9
|
||||
#define GL_DYNAMIC_COPY_ARB 0x88EA
|
||||
#define GL_READ_ONLY_ARB 0x88B8
|
||||
#define GL_WRITE_ONLY_ARB 0x88B9
|
||||
#define GL_READ_WRITE_ARB 0x88BA
|
||||
#define GL_BUFFER_SIZE_ARB 0x8764
|
||||
#define GL_BUFFER_USAGE_ARB 0x8765
|
||||
#define GL_BUFFER_ACCESS_ARB 0x88BB
|
||||
#define GL_BUFFER_MAPPED_ARB 0x88BC
|
||||
#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
|
||||
#endif /* GL_ARB_vertex_buffer_object */
|
||||
|
||||
/* GL_ARB_texture_cube_map */
|
||||
#ifndef GL_ARB_texture_cube_map
|
||||
#define GL_ARB_texture_cube_map
|
||||
|
||||
#define GL_NORMAL_MAP_ARB 0x8511
|
||||
#define GL_REFLECTION_MAP_ARB 0x8512
|
||||
#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
|
||||
#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
|
||||
#endif /* GL_ARB_texture_cube_map */
|
||||
|
||||
/* GL_EXT_bgra */
|
||||
#ifndef GL_EXT_bgra
|
||||
#define GL_EXT_bgra
|
||||
|
||||
#define GL_BGR_EXT 0x80E0
|
||||
#define GL_BGRA_EXT 0x80E1
|
||||
#endif /* GL_EXT_bgra */
|
||||
|
||||
/* gl_ext_texture3D */
|
||||
#ifndef GL_EXT_texture3D
|
||||
#define GL_EXT_texture3D
|
||||
|
||||
#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
|
||||
#endif /* GL_EXT_texture3D */
|
||||
|
||||
/* GL_ARB_shader_objects */
|
||||
#ifndef GL_ARB_shader_objects
|
||||
#define GL_ARB_shader_objects
|
||||
|
||||
typedef char GLcharARB;
|
||||
typedef unsigned int GLhandleARB;
|
||||
|
||||
#define GL_PROGRAM_OBJECT_ARB 0x8B40
|
||||
#define GL_OBJECT_TYPE_ARB 0x8B4E
|
||||
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
|
||||
#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
|
||||
#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
|
||||
#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
|
||||
#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
|
||||
#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
|
||||
#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
|
||||
#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
|
||||
#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
|
||||
#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
|
||||
#define GL_SHADER_OBJECT_ARB 0x8B48
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FLOAT_VEC2_ARB 0x8B50
|
||||
#define GL_FLOAT_VEC3_ARB 0x8B51
|
||||
#define GL_FLOAT_VEC4_ARB 0x8B52
|
||||
#define GL_INT 0x1404
|
||||
#define GL_INT_VEC2_ARB 0x8B53
|
||||
#define GL_INT_VEC3_ARB 0x8B54
|
||||
#define GL_INT_VEC4_ARB 0x8B55
|
||||
#define GL_BOOL_ARB 0x8B56
|
||||
#define GL_BOOL_VEC2_ARB 0x8B57
|
||||
#define GL_BOOL_VEC3_ARB 0x8B58
|
||||
#define GL_BOOL_VEC4_ARB 0x8B59
|
||||
#define GL_FLOAT_MAT2_ARB 0x8B5A
|
||||
#define GL_FLOAT_MAT3_ARB 0x8B5B
|
||||
#define GL_FLOAT_MAT4_ARB 0x8B5C
|
||||
#define GL_SAMPLER_1D_ARB 0x8B5D
|
||||
#define GL_SAMPLER_2D_ARB 0x8B5E
|
||||
#define GL_SAMPLER_3D_ARB 0x8B5F
|
||||
#define GL_SAMPLER_CUBE_ARB 0x8B60
|
||||
#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
|
||||
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
|
||||
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
|
||||
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
|
||||
#endif /* GL_ARB_shader_objects */
|
||||
|
||||
/* GL_ARB_vertex_shader */
|
||||
#ifndef GL_ARB_vertex_shader
|
||||
#define GL_ARB_vertex_shader
|
||||
|
||||
#define GL_VERTEX_SHADER_ARB 0x8B31
|
||||
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
|
||||
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
|
||||
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
|
||||
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
|
||||
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FLOAT_VEC2_ARB 0x8B50
|
||||
#define GL_FLOAT_VEC3_ARB 0x8B51
|
||||
#define GL_FLOAT_VEC4_ARB 0x8B52
|
||||
#define GL_FLOAT_MAT2_ARB 0x8B5A
|
||||
#define GL_FLOAT_MAT3_ARB 0x8B5B
|
||||
#define GL_FLOAT_MAT4_ARB 0x8B5C
|
||||
#endif /* GL_ARB_vertex_shader */
|
||||
|
||||
/* GL_ARB_fragment_shader */
|
||||
#ifndef GL_ARB_fragment_shader
|
||||
#define GL_ARB_fragment_shader
|
||||
|
||||
#define GL_FRAGMENT_SHADER_ARB 0x8B30
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
|
||||
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
|
||||
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
|
||||
#endif /* GL_ARB_fragment_shader */
|
||||
|
||||
/* GL_ARB_shading_language_100 */
|
||||
#ifndef GL_ARB_shading_language_100
|
||||
#define GL_ARB_shading_language_100
|
||||
|
||||
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
|
||||
#endif /* GL_ARB_shading_language_100 */
|
||||
|
||||
/* ARB_depth_texture */
|
||||
#ifndef ARB_depth_texture
|
||||
#define ARB_depth_texture
|
||||
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_DEPTH_COMPONENT24 0x81A6
|
||||
#define GL_DEPTH_COMPONENT32 0x81A7
|
||||
#define GL_TEXTURE_DEPTH_SIZE 0x884A
|
||||
#define GL_DEPTH_TEXTURE_MODE 0x884B
|
||||
#endif /* ARB_depth_texture */
|
||||
|
||||
/* GL_ARB_shadow */
|
||||
#ifndef GL_ARB_shadow
|
||||
#define GL_ARB_shadow
|
||||
|
||||
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
|
||||
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
|
||||
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
|
||||
#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
|
||||
#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
|
||||
#endif /* GL_ARB_shadow */
|
||||
|
||||
/* GL_ARB_occlusion_query */
|
||||
#ifndef GL_ARB_occlusion_query
|
||||
#define GL_ARB_occlusion_query
|
||||
|
||||
#define GL_QUERY_COUNTER_BITS_ARB 0x8864
|
||||
#define GL_CURRENT_QUERY_ARB 0x8865
|
||||
#define GL_QUERY_RESULT_ARB 0x8866
|
||||
#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
|
||||
#define GL_SAMPLES_PASSED_ARB 0x8914
|
||||
#endif /* GL_ARB_occlusion_query */
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
#ifndef GL_SGIS_generate_mipmap
|
||||
#define GL_SGIS_generate_mipmap
|
||||
|
||||
#define GL_GENERATE_MIPMAP_SGIS 0x8191
|
||||
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
|
||||
#endif /* GL_SGIS_generate_mipmap */
|
||||
|
||||
#endif /*__QGL_H__*/
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef QGL_FUNC
|
||||
#define QGL_FUNC
|
||||
#endif
|
||||
|
||||
// WGL Functions
|
||||
QGL_WGL(PROC, wglGetProcAddress, (LPCSTR));
|
||||
QGL_WGL(int, wglChoosePixelFormat, (HDC, CONST PIXELFORMATDESCRIPTOR *));
|
||||
QGL_WGL(int, wglDescribePixelFormat, (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR));
|
||||
QGL_WGL(BOOL, wglSetPixelFormat, (HDC, int, CONST PIXELFORMATDESCRIPTOR *));
|
||||
QGL_WGL(BOOL, wglSwapBuffers, (HDC));
|
||||
QGL_WGL(HGLRC, wglCreateContext, (HDC));
|
||||
QGL_WGL(BOOL, wglDeleteContext, (HGLRC));
|
||||
QGL_WGL(BOOL, wglMakeCurrent, (HDC, HGLRC));
|
||||
|
||||
// GLX Functions
|
||||
QGL_GLX(void *, glXGetProcAddressARB, (const GLubyte *procName));
|
||||
QGL_GLX(XVisualInfo *, glXChooseVisual, (Display *dpy, int screen, int *attribList));
|
||||
QGL_GLX(GLXContext, glXCreateContext, (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct));
|
||||
QGL_GLX(void, glXDestroyContext, (Display *dpy, GLXContext ctx));
|
||||
QGL_GLX(Bool, glXMakeCurrent, (Display *dpy, GLXDrawable drawable, GLXContext ctx));
|
||||
QGL_GLX(Bool, glXCopyContext, (Display *dpy, GLXContext src, GLXContext dst, GLuint mask));
|
||||
QGL_GLX(Bool, glXSwapBuffers, (Display *dpy, GLXDrawable drawable));
|
||||
QGL_GLX(Bool, glXQueryVersion, (Display *dpy, int *major, int *minor));
|
||||
QGL_GLX(const char *, glXQueryExtensionsString, (Display *dpy, int screen));
|
||||
|
||||
// GL Functions
|
||||
QGL_FUNC(void, glAlphaFunc, (GLenum func, GLclampf ref));
|
||||
QGL_FUNC(void, glArrayElement, (GLint i));
|
||||
QGL_FUNC(void, glBegin, (GLenum mode));
|
||||
QGL_FUNC(void, glBindTexture, (GLenum target, GLuint texture));
|
||||
QGL_FUNC(void, glBlendFunc, (GLenum sfactor, GLenum dfactor));
|
||||
QGL_FUNC(void, glClear, (GLbitfield mask));
|
||||
QGL_FUNC(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
|
||||
QGL_FUNC(void, glClearDepth, (GLclampd depth));
|
||||
QGL_FUNC(void, glClearStencil, (GLint s));
|
||||
QGL_FUNC(void, glClipPlane, (GLenum plane, const GLdouble *equation));
|
||||
QGL_FUNC(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha));
|
||||
QGL_FUNC(void, glColor4fv, (const GLfloat *v));
|
||||
QGL_FUNC(void, glColor4ubv, (const GLubyte *v));
|
||||
QGL_FUNC(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha));
|
||||
QGL_FUNC(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
|
||||
QGL_FUNC(void, glCullFace, (GLenum mode));
|
||||
QGL_FUNC(void, glDeleteTextures, (GLsizei n, const GLuint *textures));
|
||||
QGL_FUNC(void, glDepthFunc, (GLenum func));
|
||||
QGL_FUNC(void, glDepthMask, (GLboolean flag));
|
||||
QGL_FUNC(void, glDepthRange, (GLclampd zNear, GLclampd zFar));
|
||||
QGL_FUNC(void, glDisable, (GLenum cap));
|
||||
QGL_FUNC(void, glDisableClientState, (GLenum array));
|
||||
QGL_FUNC(void, glDrawBuffer, (GLenum mode));
|
||||
QGL_FUNC(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices));
|
||||
QGL_FUNC(void, glEnable, (GLenum cap));
|
||||
QGL_FUNC(void, glEnableClientState, (GLenum array));
|
||||
QGL_FUNC(void, glEnd, (void));
|
||||
QGL_FUNC(void, glFinish, (void));
|
||||
QGL_FUNC(void, glFlush, (void));
|
||||
QGL_FUNC(void, glFrontFace, (GLenum mode));
|
||||
QGL_FUNC(GLenum, glGetError, (void));
|
||||
QGL_FUNC(void, glGetIntegerv, (GLenum pname, GLint *params));
|
||||
QGL_FUNC(const GLubyte *, glGetString, (GLenum name));
|
||||
QGL_FUNC(void, glLoadIdentity, (void));
|
||||
QGL_FUNC(void, glLoadMatrixf, (const GLfloat *m));
|
||||
QGL_FUNC(void, glMatrixMode, (GLenum mode));
|
||||
QGL_FUNC(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer));
|
||||
QGL_FUNC(void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar));
|
||||
QGL_FUNC(void, glPolygonMode, (GLenum face, GLenum mode));
|
||||
QGL_FUNC(void, glPolygonOffset, (GLfloat factor, GLfloat units));
|
||||
QGL_FUNC(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels));
|
||||
QGL_FUNC(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height));
|
||||
QGL_FUNC(void, glShadeModel, (GLenum mode));
|
||||
QGL_FUNC(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask));
|
||||
QGL_FUNC(void, glStencilMask, (GLuint mask));
|
||||
QGL_FUNC(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass));
|
||||
QGL_FUNC(void, glTexCoord2f, (GLfloat s, GLfloat t));
|
||||
QGL_FUNC(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
|
||||
QGL_FUNC(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params));
|
||||
QGL_FUNC(void, glTexEnvi, (GLenum target, GLenum pname, GLint param));
|
||||
QGL_FUNC(void, glTexGenfv, (GLenum coord, GLenum pname, const GLfloat *params));
|
||||
QGL_FUNC(void, glTexGeni, (GLenum coord, GLenum pname, GLint param));
|
||||
QGL_FUNC(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
|
||||
QGL_FUNC(void, glTexParameteri, (GLenum target, GLenum pname, GLint param));
|
||||
QGL_FUNC(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels));
|
||||
QGL_FUNC(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height));
|
||||
QGL_FUNC(void, glVertex2f, (GLfloat x, GLfloat y));
|
||||
QGL_FUNC(void, glVertex3f, (GLfloat x, GLfloat y, GLfloat z));
|
||||
QGL_FUNC(void, glVertex3fv, (const GLfloat *v));
|
||||
QGL_FUNC(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
|
||||
QGL_FUNC(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height));
|
||||
|
||||
QGL_EXT(void, glLockArraysEXT, (int , int ));
|
||||
QGL_EXT(void, glUnlockArraysEXT, (void));
|
||||
QGL_EXT(void, glSelectTextureSGIS, (GLenum ));
|
||||
QGL_EXT(void, glActiveTextureARB, (GLenum ));
|
||||
QGL_EXT(void, glClientActiveTextureARB, (GLenum ));
|
||||
QGL_EXT(void, glDrawRangeElementsEXT, (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *));
|
||||
QGL_EXT(void, glBindBufferARB, (GLenum target, GLuint buffer));
|
||||
QGL_EXT(void, glDeleteBuffersARB, (GLsizei n, const GLuint *buffers));
|
||||
QGL_EXT(void, glGenBuffersARB, (GLsizei n, GLuint *buffers));
|
||||
QGL_EXT(void, glBufferDataARB, (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage));
|
||||
QGL_EXT(void, glBufferDataARB, (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage));
|
||||
QGL_EXT(void, glTexImage3D, (GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
|
||||
QGL_EXT(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));
|
||||
|
||||
QGL_EXT(void, glDeleteObjectARB, (GLhandleARB obj));
|
||||
QGL_EXT(GLhandleARB, glGetHandleARB, (GLenum pname));
|
||||
QGL_EXT(void, glDetachObjectARB, (GLhandleARB containerObj, GLhandleARB attachedObj));
|
||||
QGL_EXT(GLhandleARB, glCreateShaderObjectARB, (GLenum shaderType));
|
||||
QGL_EXT(void, glShaderSourceARB, (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length));
|
||||
QGL_EXT(void, glCompileShaderARB, (GLhandleARB shaderObj));
|
||||
QGL_EXT(GLhandleARB, glCreateProgramObjectARB, (void));
|
||||
QGL_EXT(void, glAttachObjectARB, (GLhandleARB containerObj, GLhandleARB obj));
|
||||
QGL_EXT(void, glLinkProgramARB, (GLhandleARB programObj));
|
||||
QGL_EXT(void, glUseProgramObjectARB, (GLhandleARB programObj));
|
||||
QGL_EXT(void, glValidateProgramARB, (GLhandleARB programObj));
|
||||
QGL_EXT(void, glUniform1fARB, (GLint location, GLfloat v0));
|
||||
QGL_EXT(void, glUniform2fARB, (GLint location, GLfloat v0, GLfloat v1));
|
||||
QGL_EXT(void, glUniform3fARB, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2));
|
||||
QGL_EXT(void, glUniform4fARB, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3));
|
||||
QGL_EXT(void, glUniform1iARB, (GLint location, GLint v0));
|
||||
QGL_EXT(void, glUniform2iARB, (GLint location, GLint v0, GLint v1));
|
||||
QGL_EXT(void, glUniform3iARB, (GLint location, GLint v0, GLint v1, GLint v2));
|
||||
QGL_EXT(void, glUniform4iARB, (GLint location, GLint v0, GLint v1, GLint v2, GLint v3));
|
||||
QGL_EXT(void, glUniform1fvARB, (GLint location, GLsizei count, const GLfloat *value));
|
||||
QGL_EXT(void, glUniform2fvARB, (GLint location, GLsizei count, const GLfloat *value));
|
||||
QGL_EXT(void, glUniform3fvARB, (GLint location, GLsizei count, const GLfloat *value));
|
||||
QGL_EXT(void, glUniform4fvARB, (GLint location, GLsizei count, const GLfloat *value));
|
||||
QGL_EXT(void, glUniform1ivARB, (GLint location, GLsizei count, const GLint *value));
|
||||
QGL_EXT(void, glUniform2ivARB, (GLint location, GLsizei count, const GLint *value));
|
||||
QGL_EXT(void, glUniform3ivARB, (GLint location, GLsizei count, const GLint *value));
|
||||
QGL_EXT(void, glUniform4ivARB, (GLint location, GLsizei count, const GLint *value));
|
||||
QGL_EXT(void, glUniformMatrix2fvARB, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value));
|
||||
QGL_EXT(void, glUniformMatrix3fvARB, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value));
|
||||
QGL_EXT(void, glUniformMatrix4fvARB, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value));
|
||||
QGL_EXT(void, glGetObjectParameterfvARB, (GLhandleARB obj, GLenum pname, GLfloat *params));
|
||||
QGL_EXT(void, glGetObjectParameterivARB, (GLhandleARB obj, GLenum pname, GLint *params));
|
||||
QGL_EXT(void, glGetInfoLogARB, (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog));
|
||||
QGL_EXT(void, glGetAttachedObjectsARB, (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj));
|
||||
QGL_EXT(GLint, glGetUniformLocationARB, (GLhandleARB programObj, const GLcharARB *name));
|
||||
QGL_EXT(void, glGetActiveUniformARB, (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name));
|
||||
QGL_EXT(void, glGetUniformfvARB, (GLhandleARB programObj, GLint location, GLfloat *params));
|
||||
QGL_EXT(void, glGetUniformivARB, (GLhandleARB programObj, GLint location, GLint *params));
|
||||
QGL_EXT(void, glGetShaderSourceARB, (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source));
|
||||
|
||||
QGL_EXT(void, glVertexAttribPointerARB, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer));
|
||||
QGL_EXT(void, glEnableVertexAttribArrayARB, (GLuint index));
|
||||
QGL_EXT(void, glDisableVertexAttribArrayARB, (GLuint index));
|
||||
QGL_EXT(void, glBindAttribLocationARB, (GLhandleARB programObj, GLuint index, const GLcharARB *name));
|
||||
QGL_EXT(void, glGetActiveAttribARB, (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name));
|
||||
QGL_EXT(GLint, glGetAttribLocationARB, (GLhandleARB programObj, const GLcharARB *name));
|
||||
|
||||
QGL_EXT(void, glGenQueriesARB, (GLsizei n, GLuint *ids));
|
||||
QGL_EXT(void, glDeleteQueriesARB, (GLsizei n, const GLuint *ids));
|
||||
QGL_EXT(GLboolean, glIsQueryARB, (GLuint id));
|
||||
QGL_EXT(void, glBeginQueryARB, (GLenum target, GLuint id));
|
||||
QGL_EXT(void, glEndQueryARB, (GLenum target));
|
||||
QGL_EXT(void, glGetQueryivARB, (GLenum target, GLenum pname, GLint *params));
|
||||
QGL_EXT(void, glGetQueryObjectivARB, (GLuint id, GLenum pname, GLint *params));
|
||||
QGL_EXT(void, glGetQueryObjectuivARB, (GLuint id, GLenum pname, GLuint *params));
|
||||
|
||||
QGL_EXT(void, glSwapInterval, (int interval));
|
||||
|
||||
// WGL_EXT Functions
|
||||
QGL_WGL_EXT(const char *, wglGetExtensionsStringEXT, (void));
|
||||
QGL_WGL_EXT(BOOL, wglGetDeviceGammaRamp3DFX, (HDC, WORD *));
|
||||
QGL_WGL_EXT(BOOL, wglSetDeviceGammaRamp3DFX, (HDC, WORD *));
|
||||
|
||||
// GLX_EXT Functions
|
175
render/qgl_win.c
175
render/qgl_win.c
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 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 the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
This code is part of DynGL, a method of dynamically loading an OpenGL
|
||||
library without much pain designed by Joseph Carter and is based
|
||||
loosely on previous work done both by Zephaniah E. Hull and Joseph.
|
||||
|
||||
Both contributors have decided to disclaim all Copyright to this work.
|
||||
It is released to the Public Domain WITHOUT ANY WARRANTY whatsoever,
|
||||
express or implied, in the hopes that others will use it instead of
|
||||
other less-evolved hacks which usually don't work right. ;)
|
||||
*/
|
||||
|
||||
/*
|
||||
The following code is loosely based on DynGL code by Joseph Carter
|
||||
and Zephaniah E. Hull. Adapted by Victor Luchits for qfusion project.
|
||||
*/
|
||||
|
||||
/*
|
||||
** QGL_WIN.C
|
||||
**
|
||||
** This file implements the operating system binding of GL to QGL function
|
||||
** pointers. When doing a port of Qfusion you must implement the following
|
||||
** two functions:
|
||||
**
|
||||
** QGL_Init() - loads libraries, assigns function pointers, etc.
|
||||
** QGL_Shutdown() - unloads libraries, NULLs function pointers
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include "launch_api.h"
|
||||
#include "glw_win.h"
|
||||
|
||||
extern stdlib_api_t com; // engine toolbox
|
||||
|
||||
#define QGL_EXTERN
|
||||
|
||||
#define QGL_FUNC(type,name,params) type (APIENTRY * p##name) params;
|
||||
#define QGL_EXT(type,name,params) type (APIENTRY * p##name) params;
|
||||
#define QGL_WGL(type,name,params) type (APIENTRY * p##name) params;
|
||||
#define QGL_WGL_EXT(type,name,params) type (APIENTRY * p##name) params;
|
||||
#define QGL_GLX(type,name,params)
|
||||
#define QGL_GLX_EXT(type,name,params)
|
||||
|
||||
#include "qgl.h"
|
||||
|
||||
#undef QGL_GLX_EXT
|
||||
#undef QGL_GLX
|
||||
#undef QGL_WGL_EXT
|
||||
#undef QGL_WGL
|
||||
#undef QGL_EXT
|
||||
#undef QGL_FUNC
|
||||
|
||||
static const char *_pglGetGLWExtensionsString( void );
|
||||
static const char *_pglGetGLWExtensionsStringInit( void );
|
||||
|
||||
/*
|
||||
** QGL_Shutdown
|
||||
**
|
||||
** Unloads the specified DLL then nulls out all the proc pointers.
|
||||
*/
|
||||
void QGL_Shutdown( void )
|
||||
{
|
||||
if( glw_state.hinstOpenGL )
|
||||
FreeLibrary( glw_state.hinstOpenGL );
|
||||
glw_state.hinstOpenGL = NULL;
|
||||
|
||||
pglGetGLWExtensionsString = NULL;
|
||||
|
||||
#define QGL_FUNC(type,name,params) (p##name) = NULL;
|
||||
#define QGL_EXT(type,name,params) (p##name) = NULL;
|
||||
#define QGL_WGL(type,name,params) (p##name) = NULL;
|
||||
#define QGL_WGL_EXT(type,name,params) (p##name) = NULL;
|
||||
#define QGL_GLX(type,name,params)
|
||||
#define QGL_GLX_EXT(type,name,params)
|
||||
|
||||
#include "qgl.h"
|
||||
|
||||
#undef QGL_GLX_EXT
|
||||
#undef QGL_GLX
|
||||
#undef QGL_WGL_EXT
|
||||
#undef QGL_WGL
|
||||
#undef QGL_EXT
|
||||
#undef QGL_FUNC
|
||||
}
|
||||
|
||||
#pragma warning (disable : 4113 4133 4047 )
|
||||
|
||||
/*
|
||||
** QGL_Init
|
||||
**
|
||||
** This is responsible for binding our pgl function pointers to
|
||||
** the appropriate GL stuff. In Windows this means doing a
|
||||
** LoadLibrary and a bunch of calls to GetProcAddress. On other
|
||||
** operating systems we need to do the right thing, whatever that
|
||||
** might be.
|
||||
**
|
||||
*/
|
||||
bool QGL_Init( const char *dllname )
|
||||
{
|
||||
if( ( glw_state.hinstOpenGL = LoadLibrary( dllname ) ) == 0 ) {
|
||||
char *buf;
|
||||
|
||||
buf = NULL;
|
||||
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL );
|
||||
MsgDev( D_ERROR, "%s\n", buf );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#define QGL_FUNC(type,name,params) (p##name) = ( void * )GetProcAddress( glw_state.hinstOpenGL, #name ); \
|
||||
if( !(p##name) ) { MsgDev( D_ERROR, "QGL_Init: Failed to get address for %s\n", #name ); return false; }
|
||||
#define QGL_EXT(type,name,params) (p##name) = NULL;
|
||||
#define QGL_WGL(type,name,params) (p##name) = ( void * )GetProcAddress( glw_state.hinstOpenGL, #name ); \
|
||||
if( !(p##name) ) { MsgDev( D_ERROR, "QGL_Init: Failed to get address for %s\n", #name ); return false; }
|
||||
#define QGL_WGL_EXT(type,name,params) (p##name) = NULL;
|
||||
#define QGL_GLX(type,name,params)
|
||||
#define QGL_GLX_EXT(type,name,params)
|
||||
|
||||
#include "qgl.h"
|
||||
|
||||
#undef QGL_GLX_EXT
|
||||
#undef QGL_GLX
|
||||
#undef QGL_WGL_EXT
|
||||
#undef QGL_WGL
|
||||
#undef QGL_EXT
|
||||
#undef QGL_FUNC
|
||||
|
||||
pglGetGLWExtensionsString = _pglGetGLWExtensionsStringInit;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
** pglGetProcAddress
|
||||
*/
|
||||
void *pglGetProcAddress( const GLubyte *procName ) {
|
||||
return (void *)pwglGetProcAddress( (LPCSTR)procName );
|
||||
}
|
||||
|
||||
/*
|
||||
** pglGetGLWExtensionsString
|
||||
*/
|
||||
static const char *_pglGetGLWExtensionsStringInit( void )
|
||||
{
|
||||
pwglGetExtensionsStringEXT = ( void * )pglGetProcAddress( (const GLubyte *)"wglGetExtensionsStringEXT" );
|
||||
pglGetGLWExtensionsString = _pglGetGLWExtensionsString;
|
||||
return pglGetGLWExtensionsString ();
|
||||
}
|
||||
|
||||
static const char *_pglGetGLWExtensionsString( void )
|
||||
{
|
||||
if( pwglGetExtensionsStringEXT )
|
||||
return pwglGetExtensionsStringEXT ();
|
||||
return NULL;
|
||||
}
|
|
@ -49,13 +49,13 @@ static void Mod_AliasBuildMeshesForFrame0( ref_model_t *mod )
|
|||
maliasmesh_t *mesh = &aliasmodel->meshes[k];
|
||||
|
||||
size = sizeof( vec4_t ) + sizeof( vec4_t ); // xyz and normals
|
||||
if( glConfig.ext.GLSL )
|
||||
if( GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
size += sizeof( vec4_t ); // s-vectors
|
||||
size *= mesh->numverts;
|
||||
|
||||
mesh->xyzArray = ( vec4_t * )Mod_Malloc( mod, size );
|
||||
mesh->normalsArray = ( vec4_t * )( ( byte * )mesh->xyzArray + mesh->numverts * sizeof( vec4_t ) );
|
||||
if( glConfig.ext.GLSL )
|
||||
if( GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
mesh->sVectorsArray = ( vec4_t * )( ( byte * )mesh->normalsArray + mesh->numverts * sizeof( vec4_t ) );
|
||||
|
||||
for( i = 0; i < mesh->numverts; i++ )
|
||||
|
@ -67,7 +67,7 @@ static void Mod_AliasBuildMeshesForFrame0( ref_model_t *mod )
|
|||
mesh->normalsArray[i][3] = 0;
|
||||
}
|
||||
|
||||
if( glConfig.ext.GLSL )
|
||||
if( GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
R_BuildTangentVectors( mesh->numverts, mesh->xyzArray, mesh->normalsArray, mesh->stArray, mesh->numtris, mesh->elems, mesh->sVectorsArray );
|
||||
}
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ static void R_DrawAliasFrameLerp( const meshbuffer_t *mb, float backlerp )
|
|||
features |= MF_NORMALS;
|
||||
#ifdef HARDWARE_OUTLINES
|
||||
if( e->outlineHeight )
|
||||
features |= MF_NORMALS|(glConfig.ext.GLSL ? MF_ENABLENORMALS : 0);
|
||||
features |= MF_NORMALS|(GL_Support( R_SHADER_GLSL100_EXT ) ? MF_ENABLENORMALS : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ void R_LockArrays( int numverts )
|
|||
if( r_arraysLocked )
|
||||
return;
|
||||
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
{
|
||||
pglVertexPointer( 3, GL_FLOAT, 16, vertsArray );
|
||||
|
||||
|
@ -442,7 +442,7 @@ void R_LockArrays( int numverts )
|
|||
}
|
||||
}
|
||||
|
||||
if( glConfig.ext.compiled_vertex_array )
|
||||
if( GL_Support( R_CUSTOM_VERTEX_ARRAY_EXT ))
|
||||
pglLockArraysEXT( 0, numverts );
|
||||
|
||||
r_arraysLocked = true;
|
||||
|
@ -458,7 +458,7 @@ void R_UnlockArrays( void )
|
|||
if( !r_arraysLocked )
|
||||
return;
|
||||
|
||||
if( glConfig.ext.compiled_vertex_array )
|
||||
if(GL_Support( R_CUSTOM_VERTEX_ARRAY_EXT ))
|
||||
pglUnlockArraysEXT();
|
||||
|
||||
if( r_normalsEnabled )
|
||||
|
@ -508,13 +508,13 @@ void R_FlushArrays( void )
|
|||
else if( r_backacc.numColors > 1 )
|
||||
{
|
||||
pglEnableClientState( GL_COLOR_ARRAY );
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
|
||||
}
|
||||
|
||||
if( r_drawelements->integer || glState.in2DMode || RI.refdef.rdflags & RDF_NOWORLDMODEL )
|
||||
{
|
||||
if( glConfig.ext.draw_range_elements )
|
||||
if( GL_Support( R_DRAW_RANGEELEMENTS_EXT ))
|
||||
pglDrawRangeElementsEXT( GL_TRIANGLES, 0, r_backacc.numVerts, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
|
||||
else
|
||||
pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
|
||||
|
@ -937,7 +937,7 @@ static bool R_VertexTCBase( const shaderpass_t *pass, int unit, mat4x4_t matrix
|
|||
case TC_GEN_BASE:
|
||||
GL_DisableAllTexGens();
|
||||
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
{
|
||||
pglTexCoordPointer( 2, GL_FLOAT, 0, coordsArray );
|
||||
return true;
|
||||
|
@ -946,7 +946,7 @@ static bool R_VertexTCBase( const shaderpass_t *pass, int unit, mat4x4_t matrix
|
|||
case TC_GEN_LIGHTMAP:
|
||||
GL_DisableAllTexGens();
|
||||
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
{
|
||||
pglTexCoordPointer( 2, GL_FLOAT, 0, lightmapCoordsArray[r_lightmapStyleNum[unit]] );
|
||||
return true;
|
||||
|
@ -980,7 +980,7 @@ static bool R_VertexTCBase( const shaderpass_t *pass, int unit, mat4x4_t matrix
|
|||
|
||||
GL_DisableAllTexGens();
|
||||
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
{
|
||||
pglTexCoordPointer( 2, GL_FLOAT, 0, tUnitCoordsArray[unit] );
|
||||
return true;
|
||||
|
@ -1146,7 +1146,7 @@ static bool R_VertexTCBase( const shaderpass_t *pass, int unit, mat4x4_t matrix
|
|||
|
||||
GL_DisableAllTexGens();
|
||||
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
{
|
||||
pglTexCoordPointer( 2, GL_FLOAT, 0, tUnitCoordsArray[unit] );
|
||||
return false;
|
||||
|
@ -1157,7 +1157,7 @@ static bool R_VertexTCBase( const shaderpass_t *pass, int unit, mat4x4_t matrix
|
|||
case TC_GEN_SVECTORS:
|
||||
GL_DisableAllTexGens();
|
||||
|
||||
if( !glConfig.ext.vertex_buffer_object )
|
||||
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
|
||||
{
|
||||
pglTexCoordPointer( 4, GL_FLOAT, 0, sVectorsArray );
|
||||
return true;
|
||||
|
@ -1900,9 +1900,9 @@ static void R_RenderMeshGLSL_Material( void )
|
|||
else // no alpha in normalmap, don't bother with offset mapping
|
||||
offsetmappingScale = 0;
|
||||
|
||||
if( glConfig.ext.GLSL_branching )
|
||||
if( GL_Support( R_GLSL_BRANCHING ))
|
||||
programFeatures |= PROGRAM_APPLY_BRANCHING;
|
||||
if( glConfig.ext.GLSL_no_half_types )
|
||||
if( GL_Support( R_GLSL_NO_HALF_TYPES ))
|
||||
programFeatures |= PROGRAM_APPLY_NO_HALF_TYPES;
|
||||
if( RI.params & RP_CLIPPLANE )
|
||||
programFeatures |= PROGRAM_APPLY_CLIPPING;
|
||||
|
@ -2155,9 +2155,9 @@ static void R_RenderMeshGLSL_Distortion( void )
|
|||
if( !( RI.params & ( RP_PORTALCAPTURED|RP_PORTALCAPTURED2 ) ) )
|
||||
return;
|
||||
|
||||
if( glConfig.ext.GLSL_branching )
|
||||
if( GL_Support( R_GLSL_BRANCHING ))
|
||||
programFeatures |= PROGRAM_APPLY_BRANCHING;
|
||||
if( glConfig.ext.GLSL_no_half_types )
|
||||
if( GL_Support( R_GLSL_NO_HALF_TYPES ))
|
||||
programFeatures |= PROGRAM_APPLY_NO_HALF_TYPES;
|
||||
if( RI.params & RP_CLIPPLANE )
|
||||
programFeatures |= PROGRAM_APPLY_CLIPPING;
|
||||
|
@ -2225,7 +2225,7 @@ static void R_RenderMeshGLSL_Shadowmap( void )
|
|||
int i;
|
||||
int state;
|
||||
int program, object;
|
||||
int programFeatures = glConfig.ext.GLSL_branching ? PROGRAM_APPLY_BRANCHING : 0;
|
||||
int programFeatures = GL_Support( R_GLSL_BRANCHING ) ? PROGRAM_APPLY_BRANCHING : 0;
|
||||
shaderpass_t *pass = r_accumPasses[0];
|
||||
|
||||
if( r_shadows_pcf->integer == 2 )
|
||||
|
@ -2281,7 +2281,7 @@ static void R_RenderMeshGLSL_Outline( void )
|
|||
int faceCull;
|
||||
int state;
|
||||
int program, object;
|
||||
int programFeatures = glConfig.ext.GLSL_branching ? PROGRAM_APPLY_BRANCHING : 0;
|
||||
int programFeatures = GL_Support( R_GLSL_BRANCHING ) ? PROGRAM_APPLY_BRANCHING : 0;
|
||||
shaderpass_t *pass = r_accumPasses[0];
|
||||
|
||||
if( RI.params & RP_CLIPPLANE )
|
||||
|
@ -2382,7 +2382,7 @@ static void R_RenderAccumulatedPasses( void )
|
|||
|
||||
if( r_numAccumPasses == 1 )
|
||||
R_RenderMeshGeneric();
|
||||
else if( glConfig.ext.texture_env_combine )
|
||||
else if( GL_Support( R_COMBINE_EXT ))
|
||||
R_RenderMeshCombined();
|
||||
else
|
||||
R_RenderMeshMultitextured();
|
||||
|
@ -2406,7 +2406,7 @@ static void R_AccumulatePass( shaderpass_t *pass )
|
|||
|
||||
// see if there are any free texture units
|
||||
renderNow = ( pass->flags & ( SHADERPASS_DLIGHT|SHADERPASS_STENCILSHADOW ) ) || pass->program;
|
||||
accumulate = ( r_numAccumPasses < glConfig.maxTextureUnits ) && !renderNow;
|
||||
accumulate = ( r_numAccumPasses < glConfig.max_texture_units ) && !renderNow;
|
||||
|
||||
if( accumulate )
|
||||
{
|
||||
|
@ -2439,23 +2439,23 @@ static void R_AccumulatePass( shaderpass_t *pass )
|
|||
{
|
||||
prevMode = R_ShaderpassBlendmode( prevPass->flags );
|
||||
|
||||
if( glConfig.ext.texture_env_combine )
|
||||
if( GL_Support( R_COMBINE_EXT ))
|
||||
{
|
||||
if( prevMode == GL_REPLACE )
|
||||
accumulate = ( mode == GL_ADD ) ? glConfig.ext.texture_env_add : true;
|
||||
accumulate = ( mode == GL_ADD ) ? GL_Support( R_TEXTURE_ENV_ADD_EXT ) : true;
|
||||
else if( prevMode == GL_ADD )
|
||||
accumulate = ( mode == GL_ADD ) && glConfig.ext.texture_env_add;
|
||||
accumulate = ( mode == GL_ADD ) && GL_Support( R_TEXTURE_ENV_ADD_EXT );
|
||||
else if( prevMode == GL_MODULATE )
|
||||
accumulate = ( mode == GL_MODULATE || mode == GL_REPLACE );
|
||||
else
|
||||
accumulate = false;
|
||||
}
|
||||
else /* if( glConfig.ext.multitexture )*/
|
||||
else /* if( GL_Support( R_ARB_MULTITEXTURE ))*/
|
||||
{
|
||||
if( prevMode == GL_REPLACE )
|
||||
accumulate = ( mode == GL_ADD ) ? glConfig.ext.texture_env_add : ( mode != GL_DECAL );
|
||||
accumulate = ( mode == GL_ADD ) ? GL_Support( R_TEXTURE_ENV_ADD_EXT ) : ( mode != GL_DECAL );
|
||||
else if( prevMode == GL_ADD )
|
||||
accumulate = ( mode == GL_ADD ) && glConfig.ext.texture_env_add;
|
||||
accumulate = ( mode == GL_ADD ) && GL_Support( R_TEXTURE_ENV_ADD_EXT );
|
||||
else if( prevMode == GL_MODULATE )
|
||||
accumulate = ( mode == GL_MODULATE || mode == GL_REPLACE );
|
||||
else
|
||||
|
@ -2689,7 +2689,7 @@ void R_RenderMeshBuffer( const meshbuffer_t *mb )
|
|||
R_AccumulatePass( &r_GLSLpasses[3] );
|
||||
|
||||
#ifdef HARDWARE_OUTLINES
|
||||
if( glConfig.ext.GLSL && RI.currententity && RI.currententity->outlineHeight && r_outlines_scale->value > 0
|
||||
if( GL_Support( R_SHADER_GLSL100_EXT ) && RI.currententity && RI.currententity->outlineHeight && r_outlines_scale->value > 0
|
||||
&& ( r_currentShader->sort == SHADER_SORT_OPAQUE ) && ( r_currentShader->flags & SHADER_CULL_FRONT ) )
|
||||
R_AccumulatePass( &r_GLSLpassOutline );
|
||||
#endif
|
||||
|
@ -2815,7 +2815,7 @@ static void R_DrawTriangles( void )
|
|||
if( r_showtris->integer == 2 )
|
||||
R_SetColorForOutlines();
|
||||
|
||||
if( glConfig.ext.draw_range_elements )
|
||||
if( GL_Support( R_DRAW_RANGEELEMENTS_EXT ))
|
||||
pglDrawRangeElementsEXT( GL_TRIANGLES, 0, r_backacc.numVerts, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
|
||||
else
|
||||
pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
|
||||
|
|
|
@ -261,4 +261,130 @@ static _inline bool R_InvalidMesh( const mesh_t *mesh )
|
|||
|
||||
void R_RenderMeshBuffer( const meshbuffer_t *mb );
|
||||
|
||||
/*
|
||||
=======================================================================
|
||||
|
||||
GL STATE MACHINE
|
||||
|
||||
=======================================================================
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
R_OPENGL_110 = 0, // base
|
||||
R_SGIS_MIPMAPS_EXT,
|
||||
R_WGL_SWAPCONTROL,
|
||||
R_WGL_3DFX_GAMMA_CONTROL,
|
||||
R_COMBINE_EXT,
|
||||
R_DRAW_RANGEELEMENTS_EXT,
|
||||
R_ARB_MULTITEXTURE,
|
||||
R_LOCKARRAYS_EXT,
|
||||
R_TEXTURE_3D_EXT,
|
||||
R_TEXTURECUBEMAP_EXT,
|
||||
R_DOT3_ARB_EXT,
|
||||
R_CLAMPTOEDGE_EXT,
|
||||
R_ANISOTROPY_EXT,
|
||||
R_BLEND_MINMAX_EXT,
|
||||
R_STENCILTWOSIDE_EXT,
|
||||
R_BLEND_SUBTRACT_EXT,
|
||||
R_SHADER_OBJECTS_EXT,
|
||||
R_SHADER_GLSL100_EXT,
|
||||
R_VERTEX_SHADER_EXT, // glsl vertex program
|
||||
R_FRAGMENT_SHADER_EXT, // glsl fragment program
|
||||
R_VERTEX_PROGRAM_EXT, // cg vertex program
|
||||
R_FRAGMENT_PROGRAM_EXT, // cg fragment program
|
||||
R_EXT_POINTPARAMETERS,
|
||||
R_SEPARATESTENCIL_EXT,
|
||||
R_ARB_TEXTURE_NPOT_EXT,
|
||||
R_ARB_VERTEX_BUFFER_OBJECT_EXT,
|
||||
R_CUSTOM_VERTEX_ARRAY_EXT,
|
||||
R_TEXTURE_COMPRESSION_EXT,
|
||||
R_TEXTURE_ENV_ADD_EXT,
|
||||
R_CLAMP_TEXBORDER_EXT,
|
||||
R_OCCLUSION_QUERIES_EXT,
|
||||
R_DEPTH_TEXTURE,
|
||||
R_SHADOW_EXT,
|
||||
R_TEXTURE_LODBIAS,
|
||||
R_GLSL_NO_HALF_TYPES, // fake extension
|
||||
R_GLSL_BRANCHING, // fake extension
|
||||
R_EXTCOUNT
|
||||
} ref_glext_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *renderer_string; // ptrs to OpenGL32.dll, use with caution
|
||||
const char *vendor_string;
|
||||
const char *version_string;
|
||||
|
||||
// list of supported extensions
|
||||
const char *extensions_string;
|
||||
byte extension[R_EXTCOUNT];
|
||||
|
||||
int max_texture_units;
|
||||
GLint max_2d_texture_size;
|
||||
GLint max_2d_rectangle_size;
|
||||
GLint max_3d_texture_size;
|
||||
GLint max_cubemap_texture_size;
|
||||
GLint texRectangle;
|
||||
|
||||
GLfloat max_texture_anisotropy;
|
||||
GLfloat cur_texture_anisotropy;
|
||||
GLfloat max_texture_lodbias;
|
||||
|
||||
int color_bits;
|
||||
int depth_bits;
|
||||
int stencil_bits;
|
||||
|
||||
bool allowCDS;
|
||||
bool deviceSupportsGamma;
|
||||
bool fullscreen;
|
||||
int prev_mode;
|
||||
} glconfig_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int flags;
|
||||
|
||||
word gammaRamp[768]; // current gamma ramp
|
||||
word stateRamp[768]; // original gamma ramp
|
||||
|
||||
int width, height;
|
||||
bool fullScreen;
|
||||
bool wideScreen;
|
||||
|
||||
bool initializedMedia;
|
||||
|
||||
int currentTMU;
|
||||
GLuint *currentTextures;
|
||||
int *currentEnvModes;
|
||||
bool *texIdentityMatrix;
|
||||
int *genSTEnabled; // 0 - disabled, OR 1 - S, OR 2 - T, OR 4 - R
|
||||
int *texCoordArrayMode; // 0 - disabled, 1 - enabled, 2 - cubemap
|
||||
vec4_t draw_color;
|
||||
|
||||
int faceCull;
|
||||
int frontFace;
|
||||
|
||||
bool stencilEnabled;
|
||||
bool in2DMode;
|
||||
|
||||
bool hwGamma;
|
||||
unsigned short orignalGammaRamp[3*256];
|
||||
} glstate_t;
|
||||
|
||||
extern glconfig_t glConfig;
|
||||
extern glstate_t glState;
|
||||
|
||||
// r_register.c
|
||||
void GL_InitBackend( void );
|
||||
bool GL_Support( int r_ext );
|
||||
void GL_InitExtensions( void );
|
||||
void GL_ShutdownBackend( void );
|
||||
void GL_UpdateSwapInterval( void );
|
||||
void GL_UpdateGammaRamp( void );
|
||||
void GL_SetExtension( int r_ext, int enable );
|
||||
void GL_BuildGammaTable( void );
|
||||
|
||||
bool R_Init_OpenGL( void );
|
||||
void R_Free_OpenGL( void );
|
||||
|
||||
#endif /*__R_BACKEND_H__*/
|
||||
|
|
|
@ -124,7 +124,7 @@ static void R_Bloom_InitEffectTexture( void )
|
|||
// make sure bloom size doesn't have stupid values
|
||||
limit = min( r_bloom_sample_size->integer, min( screen_texture_width, screen_texture_height ) );
|
||||
|
||||
if( glConfig.ext.texture_non_power_of_two )
|
||||
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
|
||||
BLOOM_SIZE = limit;
|
||||
else // make sure bloom size is a power of 2
|
||||
for( BLOOM_SIZE = 32; (BLOOM_SIZE<<1) <= limit; BLOOM_SIZE <<= 1 );
|
||||
|
@ -149,7 +149,7 @@ static void R_Bloom_InitTextures( void )
|
|||
byte *data;
|
||||
int size;
|
||||
|
||||
if( glConfig.ext.texture_non_power_of_two )
|
||||
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
|
||||
{
|
||||
screen_texture_width = glState.width;
|
||||
screen_texture_height = glState.height;
|
||||
|
@ -162,7 +162,7 @@ static void R_Bloom_InitTextures( void )
|
|||
}
|
||||
|
||||
// disable blooms if we can't handle a texture of that size
|
||||
if( screen_texture_width > glConfig.maxTextureSize || screen_texture_height > glConfig.maxTextureSize )
|
||||
if( screen_texture_width > glConfig.max_2d_texture_size || screen_texture_height > glConfig.max_2d_texture_size )
|
||||
{
|
||||
screen_texture_width = screen_texture_height = 0;
|
||||
Cvar_Set( "r_bloom", "0" );
|
||||
|
|
|
@ -307,7 +307,7 @@ void R_InitOcclusionQueries( void )
|
|||
if( !r_occlusionShader )
|
||||
r_occlusionShader = R_LoadShader( "***r_occlusion***", SHADER_OPAQUE_OCCLUDER, false, 0, SHADER_INVALID );
|
||||
|
||||
if( !glConfig.ext.occlusion_query )
|
||||
if( !GL_Support( R_OCCLUSION_QUERIES_EXT ))
|
||||
return;
|
||||
|
||||
pglGenQueriesARB( MAX_OQ_TOTAL, r_occlusionQueries );
|
||||
|
@ -562,7 +562,7 @@ void R_ShutdownOcclusionQueries( void )
|
|||
{
|
||||
r_occlusionShader = NULL;
|
||||
|
||||
if( !glConfig.ext.occlusion_query )
|
||||
if( !GL_Support( R_OCCLUSION_QUERIES_EXT ))
|
||||
return;
|
||||
|
||||
pglDeleteQueriesARB( MAX_OQ_TOTAL, r_occlusionQueries );
|
||||
|
|
234
render/r_glimp.h
234
render/r_glimp.h
|
@ -1,234 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
Copyright (C) 2002-2007 Victor Luchits
|
||||
|
||||
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 the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __R_GLIMP_H__
|
||||
#define __R_GLIMP_H__
|
||||
|
||||
#define QGL_EXTERN extern
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
#define QGL_WGL( type, name, params ) QGL_EXTERN type( APIENTRY * p ## name ) params;
|
||||
#define QGL_WGL_EXT( type, name, params ) QGL_EXTERN type( APIENTRY * p ## name ) params;
|
||||
#define QGL_GLX( type, name, params )
|
||||
#define QGL_GLX_EXT( type, name, params )
|
||||
#endif
|
||||
|
||||
#if defined ( __linux__ ) || defined ( __FreeBSD__ )
|
||||
#define QGL_WGL( type, name, params )
|
||||
#define QGL_WGL_EXT( type, name, params )
|
||||
#define QGL_GLX( type, name, params ) QGL_EXTERN type( APIENTRY * p ## name ) params;
|
||||
#define QGL_GLX_EXT( type, name, params ) QGL_EXTERN type( APIENTRY * p ## name ) params;
|
||||
#endif
|
||||
|
||||
#if defined ( __MACOSX__ )
|
||||
#define QGL_WGL( type, name, params )
|
||||
#define QGL_WGL_EXT( type, name, params )
|
||||
#define QGL_GLX( type, name, params )
|
||||
#define QGL_GLX_EXT( type, name, params )
|
||||
#endif
|
||||
|
||||
#define QGL_FUNC( type, name, params ) QGL_EXTERN type( APIENTRY * p ## name ) params;
|
||||
#define QGL_EXT( type, name, params ) QGL_EXTERN type( APIENTRY * p ## name ) params;
|
||||
|
||||
#include "qgl.h"
|
||||
|
||||
#undef QGL_GLX_EXT
|
||||
#undef QGL_GLX
|
||||
#undef QGL_WGL_EXT
|
||||
#undef QGL_WGL
|
||||
#undef QGL_EXT
|
||||
#undef QGL_FUNC
|
||||
|
||||
//====================================================================
|
||||
|
||||
extern cvar_t *r_colorbits;
|
||||
extern cvar_t *r_stencilbits;
|
||||
extern cvar_t *gl_drawbuffer;
|
||||
extern cvar_t *gl_driver;
|
||||
|
||||
//====================================================================
|
||||
|
||||
/*
|
||||
** GL config stuff
|
||||
*/
|
||||
#define GL_RENDERER_VOODOO 0x00000001
|
||||
#define GL_RENDERER_VOODOO2 0x00000002
|
||||
#define GL_RENDERER_VOODOO_RUSH 0x00000004
|
||||
#define GL_RENDERER_BANSHEE 0x00000008
|
||||
#define GL_RENDERER_3DFX 0x0000000F
|
||||
|
||||
#define GL_RENDERER_PCX1 0x00000010
|
||||
#define GL_RENDERER_PCX2 0x00000020
|
||||
#define GL_RENDERER_PMX 0x00000040
|
||||
#define GL_RENDERER_POWERVR 0x00000070
|
||||
|
||||
#define GL_RENDERER_PERMEDIA2 0x00000100
|
||||
#define GL_RENDERER_GLINT_MX 0x00000200
|
||||
#define GL_RENDERER_GLINT_TX 0x00000400
|
||||
#define GL_RENDERER_3DLABS_MISC 0x00000800
|
||||
#define GL_RENDERER_3DLABS 0x00000F00
|
||||
|
||||
#define GL_RENDERER_REALIZM 0x00001000
|
||||
#define GL_RENDERER_REALIZM2 0x00002000
|
||||
#define GL_RENDERER_INTERGRAPH 0x00003000
|
||||
|
||||
#define GL_RENDERER_3DPRO 0x00004000
|
||||
#define GL_RENDERER_REAL3D 0x00008000
|
||||
#define GL_RENDERER_RIVA128 0x00010000
|
||||
#define GL_RENDERER_DYPIC 0x00020000
|
||||
|
||||
#define GL_RENDERER_V1000 0x00040000
|
||||
#define GL_RENDERER_V2100 0x00080000
|
||||
#define GL_RENDERER_V2200 0x00100000
|
||||
#define GL_RENDERER_RENDITION 0x001C0000
|
||||
|
||||
#define GL_RENDERER_O2 0x00100000
|
||||
#define GL_RENDERER_IMPACT 0x00200000
|
||||
#define GL_RENDERER_RE 0x00400000
|
||||
#define GL_RENDERER_IR 0x00800000
|
||||
#define GL_RENDERER_SGI 0x00F00000
|
||||
|
||||
#define GL_RENDERER_MCD 0x01000000
|
||||
#define GL_RENDERER_OTHER 0x80000000
|
||||
|
||||
enum
|
||||
{
|
||||
rserr_ok,
|
||||
|
||||
rserr_invalid_fullscreen,
|
||||
rserr_invalid_mode,
|
||||
|
||||
rserr_unknown
|
||||
} rserr_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int _extMarker;
|
||||
|
||||
//
|
||||
// only qbytes must follow the extensionsBoolMarker
|
||||
//
|
||||
|
||||
char compiled_vertex_array
|
||||
,draw_range_elements
|
||||
,multitexture
|
||||
,texture_cube_map
|
||||
,texture_env_add
|
||||
,texture_env_combine
|
||||
,texture_edge_clamp
|
||||
,texture_filter_anisotropic
|
||||
,texture3D
|
||||
,texture_non_power_of_two
|
||||
,texture_compression
|
||||
,vertex_buffer_object
|
||||
,GLSL
|
||||
,GLSL_branching
|
||||
,GLSL_no_half_types
|
||||
,depth_texture
|
||||
,shadow
|
||||
,occlusion_query
|
||||
,generate_mipmap
|
||||
,vertex_shader
|
||||
,fragment_shader
|
||||
,shader_objects
|
||||
,shading_language_100
|
||||
,bgra
|
||||
,gamma_control
|
||||
,swap_control;
|
||||
} glextinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int renderer;
|
||||
const char *rendererString;
|
||||
const char *vendorString;
|
||||
const char *versionString;
|
||||
const char *extensionsString;
|
||||
const char *glwExtensionsString;
|
||||
|
||||
bool allowCDS;
|
||||
|
||||
int maxTextureSize
|
||||
,maxTextureUnits
|
||||
,maxTextureCubemapSize
|
||||
,maxTextureSize3D
|
||||
,maxTextureFilterAnisotropic
|
||||
,curTextureFilterAnisotropic;
|
||||
|
||||
glextinfo_t ext;
|
||||
} glconfig_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int flags;
|
||||
|
||||
int width, height;
|
||||
bool fullScreen;
|
||||
bool wideScreen;
|
||||
|
||||
bool initializedMedia;
|
||||
|
||||
int previousMode;
|
||||
|
||||
int currentTMU;
|
||||
GLuint *currentTextures;
|
||||
int *currentEnvModes;
|
||||
bool *texIdentityMatrix;
|
||||
int *genSTEnabled; // 0 - disabled, OR 1 - S, OR 2 - T, OR 4 - R
|
||||
int *texCoordArrayMode; // 0 - disabled, 1 - enabled, 2 - cubemap
|
||||
vec4_t draw_color;
|
||||
|
||||
int faceCull;
|
||||
int frontFace;
|
||||
|
||||
float cameraSeparation;
|
||||
bool stereoEnabled;
|
||||
bool stencilEnabled;
|
||||
bool in2DMode;
|
||||
|
||||
bool hwGamma;
|
||||
unsigned short orignalGammaRamp[3*256];
|
||||
} glstate_t;
|
||||
|
||||
extern glconfig_t glConfig;
|
||||
extern glstate_t glState;
|
||||
|
||||
/*
|
||||
====================================================================
|
||||
|
||||
IMPLEMENTATION SPECIFIC FUNCTIONS
|
||||
|
||||
====================================================================
|
||||
*/
|
||||
|
||||
void GLimp_BeginFrame( void );
|
||||
void GLimp_EndFrame( void );
|
||||
int GLimp_Init( void *hinstance, void *wndproc );
|
||||
void GLimp_Shutdown( void );
|
||||
int GLimp_SetMode( int mode, bool fullscreen );
|
||||
void GLimp_AppActivate( bool active );
|
||||
bool GLimp_GetGammaRamp( size_t stride, unsigned short *ramp );
|
||||
void GLimp_SetGammaRamp( size_t stride, unsigned short *ramp );
|
||||
|
||||
void VID_NewWindow( int width, int height );
|
||||
bool VID_GetModeInfo( int *width, int *height, bool *wideScreen, int mode );
|
||||
|
||||
#endif /*__R_GLIMP_H__*/
|
|
@ -71,7 +71,7 @@ int gl_filter_depth = GL_LINEAR;
|
|||
|
||||
void GL_SelectTexture( int tmu )
|
||||
{
|
||||
if( !glConfig.ext.multitexture )
|
||||
if( !GL_Support( R_ARB_MULTITEXTURE ))
|
||||
return;
|
||||
if( tmu == glState.currentTMU )
|
||||
return;
|
||||
|
@ -631,7 +631,7 @@ static int R_TextureFormat( int samples, bool noCompress )
|
|||
{
|
||||
int bits = r_texturebits->integer;
|
||||
|
||||
if( glConfig.ext.texture_compression && !noCompress )
|
||||
if( GL_Support( R_TEXTURE_COMPRESSION_EXT ) && !noCompress )
|
||||
{
|
||||
if( samples == 3 )
|
||||
return GL_COMPRESSED_RGB_ARB;
|
||||
|
@ -669,7 +669,7 @@ void R_Upload32( byte **data, int width, int height, int flags, int *upload_widt
|
|||
|
||||
Com_Assert( samples == NULL );
|
||||
|
||||
if( glConfig.ext.texture_non_power_of_two )
|
||||
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
|
||||
{
|
||||
scaledWidth = width;
|
||||
scaledHeight = height;
|
||||
|
@ -699,16 +699,16 @@ void R_Upload32( byte **data, int width, int height, int flags, int *upload_widt
|
|||
numTextures = 6;
|
||||
target = GL_TEXTURE_CUBE_MAP_ARB;
|
||||
target2 = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
|
||||
scaledWidth = bound( 1, scaledWidth, glConfig.maxTextureCubemapSize );
|
||||
scaledHeight = bound( 1, scaledHeight, glConfig.maxTextureCubemapSize );
|
||||
scaledWidth = bound( 1, scaledWidth, glConfig.max_cubemap_texture_size );
|
||||
scaledHeight = bound( 1, scaledHeight, glConfig.max_cubemap_texture_size );
|
||||
}
|
||||
else
|
||||
{
|
||||
numTextures = 1;
|
||||
target = GL_TEXTURE_2D;
|
||||
target2 = GL_TEXTURE_2D;
|
||||
scaledWidth = bound( 1, scaledWidth, glConfig.maxTextureSize );
|
||||
scaledHeight = bound( 1, scaledHeight, glConfig.maxTextureSize );
|
||||
scaledWidth = bound( 1, scaledWidth, glConfig.max_2d_texture_size );
|
||||
scaledHeight = bound( 1, scaledHeight, glConfig.max_2d_texture_size );
|
||||
}
|
||||
|
||||
if( upload_width )
|
||||
|
@ -758,7 +758,7 @@ void R_Upload32( byte **data, int width, int height, int flags, int *upload_widt
|
|||
pglTexParameteri( target, GL_TEXTURE_MIN_FILTER, gl_filter_depth );
|
||||
pglTexParameteri( target, GL_TEXTURE_MAG_FILTER, gl_filter_depth );
|
||||
|
||||
if( glConfig.ext.texture_filter_anisotropic )
|
||||
if( GL_Support( R_ANISOTROPY_EXT ))
|
||||
pglTexParameteri( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 );
|
||||
}
|
||||
else if( !( flags & IT_NOMIPMAP ) )
|
||||
|
@ -766,16 +766,16 @@ void R_Upload32( byte **data, int width, int height, int flags, int *upload_widt
|
|||
pglTexParameteri( target, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||
pglTexParameteri( target, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
|
||||
if( glConfig.ext.texture_filter_anisotropic )
|
||||
pglTexParameteri( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, glConfig.curTextureFilterAnisotropic );
|
||||
if( GL_Support( R_ANISOTROPY_EXT ))
|
||||
pglTexParameterf( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, glConfig.cur_texture_anisotropy );
|
||||
}
|
||||
else
|
||||
{
|
||||
pglTexParameteri( target, GL_TEXTURE_MIN_FILTER, gl_filter_max );
|
||||
pglTexParameteri( target, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
|
||||
if( glConfig.ext.texture_filter_anisotropic )
|
||||
pglTexParameteri( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 );
|
||||
if( GL_Support( R_ANISOTROPY_EXT ))
|
||||
pglTexParameterf( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f );
|
||||
}
|
||||
|
||||
// clamp if required
|
||||
|
@ -784,7 +784,7 @@ void R_Upload32( byte **data, int width, int height, int flags, int *upload_widt
|
|||
pglTexParameteri( target, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||
pglTexParameteri( target, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
}
|
||||
else if( glConfig.ext.texture_edge_clamp )
|
||||
else if( GL_Support( R_CLAMPTOEDGE_EXT ))
|
||||
{
|
||||
pglTexParameteri( target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
pglTexParameteri( target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
|
@ -810,7 +810,7 @@ void R_Upload32( byte **data, int width, int height, int flags, int *upload_widt
|
|||
}
|
||||
else
|
||||
{
|
||||
bool driverMipmap = glConfig.ext.generate_mipmap && !(flags & IT_CUBEMAP);
|
||||
bool driverMipmap = GL_Support( R_SGIS_MIPMAPS_EXT ) && !(flags & IT_CUBEMAP);
|
||||
|
||||
for( i = 0; i < numTextures; i++, target2++ )
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ void R_Upload32_3D_Fast( byte **data, int width, int height, int depth, int flag
|
|||
|
||||
if( width != scaledWidth || height != scaledHeight || depth != scaledDepth )
|
||||
Host_Error( "R_Upload32_3D: bad texture dimensions (not a power of 2)\n" );
|
||||
if( scaledWidth > glConfig.maxTextureSize3D || scaledHeight > glConfig.maxTextureSize3D || scaledDepth > glConfig.maxTextureSize3D )
|
||||
if( scaledWidth > glConfig.max_3d_texture_size || scaledHeight > glConfig.max_3d_texture_size || scaledDepth > glConfig.max_3d_texture_size )
|
||||
Host_Error( "R_Upload32_3D: texture is too large (resizing is not supported)\n" );
|
||||
|
||||
if( upload_width )
|
||||
|
@ -910,16 +910,16 @@ void R_Upload32_3D_Fast( byte **data, int width, int height, int depth, int flag
|
|||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
|
||||
if( glConfig.ext.texture_filter_anisotropic )
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MAX_ANISOTROPY_EXT, glConfig.curTextureFilterAnisotropic );
|
||||
if( GL_Support( R_ANISOTROPY_EXT ))
|
||||
pglTexParameterf( GL_TEXTURE_3D, GL_TEXTURE_MAX_ANISOTROPY_EXT, glConfig.cur_texture_anisotropy );
|
||||
}
|
||||
else
|
||||
{
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, gl_filter_max );
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
|
||||
if( glConfig.ext.texture_filter_anisotropic )
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 );
|
||||
if( GL_Support( R_ANISOTROPY_EXT ))
|
||||
pglTexParameterf( GL_TEXTURE_3D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f );
|
||||
}
|
||||
|
||||
// clamp if required
|
||||
|
@ -929,7 +929,7 @@ void R_Upload32_3D_Fast( byte **data, int width, int height, int depth, int flag
|
|||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT );
|
||||
}
|
||||
else if( glConfig.ext.texture_edge_clamp )
|
||||
else if( GL_Support( R_CLAMPTOEDGE_EXT ))
|
||||
{
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
pglTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
|
@ -978,7 +978,7 @@ static _inline image_t *R_InitPic( const char *name, byte **pic, int width, int
|
|||
|
||||
pglDeleteTextures( 1, &image->texnum );
|
||||
GL_Bind( 0, image );
|
||||
|
||||
|
||||
if( depth == 1 )
|
||||
R_Upload32( pic, width, height, flags, &image->upload_width, &image->upload_height, &image->samples, false );
|
||||
else
|
||||
|
@ -1159,7 +1159,7 @@ image_t *R_FindImage( const char *name, const char *suffix, int flags, float bum
|
|||
|
||||
if( flags & IT_NORMALMAP )
|
||||
{
|
||||
if( (samples == 3) && glConfig.ext.GLSL )
|
||||
if( (samples == 3) && GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
samples = R_MergeNormalmapDepthmap( pathname, pic, width, height );
|
||||
}
|
||||
else if( flags & IT_HEIGHTMAP )
|
||||
|
@ -1345,7 +1345,7 @@ static byte *R_InitDynamicLightTexture( int *w, int *h, int *depth, int *flags,
|
|||
//
|
||||
// dynamic light texture
|
||||
//
|
||||
if( glConfig.ext.texture3D )
|
||||
if( GL_Support( R_TEXTURE_3D_EXT ))
|
||||
{
|
||||
size = 32;
|
||||
*depth = size;
|
||||
|
@ -1561,14 +1561,17 @@ static void R_InitScreenTexture( image_t **texture, const char *name, int id, in
|
|||
int limit;
|
||||
int width, height;
|
||||
|
||||
limit = glConfig.maxTextureSize;
|
||||
limit = glConfig.max_2d_texture_size;
|
||||
if( size )
|
||||
limit = min( limit, size );
|
||||
|
||||
if( glConfig.ext.texture_non_power_of_two ) {
|
||||
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
|
||||
{
|
||||
width = min( screenWidth, limit );
|
||||
height = min( screenHeight, limit );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = min( limit, min( screenWidth, screenHeight ) );
|
||||
for( size = 2; size <= limit; size <<= 1 );
|
||||
width = height = size >> 1;
|
||||
|
@ -1654,7 +1657,6 @@ static void R_InitBuiltinTextures( void )
|
|||
{ "***r_particletexture***", &r_particletexture, R_InitParticleTexture },
|
||||
{ "***r_fogtexture***", &r_fogtexture, R_InitFogTexture },
|
||||
{ "***r_coronatexture***", &r_coronatexture, R_InitCoronaTexture },
|
||||
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
size_t i, num_builtin_textures = sizeof( textures ) / sizeof( textures[0] ) - 1;
|
||||
|
|
|
@ -115,10 +115,10 @@ void R_AddDynamicLights( unsigned int dlightbits, int state )
|
|||
r_backacc.numColors = 0;
|
||||
|
||||
// we multitexture or texture3D support for dynamic lights
|
||||
if( !glConfig.ext.texture3D && !glConfig.ext.multitexture )
|
||||
if( !GL_Support( R_TEXTURE_3D_EXT ) && !GL_Support( R_ARB_MULTITEXTURE ))
|
||||
return;
|
||||
|
||||
for( i = 0; i < (unsigned)( glConfig.ext.texture3D ? 1 : 2 ); i++ )
|
||||
for( i = 0; i < (unsigned)( GL_Support( R_TEXTURE_3D_EXT ) ? 1 : 2 ); i++ )
|
||||
{
|
||||
GL_SelectTexture( i );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
@ -130,7 +130,7 @@ void R_AddDynamicLights( unsigned int dlightbits, int state )
|
|||
GL_EnableTexGen( GL_Q, 0 );
|
||||
}
|
||||
|
||||
if( glConfig.ext.texture3D )
|
||||
if( GL_Support( R_TEXTURE_3D_EXT ))
|
||||
{
|
||||
GL_EnableTexGen( GL_R, GL_OBJECT_LINEAR );
|
||||
pglDisable( GL_TEXTURE_2D );
|
||||
|
@ -201,7 +201,7 @@ void R_AddDynamicLights( unsigned int dlightbits, int state )
|
|||
xyzFallof[2][2] = inverseIntensity;
|
||||
xyzFallof[2][3] = -dlorigin[2] * inverseIntensity;
|
||||
|
||||
if( glConfig.ext.texture3D )
|
||||
if( GL_Support( R_TEXTURE_3D_EXT ))
|
||||
{
|
||||
pglTexGenfv( GL_R, GL_OBJECT_PLANE, xyzFallof[2] );
|
||||
}
|
||||
|
@ -216,21 +216,21 @@ void R_AddDynamicLights( unsigned int dlightbits, int state )
|
|||
|
||||
if( numTempElems )
|
||||
{
|
||||
if( glConfig.ext.draw_range_elements )
|
||||
if( GL_Support( R_DRAW_RANGEELEMENTS_EXT ))
|
||||
pglDrawRangeElementsEXT( GL_TRIANGLES, 0, r_backacc.numVerts, numTempElems, GL_UNSIGNED_INT, tempElemsArray );
|
||||
else
|
||||
pglDrawElements( GL_TRIANGLES, numTempElems, GL_UNSIGNED_INT, tempElemsArray );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( glConfig.ext.draw_range_elements )
|
||||
if( GL_Support( R_DRAW_RANGEELEMENTS_EXT ))
|
||||
pglDrawRangeElementsEXT( GL_TRIANGLES, 0, r_backacc.numVerts, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
|
||||
else
|
||||
pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
|
||||
}
|
||||
}
|
||||
|
||||
if( glConfig.ext.texture3D )
|
||||
if( GL_Support( R_TEXTURE_3D_EXT ))
|
||||
{
|
||||
GL_EnableTexGen( GL_R, 0 );
|
||||
pglDisable( GL_TEXTURE_3D );
|
||||
|
@ -824,7 +824,7 @@ void R_BuildLightmaps( int numLightmaps, int w, int h, const byte *data, mlightm
|
|||
if( !mapConfig.lightmapsPacking )
|
||||
size = max( w, h );
|
||||
else
|
||||
for( size = 1; ( size < r_lighting_maxlmblocksize->integer ) && ( size < glConfig.maxTextureSize ); size <<= 1 ) ;
|
||||
for( size = 1; ( size < r_lighting_maxlmblocksize->integer ) && ( size < glConfig.max_2d_texture_size ); size <<= 1 ) ;
|
||||
|
||||
if( mapConfig.deluxeMappingEnabled && ( ( size == w ) || ( size == h ) ) )
|
||||
{
|
||||
|
|
|
@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
# define ALIGN(x)
|
||||
#endif
|
||||
|
||||
#include "r_glimp.h"
|
||||
#include "r_public.h"
|
||||
#include "r_opengl.h"
|
||||
|
||||
extern stdlib_api_t com; // engine toolbox
|
||||
extern render_imp_t ri;
|
||||
|
@ -285,6 +285,9 @@ extern ref_entity_t *r_worldent;
|
|||
extern ref_model_t *r_worldmodel;
|
||||
extern mbrushmodel_t *r_worldbrushmodel;
|
||||
|
||||
extern cvar_t *r_colorbits;
|
||||
extern cvar_t *r_depthbits;
|
||||
extern cvar_t *r_stencilbits;
|
||||
extern cvar_t *r_norefresh;
|
||||
extern cvar_t *r_drawentities;
|
||||
extern cvar_t *r_drawworld;
|
||||
|
@ -300,6 +303,11 @@ extern cvar_t *r_overbrightbits;
|
|||
extern cvar_t *r_mapoverbrightbits;
|
||||
extern cvar_t *r_lefthand;
|
||||
extern cvar_t *r_physbdebug;
|
||||
extern cvar_t *r_check_errors;
|
||||
extern cvar_t *r_allow_software;
|
||||
extern cvar_t *r_frontbuffer;
|
||||
extern cvar_t *r_width;
|
||||
extern cvar_t *r_height;
|
||||
|
||||
extern cvar_t *r_flares;
|
||||
extern cvar_t *r_flaresize;
|
||||
|
@ -374,7 +382,7 @@ extern cvar_t *r_skymip;
|
|||
extern cvar_t *r_clear;
|
||||
extern cvar_t *r_polyblend;
|
||||
extern cvar_t *r_lockpvs;
|
||||
extern cvar_t *r_swapinterval;
|
||||
extern cvar_t *r_swapInterval;
|
||||
|
||||
extern cvar_t *gl_finish;
|
||||
extern cvar_t *gl_delayfinish;
|
||||
|
@ -383,6 +391,7 @@ extern cvar_t *gl_extensions;
|
|||
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_multiscreen_head;
|
||||
extern cvar_t *vid_displayfrequency;
|
||||
|
||||
//====================================================================
|
||||
|
||||
|
@ -446,7 +455,7 @@ enum
|
|||
|
||||
#define OCCLUSION_QUERIES_CVAR_HACK( RI ) ( !(r_occlusion_queries->integer == 2 && r_shadows->integer != SHADOW_MAPPING) \
|
||||
|| ((RI).refdef.rdflags & RDF_PORTALINVIEW) )
|
||||
#define OCCLUSION_QUERIES_ENABLED( RI ) ( glConfig.ext.occlusion_query && r_occlusion_queries->integer && r_drawentities->integer \
|
||||
#define OCCLUSION_QUERIES_ENABLED( RI ) ( GL_Support( R_OCCLUSION_QUERIES_EXT ) && r_occlusion_queries->integer && r_drawentities->integer \
|
||||
&& !((RI).params & RP_NONVIEWERREF) && !((RI).refdef.rdflags & RDF_NOWORLDMODEL) \
|
||||
&& OCCLUSION_QUERIES_CVAR_HACK( RI ) )
|
||||
#define OCCLUSION_OPAQUE_SHADER( s ) ( ((s)->sort == SHADER_SORT_OPAQUE ) && ((s)->flags & SHADER_DEPTHWRITE ) && !(s)->numdeforms )
|
||||
|
@ -656,6 +665,11 @@ msurface_t *R_TransformedTraceLine( trace_t *tr, const vec3_t start, const vec3_
|
|||
void R_Restart( void );
|
||||
void R_Shutdown( bool verbose );
|
||||
|
||||
//
|
||||
// r_opengl.c
|
||||
//
|
||||
void R_CheckForErrors_( const char *filename, const int fileline );
|
||||
#define R_CheckForErrors() R_CheckForErrors_( __FILE__, __LINE__ )
|
||||
|
||||
//
|
||||
// r_surf.c
|
||||
|
|
104
render/r_main.c
104
render/r_main.c
|
@ -879,7 +879,7 @@ void R_Set2DMode( bool enable )
|
|||
glState.in2DMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
int num_adds = 0;
|
||||
/*
|
||||
===============
|
||||
R_DrawStretchPic
|
||||
|
@ -890,7 +890,8 @@ void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, f
|
|||
int bcolor;
|
||||
ref_shader_t *shader = &r_shaders[shadernum]; // FIXME: check bounds
|
||||
|
||||
if( !shader ) return;
|
||||
// if( !shader )
|
||||
return;
|
||||
|
||||
// lower-left
|
||||
Vector2Set( pic_xyz[0], x, y );
|
||||
|
@ -1189,9 +1190,6 @@ static void R_SetupProjectionMatrix( const ref_params_t *rd, mat4x4_t m )
|
|||
xMax = zNear *tan( rd->fov_x *M_PI / 360.0 );
|
||||
xMin = -xMax;
|
||||
|
||||
xMin += -( 2 * glState.cameraSeparation ) / zNear;
|
||||
xMax += -( 2 * glState.cameraSeparation ) / zNear;
|
||||
|
||||
m[0] = ( 2.0 * zNear ) / ( xMax - xMin );
|
||||
m[1] = 0.0f;
|
||||
m[2] = 0.0f;
|
||||
|
@ -1870,52 +1868,6 @@ void R_RenderView( const ref_params_t *fd )
|
|||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
/*
|
||||
===============
|
||||
R_UpdateSwapInterval
|
||||
===============
|
||||
*/
|
||||
static void R_UpdateSwapInterval( void )
|
||||
{
|
||||
if( r_swapinterval->modified )
|
||||
{
|
||||
r_swapinterval->modified = false;
|
||||
|
||||
if( !glState.stereoEnabled )
|
||||
{
|
||||
if( pglSwapInterval )
|
||||
pglSwapInterval( r_swapinterval->integer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_UpdateHWGamma
|
||||
===============
|
||||
*/
|
||||
static void R_UpdateHWGamma( void )
|
||||
{
|
||||
int i, v;
|
||||
double invGamma, div;
|
||||
unsigned short gammaRamp[3*256];
|
||||
|
||||
if( !glState.hwGamma )
|
||||
return;
|
||||
|
||||
invGamma = 1.0 / bound( 0.5, r_gamma->value, 3 );
|
||||
div = (double)( 1 << max( 0, r_overbrightbits->integer ) ) / 255.5;
|
||||
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
v = ( int )( 65535.0 * pow( ( (double)i + 0.5 ) * div, invGamma ) + 0.5 );
|
||||
gammaRamp[i] = gammaRamp[i + 256] = gammaRamp[i + 512] = ( ( unsigned short )bound( 0, v, 65535 ) );
|
||||
}
|
||||
|
||||
GLimp_SetGammaRamp( 256, gammaRamp );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_BeginFrame
|
||||
|
@ -1923,8 +1875,6 @@ R_BeginFrame
|
|||
*/
|
||||
void R_BeginFrame( void )
|
||||
{
|
||||
glState.cameraSeparation = 0.0f;
|
||||
|
||||
if( gl_finish->integer && gl_delayfinish->integer )
|
||||
{
|
||||
// flush any remaining 2D bits
|
||||
|
@ -1935,10 +1885,22 @@ void R_BeginFrame( void )
|
|||
|
||||
pglFinish();
|
||||
|
||||
GLimp_EndFrame();
|
||||
R_CheckForErrors ();
|
||||
|
||||
// Swap the buffers
|
||||
if( !r_frontbuffer->integer )
|
||||
{
|
||||
if( !pwglSwapBuffers( glw_state.hDC ))
|
||||
Sys_Break( "R_EndFrame() - SwapBuffers() failed!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
GLimp_BeginFrame();
|
||||
pglDrawBuffer( GL_BACK );
|
||||
|
||||
if( r_colorbits->modified )
|
||||
{
|
||||
r_colorbits->modified = false;
|
||||
}
|
||||
|
||||
if( r_environment_color->modified )
|
||||
{
|
||||
|
@ -1977,7 +1939,7 @@ void R_BeginFrame( void )
|
|||
if( r_gamma->modified )
|
||||
{
|
||||
r_gamma->modified = false;
|
||||
R_UpdateHWGamma();
|
||||
GL_UpdateGammaRamp();
|
||||
}
|
||||
|
||||
// run cinematic passes on shaders
|
||||
|
@ -1987,17 +1949,13 @@ void R_BeginFrame( void )
|
|||
R_Set2DMode( true );
|
||||
|
||||
// draw buffer stuff
|
||||
if( gl_drawbuffer->modified )
|
||||
if( r_frontbuffer->modified )
|
||||
{
|
||||
gl_drawbuffer->modified = false;
|
||||
r_frontbuffer->modified = false;
|
||||
|
||||
if( glState.cameraSeparation == 0 || !glState.stereoEnabled )
|
||||
{
|
||||
if( com.stricmp( gl_drawbuffer->string, "GL_FRONT" ) == 0 )
|
||||
pglDrawBuffer( GL_FRONT );
|
||||
else
|
||||
pglDrawBuffer( GL_BACK );
|
||||
}
|
||||
if( r_frontbuffer->integer )
|
||||
pglDrawBuffer( GL_FRONT );
|
||||
else pglDrawBuffer( GL_BACK );
|
||||
}
|
||||
|
||||
// texturemode stuff
|
||||
|
@ -2008,7 +1966,7 @@ void R_BeginFrame( void )
|
|||
}
|
||||
|
||||
// swapinterval stuff
|
||||
R_UpdateSwapInterval();
|
||||
GL_UpdateSwapInterval();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2138,7 +2096,7 @@ void R_RenderScene( const ref_params_t *fd )
|
|||
|
||||
/*
|
||||
===============
|
||||
R_BeginFrame
|
||||
R_EndFrame
|
||||
===============
|
||||
*/
|
||||
void R_EndFrame( void )
|
||||
|
@ -2161,7 +2119,14 @@ void R_EndFrame( void )
|
|||
return;
|
||||
}
|
||||
|
||||
GLimp_EndFrame();
|
||||
R_CheckForErrors ();
|
||||
|
||||
// Swap the buffers
|
||||
if( !r_frontbuffer->integer )
|
||||
{
|
||||
if( !pwglSwapBuffers( glw_state.hDC ))
|
||||
Sys_Break( "R_EndFrame() - SwapBuffers() failed!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2426,7 +2391,10 @@ bool R_AddGenericEntity( edict_t *pRefEntity, ref_entity_t *refent, int ed_type,
|
|||
}
|
||||
|
||||
if( refent->ent_type == ED_CLIENT )
|
||||
{
|
||||
refent->gaitsequence = pRefEntity->v.gaitsequence;
|
||||
refent->flags |= RF_OCCLUSIONTEST;
|
||||
}
|
||||
else refent->gaitsequence = 0;
|
||||
|
||||
// because entity without models never added to scene
|
||||
|
|
|
@ -529,7 +529,7 @@ static void Mod_CheckDeluxemaps( const lump_t *l, byte *lmData )
|
|||
}
|
||||
|
||||
mapConfig.deluxeMaps = true;
|
||||
if( glConfig.ext.GLSL )
|
||||
if(GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
mapConfig.deluxeMappingEnabled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,667 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// r_opengl.c - openg32.dll handler
|
||||
//=======================================================================
|
||||
|
||||
#include "r_local.h"
|
||||
|
||||
glwstate_t glw_state;
|
||||
|
||||
#define MAX_PFDS 256
|
||||
#define num_vidmodes ((int)(sizeof(vidmode) / sizeof(vidmode[0])) - 1)
|
||||
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE)
|
||||
#define GL_DRIVER_OPENGL "OpenGL32"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
rserr_ok,
|
||||
rserr_invalid_fullscreen,
|
||||
rserr_invalid_mode,
|
||||
rserr_unknown
|
||||
} rserr_t;
|
||||
|
||||
typedef struct vidmode_s
|
||||
{
|
||||
const char *desc;
|
||||
int width;
|
||||
int height;
|
||||
float pixelheight;
|
||||
} vidmode_t;
|
||||
|
||||
vidmode_t vidmode[] =
|
||||
{
|
||||
{"Mode 0: 4x3", 640, 480, 1 },
|
||||
{"Mode 1: 4x3", 800, 600, 1 },
|
||||
{"Mode 2: 4x3", 1024, 768, 1 },
|
||||
{"Mode 3: 4x3", 1152, 864, 1 },
|
||||
{"Mode 4: 4x3", 1280, 960, 1 },
|
||||
{"Mode 5: 4x3", 1400, 1050, 1 },
|
||||
{"Mode 6: 4x3", 1600, 1200, 1 },
|
||||
{"Mode 7: 4x3", 1920, 1440, 1 },
|
||||
{"Mode 8: 4x3", 2048, 1536, 1 },
|
||||
{"Mode 9: 14x9", 840, 540, 1 },
|
||||
{"Mode 10: 14x9", 1680, 1080, 1 },
|
||||
{"Mode 11: 16x9", 640, 360, 1 },
|
||||
{"Mode 12: 16x9", 683, 384, 1 },
|
||||
{"Mode 13: 16x9", 960, 540, 1 },
|
||||
{"Mode 14: 16x9", 1280, 720, 1 },
|
||||
{"Mode 15: 16x9", 1366, 768, 1 },
|
||||
{"Mode 16: 16x9", 1920, 1080, 1 },
|
||||
{"Mode 17: 16x9", 2560, 1440, 1 },
|
||||
{"Mode 18: NTSC", 360, 240, 1.125f },
|
||||
{"Mode 19: NTSC", 720, 480, 1.125f },
|
||||
{"Mode 20: PAL ", 360, 283, 0.9545f },
|
||||
{"Mode 21: PAL ", 720, 566, 0.9545f },
|
||||
{NULL, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static dllfunc_t wgl_funcs[] =
|
||||
{
|
||||
{"wglChoosePixelFormat", (void **) &pwglChoosePixelFormat},
|
||||
{"wglDescribePixelFormat", (void **) &pwglDescribePixelFormat},
|
||||
// {"wglGetPixelFormat", (void **) &pwglGetPixelFormat},
|
||||
{"wglSetPixelFormat", (void **) &pwglSetPixelFormat},
|
||||
{"wglSwapBuffers", (void **) &pwglSwapBuffers},
|
||||
{"wglCreateContext", (void **) &pwglCreateContext},
|
||||
{"wglDeleteContext", (void **) &pwglDeleteContext},
|
||||
{"wglGetProcAddress", (void **) &pwglGetProcAddress},
|
||||
{"wglMakeCurrent", (void **) &pwglMakeCurrent},
|
||||
{"wglGetCurrentContext", (void **) &pwglGetCurrentContext},
|
||||
{"wglGetCurrentDC", (void **) &pwglGetCurrentDC},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
dll_info_t opengl_dll = { "opengl32.dll", wgl_funcs, NULL, NULL, NULL, true, 0 };
|
||||
|
||||
bool R_DeleteContext( void )
|
||||
{
|
||||
if( glw_state.hGLRC )
|
||||
{
|
||||
pwglDeleteContext( glw_state.hGLRC );
|
||||
glw_state.hGLRC = NULL;
|
||||
}
|
||||
if( glw_state.hDC )
|
||||
{
|
||||
ReleaseDC( glw_state.hWnd, glw_state.hDC );
|
||||
glw_state.hDC = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_ChoosePFD
|
||||
=================
|
||||
*/
|
||||
static int R_ChoosePFD( int colorBits, int depthBits, int stencilBits )
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR PFDs[MAX_PFDS], *current, *selected;
|
||||
int i, numPFDs, pixelFormat = 0;
|
||||
uint flags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
|
||||
|
||||
MsgDev( D_NOTE, "R_ChoosePFD( %i, %i, %i )\n", colorBits, depthBits, stencilBits);
|
||||
|
||||
// Count PFDs
|
||||
if( glw_state.minidriver )
|
||||
numPFDs = pwglDescribePixelFormat( glw_state.hDC, 0, 0, NULL );
|
||||
else numPFDs = DescribePixelFormat( glw_state.hDC, 0, 0, NULL );
|
||||
|
||||
if( numPFDs > MAX_PFDS )
|
||||
{
|
||||
MsgDev( D_NOTE, "too many PFDs returned (%i > %i), reduce it\n", numPFDs, MAX_PFDS );
|
||||
numPFDs = MAX_PFDS;
|
||||
}
|
||||
else if( numPFDs < 1 )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_ChoosePFD failed\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
MsgDev( D_NOTE, "R_ChoosePFD: %i PFDs found\n", numPFDs );
|
||||
|
||||
// run through all the PFDs, looking for the best match
|
||||
for( i = 1, current = PFDs; i <= numPFDs; i++, current++ )
|
||||
{
|
||||
if( glw_state.minidriver )
|
||||
pwglDescribePixelFormat( glw_state.hDC, i, sizeof( PIXELFORMATDESCRIPTOR ), current );
|
||||
else DescribePixelFormat( glw_state.hDC, i, sizeof( PIXELFORMATDESCRIPTOR ), current );
|
||||
|
||||
// check acceleration
|
||||
if(( current->dwFlags & PFD_GENERIC_FORMAT ) && !r_allow_software->integer )
|
||||
{
|
||||
MsgDev( D_NOTE, "PFD %i rejected, software acceleration\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
// check flags
|
||||
if(( current->dwFlags & flags ) != flags )
|
||||
{
|
||||
MsgDev( D_NOTE, "PFD %i rejected, improper flags (0x%x instead of 0x%x)\n", i, current->dwFlags, flags );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check pixel type
|
||||
if( current->iPixelType != PFD_TYPE_RGBA )
|
||||
{
|
||||
MsgDev( D_NOTE, "PFD %i rejected, not RGBA\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
// check color bits
|
||||
if( current->cColorBits < colorBits )
|
||||
{
|
||||
MsgDev( D_NOTE, "PFD %i rejected, insufficient color bits (%i < %i)\n", i, current->cColorBits, colorBits );
|
||||
continue;
|
||||
}
|
||||
|
||||
// check depth bits
|
||||
if( current->cDepthBits < depthBits )
|
||||
{
|
||||
MsgDev( D_NOTE, "PFD %i rejected, insufficient depth bits (%i < %i)\n", i, current->cDepthBits, depthBits );
|
||||
continue;
|
||||
}
|
||||
|
||||
// check stencil bits
|
||||
if( current->cStencilBits < stencilBits )
|
||||
{
|
||||
MsgDev( D_NOTE, "PFD %i rejected, insufficient stencil bits (%i < %i)\n", i, current->cStencilBits, stencilBits );
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we don't have a selected PFD yet, then use it
|
||||
if( !pixelFormat )
|
||||
{
|
||||
selected = current;
|
||||
pixelFormat = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( colorBits != selected->cColorBits )
|
||||
{
|
||||
if( colorBits == current->cColorBits || current->cColorBits > selected->cColorBits )
|
||||
{
|
||||
selected = current;
|
||||
pixelFormat = i;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if( depthBits != selected->cDepthBits )
|
||||
{
|
||||
if( depthBits == current->cDepthBits || current->cDepthBits > selected->cDepthBits )
|
||||
{
|
||||
selected = current;
|
||||
pixelFormat = i;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if( stencilBits != selected->cStencilBits )
|
||||
{
|
||||
if( stencilBits == current->cStencilBits || current->cStencilBits > selected->cStencilBits )
|
||||
{
|
||||
selected = current;
|
||||
pixelFormat = i;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !pixelFormat )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_ChoosePFD: no hardware acceleration found\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( selected->dwFlags & PFD_GENERIC_FORMAT )
|
||||
{
|
||||
if( selected->dwFlags & PFD_GENERIC_ACCELERATED )
|
||||
{
|
||||
MsgDev( D_NOTE, "R_ChoosePFD:: MCD acceleration found\n" );
|
||||
glw_state.software = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgDev( D_NOTE, "R_ChoosePFD: using software emulation\n" );
|
||||
glw_state.software = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgDev( D_NOTE, "using hardware acceleration\n");
|
||||
glw_state.software = false;
|
||||
}
|
||||
MsgDev( D_LOAD, "R_ChoosePFD: PIXELFORMAT %i selected\n", pixelFormat );
|
||||
|
||||
return pixelFormat;
|
||||
}
|
||||
|
||||
bool R_SetPixelformat( void )
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR PFD;
|
||||
int colorBits, depthBits, stencilBits;
|
||||
int pixelFormat;
|
||||
size_t gamma_size;
|
||||
byte *savedGamma;
|
||||
|
||||
Sys_LoadLibrary( &opengl_dll ); // load opengl32.dll
|
||||
if( !opengl_dll.link ) return false;
|
||||
|
||||
glw_state.minidriver = false; // FIXME
|
||||
|
||||
if( glw_state.minidriver )
|
||||
{
|
||||
if(( glw_state.hDC = pwglGetCurrentDC()) == NULL )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(( glw_state.hDC = GetDC( glw_state.hWnd )) == NULL )
|
||||
return false;
|
||||
}
|
||||
|
||||
// set color/depth/stencil
|
||||
colorBits = (r_colorbits->integer) ? r_colorbits->integer : 32;
|
||||
depthBits = (r_depthbits->integer) ? r_depthbits->integer : 24;
|
||||
stencilBits = (r_stencilbits->integer) ? r_stencilbits->integer : 0;
|
||||
|
||||
// choose a pixel format
|
||||
pixelFormat = R_ChoosePFD( colorBits, depthBits, stencilBits );
|
||||
if( !pixelFormat )
|
||||
{
|
||||
// try again with default color/depth/stencil
|
||||
if( colorBits > 16 || depthBits > 16 || stencilBits > 0 )
|
||||
pixelFormat = R_ChoosePFD( 16, 16, 0 );
|
||||
else pixelFormat = R_ChoosePFD( 32, 24, 0 );
|
||||
|
||||
if( !pixelFormat )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_SetPixelformat: failed to find an appropriate PIXELFORMAT\n" );
|
||||
ReleaseDC( glw_state.hWnd, glw_state.hDC );
|
||||
glw_state.hDC = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// set the pixel format
|
||||
if( glw_state.minidriver )
|
||||
{
|
||||
pwglDescribePixelFormat( glw_state.hDC, pixelFormat, sizeof( PIXELFORMATDESCRIPTOR ), &PFD );
|
||||
|
||||
if( !pwglSetPixelFormat( glw_state.hDC, pixelFormat, &PFD ))
|
||||
{
|
||||
MsgDev( D_ERROR, "R_SetPixelformat: wglSetPixelFormat failed\n" );
|
||||
return R_DeleteContext();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DescribePixelFormat( glw_state.hDC, pixelFormat, sizeof( PIXELFORMATDESCRIPTOR ), &PFD );
|
||||
|
||||
if( !SetPixelFormat( glw_state.hDC, pixelFormat, &PFD ))
|
||||
{
|
||||
MsgDev( D_ERROR, "R_SetPixelformat: failed\n" );
|
||||
return R_DeleteContext();
|
||||
}
|
||||
}
|
||||
|
||||
glConfig.color_bits = PFD.cColorBits;
|
||||
glConfig.depth_bits = PFD.cDepthBits;
|
||||
glConfig.stencil_bits = PFD.cStencilBits;
|
||||
|
||||
if(!(glw_state.hGLRC = pwglCreateContext( glw_state.hDC )))
|
||||
return R_DeleteContext();
|
||||
if(!(pwglMakeCurrent( glw_state.hDC, glw_state.hGLRC )))
|
||||
return R_DeleteContext();
|
||||
|
||||
// print out PFD specifics
|
||||
MsgDev( D_NOTE, "GL PFD: color(%d-bits) Z(%d-bit)\n", ( int )PFD.cColorBits, ( int )PFD.cDepthBits );
|
||||
|
||||
// init gamma ramp
|
||||
ZeroMemory( glState.stateRamp, sizeof(glState.stateRamp));
|
||||
|
||||
if( pwglGetDeviceGammaRamp3DFX )
|
||||
glConfig.deviceSupportsGamma = pwglGetDeviceGammaRamp3DFX( glw_state.hDC, glState.stateRamp );
|
||||
else glConfig.deviceSupportsGamma = GetDeviceGammaRamp( glw_state.hDC, glState.stateRamp );
|
||||
savedGamma = FS_LoadFile( "config/gamma.rc", &gamma_size );
|
||||
if( !savedGamma || gamma_size != sizeof( glState.stateRamp ))
|
||||
{
|
||||
// saved gamma not found or corrupted file
|
||||
FS_WriteFile( "config/gamma.rc", glState.stateRamp, sizeof(glState.stateRamp));
|
||||
Msg( "gamma.rc initialized\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_BuildGammaTable();
|
||||
|
||||
// validate base gamma
|
||||
if( !memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// all ok, previous gamma is valid
|
||||
MsgDev( D_NOTE, "R_SetPixelformat: validate screen gamma - ok\n" );
|
||||
}
|
||||
else if( !memcmp( glState.gammaRamp, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// screen gamma is equal to render gamma (probably previous instance crashed)
|
||||
// run additional check to make sure it
|
||||
if( memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// yes, current gamma it's totally wrong, restore it from gamma.rc
|
||||
MsgDev( D_NOTE, "R_SetPixelformat: restore original gamma after crash\n" );
|
||||
Mem_Copy( glState.stateRamp, savedGamma, sizeof( glState.gammaRamp ));
|
||||
}
|
||||
else
|
||||
{
|
||||
// oops, savedGamma == glState.stateRamp == glState.gammaRamp
|
||||
// probably r_gamma set as default
|
||||
MsgDev( D_NOTE, "R_SetPixelformat: validate screen gamma - disabled\n" );
|
||||
}
|
||||
}
|
||||
else if( !memcmp( glState.gammaRamp, savedGamma, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// saved gamma is equal render gamma, probably gamma.rc writed after crash
|
||||
// run additional check to make sure it
|
||||
if( memcmp( savedGamma, glState.stateRamp, sizeof( glState.stateRamp )))
|
||||
{
|
||||
// yes, saved gamma it's totally wrong, get origianl gamma from screen
|
||||
MsgDev( D_NOTE, "R_SetPixelformat: merge gamma.rc after crash\n" );
|
||||
FS_WriteFile( "config/gamma.rc", glState.stateRamp, sizeof( glState.stateRamp ));
|
||||
}
|
||||
else
|
||||
{
|
||||
// oops, savedGamma == glState.stateRamp == glState.gammaRamp
|
||||
// probably r_gamma set as default
|
||||
MsgDev( D_NOTE, "R_SetPixelformat: validate screen gamma - disabled\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// current gamma unset by other application, we can restore it here
|
||||
MsgDev( D_NOTE, "R_SetPixelformat: restore original gamma after crash\n" );
|
||||
Mem_Copy( glState.stateRamp, savedGamma, sizeof( glState.gammaRamp ));
|
||||
}
|
||||
}
|
||||
r_gamma->modified = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void R_Free_OpenGL( void )
|
||||
{
|
||||
SetDeviceGammaRamp( glw_state.hDC, glState.stateRamp );
|
||||
|
||||
if( pwglMakeCurrent ) pwglMakeCurrent( NULL, NULL );
|
||||
if( glw_state.hGLRC )
|
||||
{
|
||||
if( pwglDeleteContext ) pwglDeleteContext( glw_state.hGLRC );
|
||||
glw_state.hGLRC = NULL;
|
||||
}
|
||||
if( glw_state.hDC )
|
||||
{
|
||||
ReleaseDC( glw_state.hWnd, glw_state.hDC );
|
||||
glw_state.hDC = NULL;
|
||||
}
|
||||
if( glw_state.hWnd )
|
||||
{
|
||||
DestroyWindow ( glw_state.hWnd );
|
||||
glw_state.hWnd = NULL;
|
||||
}
|
||||
UnregisterClass( "Xash Window", glw_state.hInst );
|
||||
|
||||
if( glConfig.fullscreen )
|
||||
{
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
glConfig.fullscreen = false;
|
||||
}
|
||||
Sys_FreeLibrary( &opengl_dll );
|
||||
|
||||
// now all extensions are disabled
|
||||
Mem_Set( glConfig.extension, 0, sizeof( glConfig.extension[0] ) * R_EXTCOUNT );
|
||||
glw_state.initialized = false;
|
||||
}
|
||||
|
||||
void R_SaveVideoMode( int vid_mode )
|
||||
{
|
||||
int i = bound( 0, vid_mode, num_vidmodes ); // check range
|
||||
|
||||
Cvar_FullSet( "width", va( "%i", vidmode[i].width ), CVAR_READ_ONLY );
|
||||
Cvar_FullSet( "height", va( "%i", vidmode[i].height ), CVAR_READ_ONLY );
|
||||
Cvar_SetValue( "r_mode", i ); // merge if out of bounds
|
||||
MsgDev( D_NOTE, "Set: %s [%dx%d]\n", vidmode[i].desc, vidmode[i].width, vidmode[i].height );
|
||||
}
|
||||
|
||||
bool R_CreateWindow( int width, int height, bool fullscreen )
|
||||
{
|
||||
WNDCLASS wc;
|
||||
RECT rect;
|
||||
cvar_t *r_xpos, *r_ypos;
|
||||
int stylebits = WINDOW_STYLE;
|
||||
int x = 0, y = 0, w, h;
|
||||
int exstyle = 0;
|
||||
static char wndname[128];
|
||||
|
||||
com.strcpy( wndname, GI->title );
|
||||
|
||||
// register the frame class
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = (WNDPROC)glw_state.wndproc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = glw_state.hInst;
|
||||
wc.hIcon = LoadIcon( glw_state.hInst, MAKEINTRESOURCE( 101 ));
|
||||
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
wc.hbrBackground = (void *)COLOR_3DSHADOW;
|
||||
wc.lpszClassName = "Xash Window";
|
||||
wc.lpszMenuName = 0;
|
||||
|
||||
if( !RegisterClass( &wc ))
|
||||
{
|
||||
MsgDev( D_ERROR, "R_CreateWindow: couldn't register window class %s\n" "Xash Window" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( fullscreen )
|
||||
{
|
||||
exstyle = WS_EX_TOPMOST;
|
||||
stylebits = WS_POPUP|WS_VISIBLE;
|
||||
}
|
||||
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
|
||||
AdjustWindowRect( &rect, stylebits, FALSE );
|
||||
w = rect.right - rect.left;
|
||||
h = rect.bottom - rect.top;
|
||||
|
||||
if( !fullscreen )
|
||||
{
|
||||
r_xpos = Cvar_Get( "r_xpos", "3", CVAR_ARCHIVE, "window position by horizontal" );
|
||||
r_ypos = Cvar_Get( "r_ypos", "22", CVAR_ARCHIVE, "window position by vertical" );
|
||||
x = r_xpos->integer;
|
||||
y = r_ypos->integer;
|
||||
}
|
||||
|
||||
glw_state.hWnd = CreateWindowEx( exstyle, "Xash Window", wndname, stylebits, x, y, w, h, NULL, NULL, glw_state.hInst, NULL );
|
||||
|
||||
if( !glw_state.hWnd )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_CreateWindow: couldn't create window %s\n", wndname );
|
||||
return false;
|
||||
}
|
||||
|
||||
ShowWindow( glw_state.hWnd, SW_SHOW );
|
||||
UpdateWindow( glw_state.hWnd );
|
||||
|
||||
// init all the gl stuff for the window
|
||||
if( !R_SetPixelformat( ))
|
||||
{
|
||||
ShowWindow( glw_state.hWnd, SW_HIDE );
|
||||
DestroyWindow( glw_state.hWnd );
|
||||
glw_state.hWnd = NULL;
|
||||
|
||||
UnregisterClass( "Xash Window", glw_state.hInst );
|
||||
MsgDev( D_ERROR, "OpenGL driver not installed\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
SetForegroundWindow( glw_state.hWnd );
|
||||
SetFocus( glw_state.hWnd );
|
||||
return true;
|
||||
}
|
||||
|
||||
rserr_t R_ChangeDisplaySettings( int vid_mode, bool fullscreen )
|
||||
{
|
||||
int width, height;
|
||||
|
||||
R_SaveVideoMode( vid_mode );
|
||||
|
||||
width = r_width->integer;
|
||||
height = r_height->integer;
|
||||
|
||||
// destroy the existing window
|
||||
if( glw_state.hWnd ) R_Free_OpenGL();
|
||||
|
||||
// do a CDS if needed
|
||||
if( fullscreen )
|
||||
{
|
||||
DEVMODE dm;
|
||||
|
||||
ZeroMemory( &dm, sizeof( dm ));
|
||||
dm.dmSize = sizeof( dm );
|
||||
dm.dmPelsWidth = width;
|
||||
dm.dmPelsHeight = height;
|
||||
dm.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
|
||||
if( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) == DISP_CHANGE_SUCCESSFUL )
|
||||
{
|
||||
glConfig.fullscreen = true;
|
||||
if( !R_CreateWindow( width, height, true ))
|
||||
return rserr_invalid_mode;
|
||||
return rserr_ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
dm.dmPelsWidth = width * 2;
|
||||
dm.dmPelsHeight = height;
|
||||
dm.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
if( r_depthbits->integer != 0 )
|
||||
{
|
||||
dm.dmBitsPerPel = r_depthbits->integer;
|
||||
dm.dmFields |= DM_BITSPERPEL;
|
||||
}
|
||||
|
||||
// our first CDS failed, so maybe we're running on some weird dual monitor system
|
||||
if( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL )
|
||||
{
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
glConfig.fullscreen = false;
|
||||
if( !R_CreateWindow( width, height, false ))
|
||||
return rserr_invalid_mode;
|
||||
return rserr_invalid_fullscreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !R_CreateWindow( width, height, true ))
|
||||
return rserr_invalid_mode;
|
||||
glConfig.fullscreen = true;
|
||||
return rserr_ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
glConfig.fullscreen = false;
|
||||
if( !R_CreateWindow( width, height, false ))
|
||||
return rserr_invalid_mode;
|
||||
}
|
||||
return rserr_ok;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
R_Init_OpenGL
|
||||
==================
|
||||
*/
|
||||
bool R_Init_OpenGL( void )
|
||||
{
|
||||
rserr_t err;
|
||||
bool fullscreen;
|
||||
|
||||
fullscreen = vid_fullscreen->integer;
|
||||
vid_fullscreen->modified = false;
|
||||
r_mode->modified = false;
|
||||
|
||||
if(( err = R_ChangeDisplaySettings( r_mode->integer, fullscreen )) == rserr_ok )
|
||||
{
|
||||
glConfig.prev_mode = r_mode->integer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( err == rserr_invalid_fullscreen )
|
||||
{
|
||||
Cvar_SetValue( "fullscreen", 0 );
|
||||
vid_fullscreen->modified = false;
|
||||
MsgDev( D_ERROR, "R_SetMode: fullscreen unavailable in this mode\n" );
|
||||
if(( err = R_ChangeDisplaySettings( r_mode->integer, false )) == rserr_ok )
|
||||
return true;
|
||||
}
|
||||
else if( err == rserr_invalid_mode )
|
||||
{
|
||||
Cvar_SetValue( "r_mode", glConfig.prev_mode );
|
||||
r_mode->modified = false;
|
||||
MsgDev( D_ERROR, "R_SetMode: invalid mode\n" );
|
||||
}
|
||||
// try setting it back to something safe
|
||||
if(( err = R_ChangeDisplaySettings( glConfig.prev_mode, false )) != rserr_ok )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_SetMode: could not revert to safe mode\n" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_CheckForErrors
|
||||
=================
|
||||
*/
|
||||
void R_CheckForErrors_( const char *filename, const int fileline )
|
||||
{
|
||||
int err;
|
||||
char *str;
|
||||
|
||||
if( !r_check_errors->integer )
|
||||
return;
|
||||
if((err = pglGetError()) == GL_NO_ERROR )
|
||||
return;
|
||||
|
||||
switch( err )
|
||||
{
|
||||
case GL_STACK_OVERFLOW:
|
||||
str = "GL_STACK_OVERFLOW";
|
||||
break;
|
||||
case GL_STACK_UNDERFLOW:
|
||||
str = "GL_STACK_UNDERFLOW";
|
||||
break;
|
||||
case GL_INVALID_ENUM:
|
||||
str = "GL_INVALID_ENUM";
|
||||
break;
|
||||
case GL_INVALID_VALUE:
|
||||
str = "GL_INVALID_VALUE";
|
||||
break;
|
||||
case GL_INVALID_OPERATION:
|
||||
str = "GL_INVALID_OPERATION";
|
||||
break;
|
||||
case GL_OUT_OF_MEMORY:
|
||||
str = "GL_OUT_OF_MEMORY";
|
||||
break;
|
||||
default:
|
||||
str = "UNKNOWN ERROR";
|
||||
break;
|
||||
}
|
||||
Host_Error( "R_CheckForErrors: %s (called at %s:%i)\n", str, filename, fileline );
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -89,14 +89,14 @@ void R_InitGLSLPrograms( void )
|
|||
|
||||
memset( r_glslprograms, 0, sizeof( r_glslprograms ) );
|
||||
|
||||
if( !glConfig.ext.GLSL )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
return;
|
||||
|
||||
r_glslProgramsPool = Mem_AllocPool( "GLSL Programs" );
|
||||
|
||||
if( glConfig.ext.GLSL_branching )
|
||||
if( GL_Support( R_GLSL_BRANCHING ))
|
||||
features |= PROGRAM_APPLY_BRANCHING;
|
||||
if( glConfig.ext.GLSL_no_half_types )
|
||||
if( GL_Support( R_GLSL_NO_HALF_TYPES ))
|
||||
features |= PROGRAM_APPLY_NO_HALF_TYPES;
|
||||
|
||||
// register programs that are most likely to be used
|
||||
|
@ -888,7 +888,7 @@ int R_RegisterGLSLProgram( const char *name, const char *string, unsigned int fe
|
|||
const char *vertexShaderStrings[MAX_DEFINES_FEATURES+2];
|
||||
const char *fragmentShaderStrings[MAX_DEFINES_FEATURES+2];
|
||||
|
||||
if( !glConfig.ext.GLSL )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
return 0; // fail early
|
||||
|
||||
parent = NULL;
|
||||
|
@ -1233,7 +1233,7 @@ void R_ShutdownGLSLPrograms( void )
|
|||
|
||||
if( !r_glslProgramsPool )
|
||||
return;
|
||||
if( !glConfig.ext.GLSL )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
return;
|
||||
|
||||
for( i = 0, program = r_glslprograms; i < MAX_GLSL_PROGRAMS; i++, program++ )
|
||||
|
|
1274
render/r_register.c
1274
render/r_register.c
File diff suppressed because it is too large
Load Diff
|
@ -495,19 +495,19 @@ static bool Shader_ParseConditions( const char **ptr, ref_shader_t *shader )
|
|||
if( !conditions[numConditions].operand )
|
||||
{
|
||||
if( !com.stricmp( tok, "maxTextureSize" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.maxTextureSize;
|
||||
conditions[numConditions].operand = ( int )glConfig.max_2d_texture_size;
|
||||
else if( !com.stricmp( tok, "maxTextureCubemapSize" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.maxTextureCubemapSize;
|
||||
conditions[numConditions].operand = ( int )glConfig.max_cubemap_texture_size;
|
||||
else if( !com.stricmp( tok, "maxTextureUnits" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.maxTextureUnits;
|
||||
conditions[numConditions].operand = ( int )glConfig.max_texture_units;
|
||||
else if( !com.stricmp( tok, "textureCubeMap" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.ext.texture_cube_map;
|
||||
conditions[numConditions].operand = ( int )GL_Support( R_TEXTURECUBEMAP_EXT );
|
||||
else if( !com.stricmp( tok, "textureEnvCombine" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.ext.texture_env_combine;
|
||||
conditions[numConditions].operand = ( int )GL_Support( R_COMBINE_EXT );
|
||||
else if( !com.stricmp( tok, "textureEnvDot3" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.ext.GLSL;
|
||||
conditions[numConditions].operand = ( int )GL_Support( R_SHADER_GLSL100_EXT );
|
||||
else if( !com.stricmp( tok, "GLSL" ) )
|
||||
conditions[numConditions].operand = ( int )glConfig.ext.GLSL;
|
||||
conditions[numConditions].operand = ( int )GL_Support( R_SHADER_GLSL100_EXT );
|
||||
else if( !com.stricmp( tok, "deluxeMaps" ) || !com.stricmp( tok, "deluxe" ) )
|
||||
conditions[numConditions].operand = ( int )mapConfig.deluxeMappingEnabled;
|
||||
else if( !com.stricmp( tok, "portalMaps" ) )
|
||||
|
@ -1145,7 +1145,7 @@ static void Shaderpass_CubeMapExt( ref_shader_t *shader, shaderpass_t *pass, int
|
|||
pass->anim_fps = 0;
|
||||
pass->flags &= ~( SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP );
|
||||
|
||||
if( !glConfig.ext.texture_cube_map )
|
||||
if( !GL_Support( R_TEXTURECUBEMAP_EXT ))
|
||||
{
|
||||
MsgDev( D_WARN, "Shader %s has an unsupported cubemap stage: %s.\n", shader->name );
|
||||
pass->anim_frames[0] = r_notexture;
|
||||
|
@ -1216,7 +1216,7 @@ static void Shaderpass_NormalMap( ref_shader_t *shader, shaderpass_t *pass, cons
|
|||
char *token;
|
||||
float bumpScale = 0;
|
||||
|
||||
if( !glConfig.ext.GLSL )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
{
|
||||
MsgDev( D_WARN, "shader %s has a normalmap stage, while GLSL is not supported\n", shader->name );
|
||||
Shader_SkipLine( ptr );
|
||||
|
@ -1257,7 +1257,7 @@ static void Shaderpass_Material( ref_shader_t *shader, shaderpass_t *pass, const
|
|||
char *token;
|
||||
float bumpScale = 0;
|
||||
|
||||
if( !glConfig.ext.GLSL )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
{
|
||||
MsgDev( D_WARN, "shader %s has a normalmap stage, while GLSL is not supported\n", shader->name );
|
||||
Shader_SkipLine( ptr );
|
||||
|
@ -1373,7 +1373,7 @@ static void Shaderpass_Distortion( ref_shader_t *shader, shaderpass_t *pass, con
|
|||
char *token;
|
||||
float bumpScale = 0;
|
||||
|
||||
if( !glConfig.ext.GLSL || !r_portalmaps->integer )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ) || !r_portalmaps->integer )
|
||||
{
|
||||
MsgDev( D_WARN, "shader %s has a distortion stage, while GLSL is not supported\n", shader->name );
|
||||
Shader_SkipLine( ptr );
|
||||
|
@ -2631,7 +2631,7 @@ ref_shader_t *R_LoadShader( const char *name, int type, bool forceDefault, int a
|
|||
pass->anim_frames[0] = Shader_FindImage( s, shortname, addFlags, 0 );
|
||||
|
||||
// load default GLSL program if there's a bumpmap was found
|
||||
if( ( r_lighting_models_followdeluxe->integer ? mapConfig.deluxeMappingEnabled : glConfig.ext.GLSL )
|
||||
if( ( r_lighting_models_followdeluxe->integer ? mapConfig.deluxeMappingEnabled : GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
&& Shaderpass_LoadMaterial( &materialImages[0], &materialImages[1], &materialImages[2], shortname, addFlags, 1 ) )
|
||||
{
|
||||
pass->rgbgen.type = RGB_GEN_IDENTITY;
|
||||
|
|
|
@ -249,7 +249,7 @@ bool R_AddShadowCaster( ref_entity_t *ent )
|
|||
|
||||
if( r_shadows->integer != SHADOW_MAPPING || RI.refdef.rdflags & RDF_NOWORLDMODEL )
|
||||
return false;
|
||||
if( !glConfig.ext.GLSL || !glConfig.ext.depth_texture || !glConfig.ext.shadow )
|
||||
if( !GL_Support( R_SHADER_GLSL100_EXT ) || !GL_Support( R_DEPTH_TEXTURE ) || !GL_Support( R_SHADOW_EXT ))
|
||||
return false;
|
||||
|
||||
VectorCopy( ent->lightingOrigin, origin );
|
||||
|
|
|
@ -298,7 +298,7 @@ void Mod_LoadSkeletalModel( ref_model_t *mod, ref_model_t *parent, void *buffer
|
|||
poutmesh->bones = ( unsigned int * )( ( byte * )poutmesh->influences + sizeof( *poutmesh->influences ) * SKM_MAX_WEIGHTS * poutmesh->numverts );
|
||||
|
||||
size = sizeof( vec4_t ) + sizeof( vec4_t ); // xyz and normals
|
||||
if( glConfig.ext.GLSL )
|
||||
if( GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
size += sizeof( vec4_t ); // s-vectors
|
||||
|
||||
size *= ( poutmesh->numverts+1 ); // pad by one additional vertex for prefetching
|
||||
|
@ -419,7 +419,7 @@ void Mod_LoadSkeletalModel( ref_model_t *mod, ref_model_t *parent, void *buffer
|
|||
//
|
||||
// build S and T vectors
|
||||
//
|
||||
if( glConfig.ext.GLSL )
|
||||
if( GL_Support( R_SHADER_GLSL100_EXT ))
|
||||
{
|
||||
poutmesh->sVectorsArray = ( vec4_t * )( ( byte * )poutmesh->normalsArray + sizeof( vec4_t ) * ( poutmesh->numverts+1 ) );
|
||||
R_BuildTangentVectors( poutmesh->numverts, poutmesh->xyzArray, poutmesh->normalsArray, poutmesh->stArray,
|
||||
|
@ -1074,7 +1074,7 @@ static void R_DrawBonesFrameLerp( const meshbuffer_t *mb, float backlerp )
|
|||
features |= MF_NORMALS;
|
||||
#ifdef HARDWARE_OUTLINES
|
||||
if( e->outlineHeight )
|
||||
features |= MF_NORMALS|(glConfig.ext.GLSL ? MF_ENABLENORMALS : 0);
|
||||
features |= MF_NORMALS|(GL_Support( R_SHADER_GLSL100_EXT ) ? MF_ENABLENORMALS : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -118,14 +118,6 @@ SOURCE=.\cin.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glw_imp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\qgl_win.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_alias.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -170,6 +162,10 @@ SOURCE=.\r_model.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_opengl.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_poly.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -214,22 +210,10 @@ SOURCE=.\cin.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glw_win.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\qgl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_backend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_glimp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_local.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -246,6 +230,10 @@ SOURCE=.\r_model.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_opengl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_public.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: render - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
render.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,100 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: server - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP603.tmp" with contents
|
||||
[
|
||||
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "ents" /I "game" /I "global" /I "monsters" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\server\!debug/" /Fo"..\temp\server\!debug/" /Fd"..\temp\server\!debug/" /FD /c
|
||||
"D:\Xash3D\src_main\server\monsters\player.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP603.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP604.tmp" with contents
|
||||
[
|
||||
msvcrtd.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\server\!debug/server.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /def:".\server.def" /out:"..\temp\server\!debug/server.dll" /implib:"..\temp\server\!debug/server.lib" /pdbtype:sept
|
||||
"\Xash3D\src_main\temp\server\!debug\ai_sound.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\animating.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\animation.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\apache.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\barnacle.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\barney.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basebrush.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseentity.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basefunc.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basefx.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseinfo.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseitem.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baselogic.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basemonster.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basemover.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseother.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basepath.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basephys.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baserockets.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basetank.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\basetrigger.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseutil.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseweapon.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\baseworld.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\client.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\combat.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\decals.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\defaultai.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\dll_int.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\flyingmonster.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\game.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\gamerules.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\generic.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\globals.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\gman.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\hassassin.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\headcrab.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\hgrunt.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\leech.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\legacy.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\lights.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\multiplay_gamerules.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\nodes.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\osprey.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\parent.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\player.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\rat.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\roach.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\saverestore.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\scientist.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\scripted.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\sfx.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\singleplay_gamerules.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\sound.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\squadmonster.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\talkmonster.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\teamplay_gamerules.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\turret.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\utils.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\weapon_generic.obj"
|
||||
"\Xash3D\src_main\temp\server\!debug\zombie.obj"
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP604.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP605.bat" with contents
|
||||
[
|
||||
@echo off
|
||||
copy \Xash3D\src_main\temp\server\!debug\server.dll "D:\Xash3D\bin\server.dll"
|
||||
]
|
||||
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP605.bat"
|
||||
Compiling...
|
||||
player.cpp
|
||||
Linking...
|
||||
<h3>Output Window</h3>
|
||||
Performing Custom Build Step on \Xash3D\src_main\temp\server\!debug\server.dll
|
||||
‘ª®¯¨à®¢ ® ä ©«®¢: 1.
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
server.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
1
todo.log
1
todo.log
|
@ -91,6 +91,7 @@ Beta 13.12.08
|
|||
60. fixup render times OK
|
||||
61. fixup portal rendering OK
|
||||
62. return old-xash renderer initialization
|
||||
63. portal rendering angles
|
||||
|
||||
Ñïèñîê äîñòóïíûõ ðåíäåðåðîâ: ×òî â íèõ èíòåðåñíîãî
|
||||
0. Q3Fusion (Mirrors, Portals)
|
||||
|
|
|
@ -1,177 +0,0 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
{-0.525731, 0.000000, 0.850651},
|
||||
{-0.442863, 0.238856, 0.864188},
|
||||
{-0.295242, 0.000000, 0.955423},
|
||||
{-0.309017, 0.500000, 0.809017},
|
||||
{-0.162460, 0.262866, 0.951056},
|
||||
{0.000000, 0.000000, 1.000000},
|
||||
{0.000000, 0.850651, 0.525731},
|
||||
{-0.147621, 0.716567, 0.681718},
|
||||
{0.147621, 0.716567, 0.681718},
|
||||
{0.000000, 0.525731, 0.850651},
|
||||
{0.309017, 0.500000, 0.809017},
|
||||
{0.525731, 0.000000, 0.850651},
|
||||
{0.295242, 0.000000, 0.955423},
|
||||
{0.442863, 0.238856, 0.864188},
|
||||
{0.162460, 0.262866, 0.951056},
|
||||
{-0.681718, 0.147621, 0.716567},
|
||||
{-0.809017, 0.309017, 0.500000},
|
||||
{-0.587785, 0.425325, 0.688191},
|
||||
{-0.850651, 0.525731, 0.000000},
|
||||
{-0.864188, 0.442863, 0.238856},
|
||||
{-0.716567, 0.681718, 0.147621},
|
||||
{-0.688191, 0.587785, 0.425325},
|
||||
{-0.500000, 0.809017, 0.309017},
|
||||
{-0.238856, 0.864188, 0.442863},
|
||||
{-0.425325, 0.688191, 0.587785},
|
||||
{-0.716567, 0.681718, -0.147621},
|
||||
{-0.500000, 0.809017, -0.309017},
|
||||
{-0.525731, 0.850651, 0.000000},
|
||||
{0.000000, 0.850651, -0.525731},
|
||||
{-0.238856, 0.864188, -0.442863},
|
||||
{0.000000, 0.955423, -0.295242},
|
||||
{-0.262866, 0.951056, -0.162460},
|
||||
{0.000000, 1.000000, 0.000000},
|
||||
{0.000000, 0.955423, 0.295242},
|
||||
{-0.262866, 0.951056, 0.162460},
|
||||
{0.238856, 0.864188, 0.442863},
|
||||
{0.262866, 0.951056, 0.162460},
|
||||
{0.500000, 0.809017, 0.309017},
|
||||
{0.238856, 0.864188, -0.442863},
|
||||
{0.262866, 0.951056, -0.162460},
|
||||
{0.500000, 0.809017, -0.309017},
|
||||
{0.850651, 0.525731, 0.000000},
|
||||
{0.716567, 0.681718, 0.147621},
|
||||
{0.716567, 0.681718, -0.147621},
|
||||
{0.525731, 0.850651, 0.000000},
|
||||
{0.425325, 0.688191, 0.587785},
|
||||
{0.864188, 0.442863, 0.238856},
|
||||
{0.688191, 0.587785, 0.425325},
|
||||
{0.809017, 0.309017, 0.500000},
|
||||
{0.681718, 0.147621, 0.716567},
|
||||
{0.587785, 0.425325, 0.688191},
|
||||
{0.955423, 0.295242, 0.000000},
|
||||
{1.000000, 0.000000, 0.000000},
|
||||
{0.951056, 0.162460, 0.262866},
|
||||
{0.850651, -0.525731, 0.000000},
|
||||
{0.955423, -0.295242, 0.000000},
|
||||
{0.864188, -0.442863, 0.238856},
|
||||
{0.951056, -0.162460, 0.262866},
|
||||
{0.809017, -0.309017, 0.500000},
|
||||
{0.681718, -0.147621, 0.716567},
|
||||
{0.850651, 0.000000, 0.525731},
|
||||
{0.864188, 0.442863, -0.238856},
|
||||
{0.809017, 0.309017, -0.500000},
|
||||
{0.951056, 0.162460, -0.262866},
|
||||
{0.525731, 0.000000, -0.850651},
|
||||
{0.681718, 0.147621, -0.716567},
|
||||
{0.681718, -0.147621, -0.716567},
|
||||
{0.850651, 0.000000, -0.525731},
|
||||
{0.809017, -0.309017, -0.500000},
|
||||
{0.864188, -0.442863, -0.238856},
|
||||
{0.951056, -0.162460, -0.262866},
|
||||
{0.147621, 0.716567, -0.681718},
|
||||
{0.309017, 0.500000, -0.809017},
|
||||
{0.425325, 0.688191, -0.587785},
|
||||
{0.442863, 0.238856, -0.864188},
|
||||
{0.587785, 0.425325, -0.688191},
|
||||
{0.688191, 0.587785, -0.425325},
|
||||
{-0.147621, 0.716567, -0.681718},
|
||||
{-0.309017, 0.500000, -0.809017},
|
||||
{0.000000, 0.525731, -0.850651},
|
||||
{-0.525731, 0.000000, -0.850651},
|
||||
{-0.442863, 0.238856, -0.864188},
|
||||
{-0.295242, 0.000000, -0.955423},
|
||||
{-0.162460, 0.262866, -0.951056},
|
||||
{0.000000, 0.000000, -1.000000},
|
||||
{0.295242, 0.000000, -0.955423},
|
||||
{0.162460, 0.262866, -0.951056},
|
||||
{-0.442863, -0.238856, -0.864188},
|
||||
{-0.309017, -0.500000, -0.809017},
|
||||
{-0.162460, -0.262866, -0.951056},
|
||||
{0.000000, -0.850651, -0.525731},
|
||||
{-0.147621, -0.716567, -0.681718},
|
||||
{0.147621, -0.716567, -0.681718},
|
||||
{0.000000, -0.525731, -0.850651},
|
||||
{0.309017, -0.500000, -0.809017},
|
||||
{0.442863, -0.238856, -0.864188},
|
||||
{0.162460, -0.262866, -0.951056},
|
||||
{0.238856, -0.864188, -0.442863},
|
||||
{0.500000, -0.809017, -0.309017},
|
||||
{0.425325, -0.688191, -0.587785},
|
||||
{0.716567, -0.681718, -0.147621},
|
||||
{0.688191, -0.587785, -0.425325},
|
||||
{0.587785, -0.425325, -0.688191},
|
||||
{0.000000, -0.955423, -0.295242},
|
||||
{0.000000, -1.000000, 0.000000},
|
||||
{0.262866, -0.951056, -0.162460},
|
||||
{0.000000, -0.850651, 0.525731},
|
||||
{0.000000, -0.955423, 0.295242},
|
||||
{0.238856, -0.864188, 0.442863},
|
||||
{0.262866, -0.951056, 0.162460},
|
||||
{0.500000, -0.809017, 0.309017},
|
||||
{0.716567, -0.681718, 0.147621},
|
||||
{0.525731, -0.850651, 0.000000},
|
||||
{-0.238856, -0.864188, -0.442863},
|
||||
{-0.500000, -0.809017, -0.309017},
|
||||
{-0.262866, -0.951056, -0.162460},
|
||||
{-0.850651, -0.525731, 0.000000},
|
||||
{-0.716567, -0.681718, -0.147621},
|
||||
{-0.716567, -0.681718, 0.147621},
|
||||
{-0.525731, -0.850651, 0.000000},
|
||||
{-0.500000, -0.809017, 0.309017},
|
||||
{-0.238856, -0.864188, 0.442863},
|
||||
{-0.262866, -0.951056, 0.162460},
|
||||
{-0.864188, -0.442863, 0.238856},
|
||||
{-0.809017, -0.309017, 0.500000},
|
||||
{-0.688191, -0.587785, 0.425325},
|
||||
{-0.681718, -0.147621, 0.716567},
|
||||
{-0.442863, -0.238856, 0.864188},
|
||||
{-0.587785, -0.425325, 0.688191},
|
||||
{-0.309017, -0.500000, 0.809017},
|
||||
{-0.147621, -0.716567, 0.681718},
|
||||
{-0.425325, -0.688191, 0.587785},
|
||||
{-0.162460, -0.262866, 0.951056},
|
||||
{0.442863, -0.238856, 0.864188},
|
||||
{0.162460, -0.262866, 0.951056},
|
||||
{0.309017, -0.500000, 0.809017},
|
||||
{0.147621, -0.716567, 0.681718},
|
||||
{0.000000, -0.525731, 0.850651},
|
||||
{0.425325, -0.688191, 0.587785},
|
||||
{0.587785, -0.425325, 0.688191},
|
||||
{0.688191, -0.587785, 0.425325},
|
||||
{-0.955423, 0.295242, 0.000000},
|
||||
{-0.951056, 0.162460, 0.262866},
|
||||
{-1.000000, 0.000000, 0.000000},
|
||||
{-0.850651, 0.000000, 0.525731},
|
||||
{-0.955423, -0.295242, 0.000000},
|
||||
{-0.951056, -0.162460, 0.262866},
|
||||
{-0.864188, 0.442863, -0.238856},
|
||||
{-0.951056, 0.162460, -0.262866},
|
||||
{-0.809017, 0.309017, -0.500000},
|
||||
{-0.864188, -0.442863, -0.238856},
|
||||
{-0.951056, -0.162460, -0.262866},
|
||||
{-0.809017, -0.309017, -0.500000},
|
||||
{-0.681718, 0.147621, -0.716567},
|
||||
{-0.681718, -0.147621, -0.716567},
|
||||
{-0.850651, 0.000000, -0.525731},
|
||||
{-0.688191, 0.587785, -0.425325},
|
||||
{-0.587785, 0.425325, -0.688191},
|
||||
{-0.425325, 0.688191, -0.587785},
|
||||
{-0.425325, -0.688191, -0.587785},
|
||||
{-0.587785, -0.425325, -0.688191},
|
||||
{-0.688191, -0.587785, -0.425325},
|
Reference in New Issue