clean out a bunch of obsolete vendor and hardware specific GL workarounds

This commit is contained in:
Timothee Besset 2017-05-27 17:15:06 -05:00
parent 9123ea1cb0
commit e02a9194b7
5 changed files with 128 additions and 656 deletions

View file

@ -32,8 +32,6 @@
extern void DrawPathLines();
extern void Select_ShiftTexture( int x, int y );
extern void Select_RotateTexture( int amt );
extern void DrawAlternatePoint( vec3_t v, float scale );
//extern void Select_ScaleTexture(int x, int y);
extern int g_nPatchClickedView;
@ -99,10 +97,6 @@ void CamWnd::OnCreate(){
g_PrefsDlg.UpdateTextureCompression();
#ifdef ATIHACK_812
g_PrefsDlg.UpdateATIHack();
#endif
g_qeglobals_gui.d_camera = m_pWidget;
}
@ -1473,83 +1467,39 @@ void CamWnd::Cam_Draw(){
// edge / vertex flags
if ( g_qeglobals.d_select_mode == sel_vertex ) {
// GL_POINTS on Kyro Workaround
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
// brush verts
qglPointSize( 4 );
qglColor3f( 0,1,0 );
// brush verts
qglPointSize( 4 );
qglColor3f( 0,1,0 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numpoints ; i++ )
qglVertex3fv( g_qeglobals.d_points[i] );
qglEnd();
if ( g_qeglobals.d_num_move_points ) {
// selected brush verts
qglPointSize( 5 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numpoints ; i++ )
qglVertex3fv( g_qeglobals.d_points[i] );
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
qglVertex3fv( g_qeglobals.d_move_points[i] );
qglEnd();
if ( g_qeglobals.d_num_move_points ) {
// selected brush verts
qglPointSize( 5 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
qglVertex3fv( g_qeglobals.d_move_points[i] );
qglEnd();
}
qglPointSize( 1 );
}
else
{
// brush verts
qglColor3f( 0,1,0 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < g_qeglobals.d_numpoints; i++ )
DrawAlternatePoint( g_qeglobals.d_points[i], 1.5 );
qglEnd();
if ( g_qeglobals.d_num_move_points ) {
// selected brush verts
qglColor3f( 0,0,1 );
qglLineWidth( 3.0 );
qglBegin( GL_LINES );
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
qglVertex3fv( g_qeglobals.d_move_points[i] );
qglEnd();
}
qglLineWidth( 1.0 );
}
qglPointSize( 1 );
}
else if ( g_qeglobals.d_select_mode == sel_edge ) {
float *v1, *v2;
// GL_POINTS on Kyro Workaround
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglPointSize( 4 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numedges ; i++ )
{
v1 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p1];
v2 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p2];
qglVertex3f( ( v1[0] + v2[0] ) * 0.5,( v1[1] + v2[1] ) * 0.5,( v1[2] + v2[2] ) * 0.5 );
}
qglEnd();
qglPointSize( 1 );
}
else {
qglColor3f( 0,0,1 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < g_qeglobals.d_numedges; i++ )
{
v1 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p1];
v2 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p2];
vec3_t v3;
v3[0] = ( v1[0] + v2[0] ) * 0.5;
v3[1] = ( v1[1] + v2[1] ) * 0.5;
v3[2] = ( v1[2] + v2[2] ) * 0.5;
DrawAlternatePoint( v3, 1.5 );
}
qglEnd();
qglLineWidth( 1.0 );
qglPointSize( 4 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numedges ; i++ )
{
v1 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p1];
v2 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p2];
qglVertex3f( ( v1[0] + v2[0] ) * 0.5,( v1[1] + v2[1] ) * 0.5,( v1[2] + v2[2] ) * 0.5 );
}
qglEnd();
qglPointSize( 1 );
}
//

View file

@ -34,7 +34,6 @@
// externs
extern void MemFile_fprintf( MemStream* pMemFile, const char* pText, ... );
extern face_t *Face_Alloc( void );
extern void DrawAlternatePoint( vec3_t v, float scale );
void _Write3DMatrix( FILE *f, int y, int x, int z, float *m );
void _Write3DMatrix( MemStream *f, int y, int x, int z, float *m );
@ -3377,157 +3376,69 @@ void DrawPatchControls( patchMesh_t *pm ){
qglPointSize( 6 );
if ( g_bPatchAxisOnRow ) {
qglColor3f( 1, 0, 1 );
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglBegin( GL_POINTS );
for ( i = 0; i < pm->width; i++ )
{
qglVertex3fv( pm->ctrl[i][g_nPatchAxisIndex].xyz );
}
qglEnd();
}
else
qglBegin( GL_POINTS );
for ( i = 0; i < pm->width; i++ )
{
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < pm->width; i++ )
{
DrawAlternatePoint( pm->ctrl[i][g_nPatchAxisIndex].xyz, 0 );
}
qglEnd();
qglLineWidth( 1.0 );
qglVertex3fv( pm->ctrl[i][g_nPatchAxisIndex].xyz );
}
qglEnd();
if ( g_nPatchBendState == BEND_SELECT_EDGE || g_nPatchBendState == BEND_BENDIT || g_nPatchBendState == BEND_SELECT_ORIGIN ) {
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglColor3f( 0, 0, 1 );
qglBegin( GL_POINTS );
if ( g_nPatchBendState == BEND_SELECT_ORIGIN ) {
qglVertex3fv( g_vBendOrigin );
}
else
qglColor3f( 0, 0, 1 );
qglBegin( GL_POINTS );
if ( g_nPatchBendState == BEND_SELECT_ORIGIN ) {
qglVertex3fv( g_vBendOrigin );
}
else
{
for ( i = 0; i < pm->width; i++ )
{
for ( i = 0; i < pm->width; i++ )
if ( g_bPatchLowerEdge ) {
for ( j = 0; j < g_nPatchAxisIndex; j++ )
qglVertex3fv( pm->ctrl[i][j].xyz );
}
else
{
if ( g_bPatchLowerEdge ) {
for ( j = 0; j < g_nPatchAxisIndex; j++ )
qglVertex3fv( pm->ctrl[i][j].xyz );
}
else
{
for ( j = pm->height - 1; j > g_nPatchAxisIndex; j-- )
qglVertex3fv( pm->ctrl[i][j].xyz );
}
for ( j = pm->height - 1; j > g_nPatchAxisIndex; j-- )
qglVertex3fv( pm->ctrl[i][j].xyz );
}
}
qglEnd();
}
else {
qglColor3f( 0, 0, 1 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
if ( g_nPatchBendState == BEND_SELECT_ORIGIN ) {
DrawAlternatePoint( g_vBendOrigin, 0 );
}
else
{
for ( i = 0; i < pm->width; i++ )
{
if ( g_bPatchLowerEdge ) {
for ( j = 0; j < g_nPatchAxisIndex; j++ )
{
DrawAlternatePoint( pm->ctrl[i][j].xyz, 0 );
}
}
else
{
for ( j = pm->height - 1; j > g_nPatchAxisIndex; j-- )
{
DrawAlternatePoint( pm->ctrl[i][j].xyz, 0 );
}
}
}
}
qglEnd();
qglLineWidth( 1.0 );
}
qglEnd();
}
}
else
{
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglColor3f( 1, 0, 1 );
qglColor3f( 1, 0, 1 );
qglBegin( GL_POINTS );
for ( i = 0; i < pm->height; i++ )
{
qglVertex3fv( pm->ctrl[g_nPatchAxisIndex][i].xyz );
}
qglEnd();
if ( g_nPatchBendState == BEND_SELECT_EDGE || g_nPatchBendState == BEND_BENDIT || g_nPatchBendState == BEND_SELECT_ORIGIN ) {
qglColor3f( 0, 0, 1 );
qglBegin( GL_POINTS );
for ( i = 0; i < pm->height; i++ )
{
qglVertex3fv( pm->ctrl[g_nPatchAxisIndex][i].xyz );
}
qglEnd();
}
else {
qglColor3f( 1, 0, 1 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < pm->height; i++ )
{
DrawAlternatePoint( pm->ctrl[g_nPatchAxisIndex][i].xyz, 0 );
}
qglEnd();
qglLineWidth( 1.0 );
}
if ( g_nPatchBendState == BEND_SELECT_EDGE || g_nPatchBendState == BEND_BENDIT || g_nPatchBendState == BEND_SELECT_ORIGIN ) {
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglColor3f( 0, 0, 1 );
qglBegin( GL_POINTS );
for ( i = 0; i < pm->height; i++ )
if ( g_nPatchBendState == BEND_SELECT_ORIGIN ) {
qglVertex3fv( pm->ctrl[g_nBendOriginIndex][i].xyz );
}
else
{
if ( g_nPatchBendState == BEND_SELECT_ORIGIN ) {
qglVertex3fv( pm->ctrl[g_nBendOriginIndex][i].xyz );
if ( g_bPatchLowerEdge ) {
for ( j = 0; j < g_nPatchAxisIndex; j++ )
qglVertex3fv( pm->ctrl[j][i].xyz );
}
else
{
if ( g_bPatchLowerEdge ) {
for ( j = 0; j < g_nPatchAxisIndex; j++ )
qglVertex3fv( pm->ctrl[j][i].xyz );
}
else
{
for ( j = pm->width - 1; j > g_nPatchAxisIndex; j-- )
qglVertex3fv( pm->ctrl[j][i].xyz );
}
for ( j = pm->width - 1; j > g_nPatchAxisIndex; j-- )
qglVertex3fv( pm->ctrl[j][i].xyz );
}
}
qglEnd();
}
else {
qglColor3f( 0, 0, 1 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < pm->height; i++ )
{
if ( g_nPatchBendState == BEND_SELECT_ORIGIN ) {
DrawAlternatePoint( pm->ctrl[g_nBendOriginIndex][i].xyz, 0 );
}
else
{
if ( g_bPatchLowerEdge ) {
for ( j = 0; j < g_nPatchAxisIndex; j++ )
{
DrawAlternatePoint( pm->ctrl[j][i].xyz, 0 );
}
}
else
{
for ( j = pm->width - 1; j > g_nPatchAxisIndex; j-- )
{
DrawAlternatePoint( pm->ctrl[j][i].xyz, 0 );
}
}
}
}
qglEnd();
qglLineWidth( 1.0 );
}
qglEnd();
}
}
}
@ -3558,91 +3469,18 @@ void DrawPatchControls( patchMesh_t *pm ){
// qglEnable (GL_LINE_STIPPLE);
// draw selection handles
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglPointSize( 6 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < pm->width ; i++ )
{
for ( j = 0 ; j < pm->height ; j++ )
{
if ( PointInMoveList( pm->ctrl[i][j].xyz ) != -1 ) {
bSelectedPoints[i][j] = true;
}
else
{
bSelectedPoints[i][j] = false;
if ( i & 0x01 || j & 0x01 ) {
qglColor3f( 1, 0, 1 );
}
else{
qglColor3f( 0, 1, 0 );
}
qglVertex3fv( pm->ctrl[i][j].xyz );
}
}
}
qglColor3f( 0, 0, 1 );
for ( i = 0 ; i < pm->width ; i++ )
{
for ( j = 0 ; j < pm->height ; j++ )
{
if ( bSelectedPoints[i][j] ) {
qglVertex3fv( pm->ctrl[i][j].xyz );
}
}
}
qglEnd();
}
else
qglPointSize( 6 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < pm->width ; i++ )
{
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < pm->width; i++ )
for ( j = 0 ; j < pm->height ; j++ )
{
for ( j = 0; j < pm->height; j++ )
{
if ( PointInMoveList( pm->ctrl[i][j].xyz ) != -1 ) {
bSelectedPoints[i][j] = true;
}
else
{
bSelectedPoints[i][j] = false;
if ( i & 0x01 || j & 0x01 ) {
qglColor3f( 1, 0, 1 );
}
else{
qglColor3f( 0, 1, 0 );
}
// draw verts
DrawAlternatePoint( pm->ctrl[i][j].xyz, 0 );
}
if ( PointInMoveList( pm->ctrl[i][j].xyz ) != -1 ) {
bSelectedPoints[i][j] = true;
}
}
qglColor3f( 0, 0, 1 );
for ( i = 0; i < pm->width; i++ )
{
for ( j = 0; j < pm->height; j++ )
{
if ( bSelectedPoints[i][j] ) {
// draw verts
DrawAlternatePoint( pm->ctrl[i][j].xyz, 0 );
}
}
}
qglEnd();
qglLineWidth( 1.0 );
}
}
if ( bOverlay ) {
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglPointSize( 6 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < pm->width ; i++ )
{
for ( j = 0 ; j < pm->height ; j++ )
else
{
bSelectedPoints[i][j] = false;
if ( i & 0x01 || j & 0x01 ) {
qglColor3f( 1, 0, 1 );
}
@ -3652,31 +3490,37 @@ void DrawPatchControls( patchMesh_t *pm ){
qglVertex3fv( pm->ctrl[i][j].xyz );
}
}
qglEnd();
}
else
qglColor3f( 0, 0, 1 );
for ( i = 0 ; i < pm->width ; i++ )
{
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0 ; i < pm->width ; i++ )
for ( j = 0 ; j < pm->height ; j++ )
{
for ( j = 0 ; j < pm->height ; j++ )
{
if ( i & 0x01 || j & 0x01 ) {
qglColor3f( 1, 0, 1 );
}
else{
qglColor3f( 0, 1, 0 );
}
// draw verts
DrawAlternatePoint( pm->ctrl[i][j].xyz, 0 );
if ( bSelectedPoints[i][j] ) {
qglVertex3fv( pm->ctrl[i][j].xyz );
}
}
qglEnd();
qglLineWidth( 1.0 );
}
qglEnd();
}
if ( bOverlay ) {
qglPointSize( 6 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < pm->width ; i++ )
{
for ( j = 0 ; j < pm->height ; j++ )
{
if ( i & 0x01 || j & 0x01 ) {
qglColor3f( 1, 0, 1 );
}
else{
qglColor3f( 0, 1, 0 );
}
qglVertex3fv( pm->ctrl[i][j].xyz );
}
}
qglEnd();
}
//qglPopAttrib();
}
/*

View file

@ -154,14 +154,6 @@
#define Q3MAP2TEX_KEY "Q3Map2Tex"
#define X64Q3MAP2_KEY "x64Q3Map2"
#ifdef ATIHACK_812
#define ATIHACK_KEY "ATIHack"
#endif
#ifdef NVIDIA_AERO_HACK
#define NVAEROHACK_KEY "NvidiaAeroHack"
#endif
// window stuff
#define ENTITYSPLIT1_KEY "EntitySplit1"
#define ENTITYSPLIT2_KEY "EntitySplit2"
@ -656,7 +648,6 @@ PrefsDlg::PrefsDlg (){
m_nSubdivisions = 4;
// not prefs
m_bFloatingZ = FALSE;
m_bGlPtWorkaround = FALSE; // Gef: Kyro/GL_POINTS workaround 25-aug-2001
#ifdef _WIN32
m_bNativeGUI = FALSE;
m_bStartOnPrimMon = FALSE;
@ -674,13 +665,6 @@ PrefsDlg::PrefsDlg (){
#ifdef _WIN32
m_bx64q3map2 = TRUE;
#endif
#ifdef ATIHACK_812
m_bGlATIHack = FALSE;
#endif
#ifdef NVIDIA_AERO_HACK
m_bGlNvidiaAeroHack = TRUE;
m_bGlNvidiaAeroHackPrevState = -1; // -1 is uninitialized, 0 is FALSE, 1 is TRUE
#endif
}
/*!
@ -1801,28 +1785,6 @@ void PrefsDlg::BuildDialog(){
gtk_widget_show( check );
AddDialogData( check, &m_bSizePaint, DLG_CHECK_BOOL );
// Alternate vertex/edge handles
// Gef: Kyro GL_POINT work around 25-aug-2001
check = gtk_check_button_new_with_label( _( "Alternate vertex/edge handles" ) );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
gtk_widget_show( check );
AddDialogData( check, &m_bGlPtWorkaround, DLG_CHECK_BOOL );
#ifdef ATIHACK_812
// ATI bugs
check = gtk_check_button_new_with_label( _( "ATI and Intel cards w/ buggy drivers (disappearing polygons)" ) );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
gtk_widget_show( check );
AddDialogData( check, &m_bGlATIHack, DLG_CHECK_BOOL );
#endif
#ifdef NVIDIA_AERO_HACK
check = gtk_check_button_new_with_label( _( "NVIDIA/Aero bug - disable Windows composition" ) );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
gtk_widget_show( check );
AddDialogData( check, &m_bGlNvidiaAeroHack, DLG_CHECK_BOOL );
#endif
// Add the page to the notebook
page_index = gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel );
assert( page_index == PTAB_2D );
@ -2903,69 +2865,6 @@ void PrefsDlg::UpdateTextureCompression(){
}
}
#ifdef ATIHACK_812
void PrefsDlg::UpdateATIHack() {
// if OpenGL is not ready yet, don't do anything
if ( !g_qeglobals.m_bOpenGLReady ) {
Sys_Printf( "OpenGL not ready - postpone ATI bug workaround setup\n" );
return;
}
if ( m_bGlATIHack ) {
qglCullFace = &qglCullFace_ATIHack;
qglDisable = &qglDisable_ATIHack;
qglEnable = &qglEnable_ATIHack;
qglPolygonMode = &qglPolygonMode_ATIHack;
Sys_Printf( "ATI bug workaround enabled\n" );
}
else {
qglCullFace = qglCullFace_real;
qglDisable = qglDisable_real;
qglEnable = qglEnable_real;
qglPolygonMode = qglPolygonMode_real;
Sys_Printf( "ATI bug workaround disabled\n" );
}
}
#endif
#ifdef NVIDIA_AERO_HACK
void PrefsDlg::UpdateNvidiaAeroHack() {
if ( m_bGlNvidiaAeroHack && m_bGlNvidiaAeroHackPrevState == 1 ) {
return;
}
if ( ( !m_bGlNvidiaAeroHack ) && m_bGlNvidiaAeroHackPrevState == 0 ) {
return;
}
if ( ( !m_bGlNvidiaAeroHack ) && m_bGlNvidiaAeroHackPrevState < 0 ) {
// The hack state is uninitialized, meaning that this is the first call
// to this function. I prefer not to explicitly enable composition because
// the user may have set the application to disable it, and I don't want to
// override that. Leave the state of composition as-is if the hack checkbox
// isn't checked.
m_bGlNvidiaAeroHackPrevState = 0;
return;
}
HMODULE lib = LoadLibrary( "dwmapi.dll" );
if ( lib ) {
void ( WINAPI *qDwmEnableComposition )( bool bEnable ) =
( void (WINAPI *) ( bool bEnable ) )GetProcAddress( lib, "DwmEnableComposition" );
if ( qDwmEnableComposition ) {
if ( m_bGlNvidiaAeroHack ) {
Sys_Printf( "Disabling Windows composition\n" );
qDwmEnableComposition( 0 );
m_bGlNvidiaAeroHackPrevState = 1;
}
else {
Sys_Printf( "Enabling Windows composition\n" );
qDwmEnableComposition( 1 );
m_bGlNvidiaAeroHackPrevState = 0;
}
}
FreeLibrary( lib );
}
}
#endif
// TTimo: m_strEnginePath has a special status, if not found in registry we need to
// initiliaze it for sure. It is not totally failsafe but we can use the same
// code than in q3map, expecting to find some "quake" above us. If not, we prompt
@ -3116,9 +3015,6 @@ void PrefsDlg::LoadPrefs(){
mLocalPrefs.GetPref( WHEELINC_KEY, &m_nWheelInc, 64 );
mLocalPrefs.GetPref( PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE );
// Gef: Kyro GL_POINT workaround
mLocalPrefs.GetPref( GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE );
// window positioning
mLocalPrefs.GetPref( ENTITYSPLIT1_KEY, &mWindowInfo.nEntitySplit1, -1 );
mLocalPrefs.GetPref( ENTITYSPLIT2_KEY, &mWindowInfo.nEntitySplit2, -1 );
@ -3237,26 +3133,10 @@ void PrefsDlg::LoadPrefs(){
mLocalPrefs.GetPref( X64Q3MAP2_KEY, &m_bx64q3map2, TRUE );
#endif
#ifdef ATIHACK_812
mLocalPrefs.GetPref( ATIHACK_KEY, &m_bGlATIHack, FALSE );
#endif
#ifdef NVIDIA_AERO_HACK
mLocalPrefs.GetPref( NVAEROHACK_KEY, &m_bGlNvidiaAeroHack, TRUE );
#endif
Undo_SetMaxSize( m_nUndoLevels ); // set it internally as well / FIXME: why not just have one global value?
UpdateTextureCompression();
#ifdef ATIHACK_812
UpdateATIHack();
#endif
#ifdef NVIDIA_AERO_HACK
UpdateNvidiaAeroHack();
#endif
if ( mLocalPrefs.mbEmpty ) {
mLocalPrefs.mbEmpty = false;
Sys_Printf( "Saving local.pref with default pref values\n" );
@ -3300,12 +3180,6 @@ void PrefsDlg::PostModal( int code ){
SavePrefs();
// make sure the logfile is ok
Sys_LogFile();
#ifdef ATIHACK_812
UpdateATIHack();
#endif
#ifdef NVIDIA_AERO_HACK
UpdateNvidiaAeroHack();
#endif
if ( g_pParentWnd ) {
g_pParentWnd->SetGridStatus();
}

View file

@ -505,13 +505,6 @@ void ( APIENTRY * qgluLookAt )(
GLdouble upz );
const GLubyte* ( APIENTRY * qgluErrorString )(GLenum errCode );
#ifdef ATIHACK_812
void ( APIENTRY * qglCullFace_real )( GLenum mode );
void ( APIENTRY * qglDisable_real )( GLenum cap );
void ( APIENTRY * qglEnable_real )( GLenum cap );
void ( APIENTRY * qglPolygonMode_real )( GLenum face, GLenum mode );
#endif
/*
** QGL_Shutdown
**
@ -960,13 +953,6 @@ void QGL_Shutdown(){
qgluPerspective = NULL;
qgluErrorString = NULL;
qgluLookAt = NULL;
#ifdef ATIHACK_812
qglCullFace_real = NULL;
qglDisable_real = NULL;
qglEnable_real = NULL;
qglPolygonMode_real = NULL;
#endif
}
/*
@ -1084,91 +1070,6 @@ const GLubyte* WINAPI gluErrorString( GLenum errCode ){
return (GLubyte *) "Unknown error";
}
#ifdef ATIHACK_812
int ATIhack_culling;
GLenum ATIhack_cullmode;
GLenum ATIhack_backmode;
GLenum ATIhack_frontmode;
static void ATIhack_update( void ){
if ( !ATIhack_culling || ( GL_FRONT_AND_BACK == ATIhack_cullmode ) ) {
qglPolygonMode_real( GL_FRONT, ATIhack_frontmode );
qglPolygonMode_real( GL_BACK, ATIhack_backmode );
}
else{
switch ( ATIhack_cullmode )
{
case GL_FRONT:
qglPolygonMode_real( GL_FRONT_AND_BACK, ATIhack_backmode );
break;
case GL_BACK:
qglPolygonMode_real( GL_FRONT_AND_BACK, ATIhack_frontmode );
default:
break;
}
}
}
void APIENTRY qglEnable_ATIHack( GLenum cap ){
qglEnable_real( cap );
if ( GL_CULL_FACE != cap ) {
return;
}
if ( ATIhack_culling ) {
return;
}
ATIhack_culling = 1;
ATIhack_update();
}
void APIENTRY qglDisable_ATIHack( GLenum cap ){
qglDisable_real( cap );
if ( GL_CULL_FACE != cap ) {
return;
}
if ( !ATIhack_culling ) {
return;
}
ATIhack_culling = 0;
ATIhack_update();
}
void APIENTRY qglCullFace_ATIHack( GLenum mode ){
if ( ATIhack_cullmode == mode ) {
return;
}
qglCullFace_real( mode );
ATIhack_cullmode = mode;
ATIhack_update();
}
void APIENTRY qglPolygonMode_ATIHack( GLenum face, GLenum mode ){
switch ( face )
{
case GL_FRONT:
if ( ATIhack_frontmode == mode ) {
return;
}
ATIhack_frontmode = mode;
break;
case GL_BACK:
if ( ATIhack_backmode == mode ) {
return;
}
ATIhack_backmode = mode;
break;
case GL_FRONT_AND_BACK:
if ( ( ATIhack_frontmode == mode ) && ( ATIhack_backmode == mode ) ) {
return;
}
ATIhack_frontmode = ATIhack_backmode = mode;
default:
break;
}
ATIhack_update();
}
#endif
int QGL_Init( const char *dllname, const char* gluname ){
#ifdef _WIN32
g_hGLDLL = LoadLibrary( dllname );
@ -1255,23 +1156,13 @@ int QGL_Init( const char *dllname, const char* gluname ){
qglCopyTexImage2D = safe_dlsym( g_hGLDLL, "glCopyTexImage2D" );
qglCopyTexSubImage1D = safe_dlsym( g_hGLDLL, "glCopyTexSubImage1D" );
qglCopyTexSubImage2D = safe_dlsym( g_hGLDLL, "glCopyTexSubImage2D" );
#ifdef ATIHACK_812
qglCullFace_real = safe_dlsym( g_hGLDLL, "glCullFace" );
qglCullFace = qglCullFace_real;
#else
qglCullFace = safe_dlsym( g_hGLDLL, "glCullFace" );
#endif
qglDeleteLists = safe_dlsym( g_hGLDLL, "glDeleteLists" );
qglDeleteTextures = safe_dlsym( g_hGLDLL, "glDeleteTextures" );
qglDepthFunc = safe_dlsym( g_hGLDLL, "glDepthFunc" );
qglDepthMask = safe_dlsym( g_hGLDLL, "glDepthMask" );
qglDepthRange = safe_dlsym( g_hGLDLL, "glDepthRange" );
#ifdef ATIHACK_812
qglDisable_real = safe_dlsym( g_hGLDLL, "glDisable" );
qglDisable = qglDisable_real;
#else
qglDisable = safe_dlsym( g_hGLDLL, "glDisable" );
#endif
qglDisableClientState = safe_dlsym( g_hGLDLL, "glDisableClientState" );
qglDrawArrays = safe_dlsym( g_hGLDLL, "glDrawArrays" );
qglDrawBuffer = safe_dlsym( g_hGLDLL, "glDrawBuffer" );
@ -1280,12 +1171,7 @@ int QGL_Init( const char *dllname, const char* gluname ){
qglEdgeFlag = safe_dlsym( g_hGLDLL, "glEdgeFlag" );
qglEdgeFlagPointer = safe_dlsym( g_hGLDLL, "glEdgeFlagPointer" );
qglEdgeFlagv = safe_dlsym( g_hGLDLL, "glEdgeFlagv" );
#ifdef ATIHACK_812
qglEnable_real = safe_dlsym( g_hGLDLL, "glEnable" );
qglEnable = qglEnable_real;
#else
qglEnable = safe_dlsym( g_hGLDLL, "glEnable" );
#endif
qglEnableClientState = safe_dlsym( g_hGLDLL, "glEnableClientState" );
qglEnd = safe_dlsym( g_hGLDLL, "glEnd" );
qglEndList = safe_dlsym( g_hGLDLL, "glEndList" );
@ -1413,12 +1299,7 @@ int QGL_Init( const char *dllname, const char* gluname ){
qglPixelTransferi = safe_dlsym( g_hGLDLL, "glPixelTransferi" );
qglPixelZoom = safe_dlsym( g_hGLDLL, "glPixelZoom" );
qglPointSize = safe_dlsym( g_hGLDLL, "glPointSize" );
#ifdef ATIHACK_812
qglPolygonMode_real = safe_dlsym( g_hGLDLL, "glPolygonMode" );
qglPolygonMode = qglPolygonMode_real;
#else
qglPolygonMode = safe_dlsym( g_hGLDLL, "glPolygonMode" );
#endif
qglPolygonOffset = safe_dlsym( g_hGLDLL, "glPolygonOffset" );
qglPolygonStipple = safe_dlsym( g_hGLDLL, "glPolygonStipple" );
qglPopAttrib = safe_dlsym( g_hGLDLL, "glPopAttrib" );
@ -1651,13 +1532,6 @@ int QGL_Init( const char *dllname, const char* gluname ){
Sys_Printf( "Done.\n" );
#ifdef ATIHACK_812
ATIhack_culling = 0;
ATIhack_cullmode = GL_BACK;
ATIhack_backmode = GL_FILL;
ATIhack_frontmode = GL_FILL;
#endif
if ( init_error == 1 ) {
return 0;
}

View file

@ -2788,23 +2788,6 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB
XY_Draw
==============
*/
#define ALT_POINT_SIZE 4
// Alternative to GL_POINTS (for; vertex handles, patch handles, clip points, path points)
void DrawAlternatePoint( vec3_t v, float scale ){
if ( scale == 0 ) {
scale = g_pParentWnd->GetXYWnd()->Scale();
//scale = g_qeglobals.d_xyOld.scale;
}
// ugly gl_line cross
qglVertex3f( v[0] + ( ALT_POINT_SIZE / scale ), v[1], v[2] );
qglVertex3f( v[0] - ( ALT_POINT_SIZE / scale ), v[1], v[2] );
qglVertex3f( v[0], v[1] + ( ALT_POINT_SIZE / scale ), v[2] );
qglVertex3f( v[0], v[1] - ( ALT_POINT_SIZE / scale ), v[2] );
qglVertex3f( v[0], v[1], v[2] + ( ALT_POINT_SIZE / scale ) );
qglVertex3f( v[0], v[1], v[2] - ( ALT_POINT_SIZE / scale ) );
}
long g_lCount = 0;
long g_lTotal = 0;
@ -3061,80 +3044,38 @@ void XYWnd::XY_Draw(){
// edge / vertex flags
if ( g_qeglobals.d_select_mode == sel_vertex ) {
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
// brush verts
qglPointSize( 4 );
qglColor3f( 0,1,0 );
// brush verts
qglPointSize( 4 );
qglColor3f( 0,1,0 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numpoints ; i++ )
qglVertex3fv( g_qeglobals.d_points[i] );
qglEnd();
if ( g_qeglobals.d_num_move_points ) {
// selected brush verts
qglPointSize( 5 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numpoints ; i++ )
qglVertex3fv( g_qeglobals.d_points[i] );
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
qglVertex3fv( g_qeglobals.d_move_points[i] );
qglEnd();
if ( g_qeglobals.d_num_move_points ) {
// selected brush verts
qglPointSize( 5 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
qglVertex3fv( g_qeglobals.d_move_points[i] );
qglEnd();
}
qglPointSize( 1 );
}
else
{
// brush verts
qglColor3f( 0,1,0 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < g_qeglobals.d_numpoints; i++ )
DrawAlternatePoint( g_qeglobals.d_points[i], m_fScale );
qglEnd();
if ( g_qeglobals.d_num_move_points ) {
// selected brush verts
qglColor3f( 0,0,1 );
qglLineWidth( 3.0 );
qglBegin( GL_LINES );
for ( i = 0; i < g_qeglobals.d_num_move_points; i++ )
qglVertex3fv( g_qeglobals.d_move_points[i] );
qglEnd();
}
qglLineWidth( 1.0 );
}
qglPointSize( 1 );
}
else if ( g_qeglobals.d_select_mode == sel_edge ) {
float *v1, *v2;
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglPointSize( 4 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numedges ; i++ )
{
v1 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p1];
v2 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p2];
qglVertex3f( ( v1[0] + v2[0] ) * 0.5,( v1[1] + v2[1] ) * 0.5,( v1[2] + v2[2] ) * 0.5 );
}
qglEnd();
qglPointSize( 1 );
}
else {
qglColor3f( 0,0,1 );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
for ( i = 0; i < g_qeglobals.d_numedges; i++ )
{
v1 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p1];
v2 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p2];
vec3_t v3;
v3[0] = ( v1[0] + v2[0] ) * 0.5;
v3[1] = ( v1[1] + v2[1] ) * 0.5;
v3[2] = ( v1[2] + v2[2] ) * 0.5;
DrawAlternatePoint( v3, m_fScale );
}
qglEnd();
qglLineWidth( 1.0 );
qglPointSize( 4 );
qglColor3f( 0,0,1 );
qglBegin( GL_POINTS );
for ( i = 0 ; i < g_qeglobals.d_numedges ; i++ )
{
v1 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p1];
v2 = g_qeglobals.d_points[g_qeglobals.d_edges[i].p2];
qglVertex3f( ( v1[0] + v2[0] ) * 0.5,( v1[1] + v2[1] ) * 0.5,( v1[2] + v2[2] ) * 0.5 );
}
qglEnd();
qglPointSize( 1 );
}
if ( !( m_nViewType == XY ) ) {
@ -3417,23 +3358,12 @@ void ClipPoint::Draw( float fScale, int num ){
void ClipPoint::Draw( float fScale, const char *label ){
// draw point
if ( !g_PrefsDlg.m_bGlPtWorkaround ) {
qglPointSize( 4 );
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER] );
qglBegin( GL_POINTS );
qglVertex3fv( m_ptClip );
qglEnd();
qglPointSize( 1 );
}
else
{
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER] );
qglLineWidth( 2.0 );
qglBegin( GL_LINES );
DrawAlternatePoint( m_ptClip, fScale );
qglEnd();
qglLineWidth( 1.0 );
}
qglPointSize( 4 );
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER] );
qglBegin( GL_POINTS );
qglVertex3fv( m_ptClip );
qglEnd();
qglPointSize( 1 );
// draw label
qglRasterPos3f( m_ptClip[0] + 2, m_ptClip[1] + 2, m_ptClip[2] + 2 );