mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 22:11:22 +00:00
gl_vidsdl.c, gl_vidnt.c: more sync'ing between gl_vidsdl.c and fitz-0.85
version of gl_vidnt.c. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@129 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
8a9230a245
commit
6f81045e9f
2 changed files with 91 additions and 91 deletions
125
Quake/gl_vidnt.c
125
Quake/gl_vidnt.c
|
@ -251,7 +251,7 @@ void VID_Gamma_f (void)
|
|||
|
||||
oldgamma = vid_gamma.value;
|
||||
|
||||
for (i=0; i<256; i++)
|
||||
for (i=0; i<256; i++)
|
||||
vid_gammaramp[i] = vid_gammaramp[i+256] = vid_gammaramp[i+512] =
|
||||
CLAMP(0, (int) (255 * pow ((i+0.5)/255.5, vid_gamma.value) + 0.5), 255) << 8;
|
||||
|
||||
|
@ -973,22 +973,19 @@ CheckArrayExtensions
|
|||
*/
|
||||
void CheckArrayExtensions (void)
|
||||
{
|
||||
char *tmp;
|
||||
const char *tmp;
|
||||
|
||||
/* check for texture extension */
|
||||
tmp = (unsigned char *)glGetString(GL_EXTENSIONS);
|
||||
tmp = (const char *)glGetString(GL_EXTENSIONS);
|
||||
while (*tmp)
|
||||
{
|
||||
if (strncmp((const char*)tmp, "GL_EXT_vertex_array", strlen("GL_EXT_vertex_array")) == 0)
|
||||
if (strncmp(tmp, "GL_EXT_vertex_array", sizeof("GL_EXT_vertex_array") -1) == 0)
|
||||
{
|
||||
if (
|
||||
((glArrayElementEXT = wglGetProcAddress("glArrayElementEXT")) == NULL) ||
|
||||
((glColorPointerEXT = wglGetProcAddress("glColorPointerEXT")) == NULL) ||
|
||||
((glTexCoordPointerEXT = wglGetProcAddress("glTexCoordPointerEXT")) == NULL) ||
|
||||
((glVertexPointerEXT = wglGetProcAddress("glVertexPointerEXT")) == NULL) )
|
||||
if (((glArrayElementEXT = wglGetProcAddress("glArrayElementEXT")) == NULL) ||
|
||||
((glColorPointerEXT = wglGetProcAddress("glColorPointerEXT")) == NULL) ||
|
||||
((glTexCoordPointerEXT = wglGetProcAddress("glTexCoordPointerEXT")) == NULL) ||
|
||||
((glVertexPointerEXT = wglGetProcAddress("glVertexPointerEXT")) == NULL) )
|
||||
{
|
||||
Sys_Error ("GetProcAddress for vertex extension failed");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1114,7 +1111,7 @@ void GL_CheckExtensions (void)
|
|||
if (strstr(gl_extensions, "GL_EXT_texture_filter_anisotropic"))
|
||||
{
|
||||
float test1,test2;
|
||||
int tex;
|
||||
GLuint tex;
|
||||
|
||||
// test to make sure we really have control over it
|
||||
// 1.0 and 2.0 should always be legal values
|
||||
|
@ -1195,10 +1192,10 @@ GL_Init
|
|||
*/
|
||||
void GL_Init (void)
|
||||
{
|
||||
gl_vendor = glGetString (GL_VENDOR);
|
||||
gl_renderer = glGetString (GL_RENDERER);
|
||||
gl_version = glGetString (GL_VERSION);
|
||||
gl_extensions = glGetString (GL_EXTENSIONS);
|
||||
gl_vendor = (const char *) glGetString (GL_VENDOR);
|
||||
gl_renderer = (const char *) glGetString (GL_RENDERER);
|
||||
gl_version = (const char *) glGetString (GL_VERSION);
|
||||
gl_extensions = (const char *) glGetString (GL_EXTENSIONS);
|
||||
|
||||
GetWGLExtensions (); //johnfitz
|
||||
GL_CheckExtensions (); //johnfitz
|
||||
|
@ -1207,11 +1204,11 @@ void GL_Init (void)
|
|||
|
||||
Cvar_RegisterVariable (&vid_vsync, VID_Vsync_f); //johnfitz
|
||||
|
||||
if (strnicmp(gl_renderer,"PowerVR",7)==0)
|
||||
fullsbardraw = true;
|
||||
if (strnicmp(gl_renderer,"PowerVR",7)==0)
|
||||
fullsbardraw = true;
|
||||
|
||||
if (strnicmp(gl_renderer,"Permedia",8)==0)
|
||||
isPermedia = true;
|
||||
if (strnicmp(gl_renderer,"Permedia",8)==0)
|
||||
isPermedia = true;
|
||||
|
||||
//johnfitz -- intel video workarounds from Baker
|
||||
if (!strcmp(gl_vendor, "Intel"))
|
||||
|
@ -1287,19 +1284,19 @@ void VID_SetDefaultMode (void)
|
|||
|
||||
void VID_Shutdown (void)
|
||||
{
|
||||
HGLRC hRC;
|
||||
HDC hDC;
|
||||
HGLRC hRC;
|
||||
HDC hDC;
|
||||
|
||||
if (vid_initialized)
|
||||
{
|
||||
vid_canalttab = false;
|
||||
hRC = wglGetCurrentContext();
|
||||
hDC = wglGetCurrentDC();
|
||||
hDC = wglGetCurrentDC();
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
if (hRC)
|
||||
wglDeleteContext(hRC);
|
||||
if (hRC)
|
||||
wglDeleteContext(hRC);
|
||||
|
||||
VID_Gamma_Shutdown (); //johnfitz
|
||||
|
||||
|
@ -1572,15 +1569,15 @@ LONG WINAPI MainWndProc (
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
LONG lRet = 1;
|
||||
LONG lRet = 1;
|
||||
int fwKeys, xPos, yPos, fActive, fMinimized, temp;
|
||||
extern unsigned int uiWheelMessage;
|
||||
|
||||
if ( uMsg == uiWheelMessage )
|
||||
uMsg = WM_MOUSEWHEEL;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_KILLFOCUS:
|
||||
if (modestate == MS_FULLDIB)
|
||||
ShowWindow(mainwindow, SW_SHOWMINNOACTIVE);
|
||||
|
@ -1646,17 +1643,17 @@ LONG WINAPI MainWndProc (
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
break;
|
||||
case WM_SIZE:
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
case WM_CLOSE:
|
||||
if (MessageBox (mainwindow, "Are you sure you want to quit?", "Confirm Exit",
|
||||
MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION) == IDYES)
|
||||
{
|
||||
Sys_Quit ();
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case WM_ACTIVATE:
|
||||
fActive = LOWORD(wParam);
|
||||
|
@ -1668,27 +1665,27 @@ LONG WINAPI MainWndProc (
|
|||
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
if (dibwindow)
|
||||
DestroyWindow (dibwindow);
|
||||
|
||||
PostQuitMessage (0);
|
||||
}
|
||||
break;
|
||||
|
||||
case MM_MCINOTIFY:
|
||||
lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam);
|
||||
PostQuitMessage (0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* pass all unhandled messages to DefWindowProc */
|
||||
lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
case MM_MCINOTIFY:
|
||||
lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
|
||||
/* return 1 if handled message, 0 if not */
|
||||
return lRet;
|
||||
default:
|
||||
/* pass all unhandled messages to DefWindowProc */
|
||||
lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
/* return 1 if handled message, 0 if not */
|
||||
return lRet;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1811,10 +1808,10 @@ VID_DescribeModes_f -- johnfitz -- changed formatting, and added refresh rates a
|
|||
*/
|
||||
void VID_DescribeModes_f (void)
|
||||
{
|
||||
int i, lnummodes, t;
|
||||
int i, lnummodes, t;
|
||||
char *pinfo;
|
||||
vmode_t *pv;
|
||||
int lastwidth=0, lastheight=0, lastbpp=0, count=0;
|
||||
int lastwidth=0, lastheight=0, lastbpp=0, count=0;
|
||||
|
||||
lnummodes = VID_NumModes ();
|
||||
|
||||
|
@ -1863,18 +1860,18 @@ void VID_InitDIB (HINSTANCE hInstance)
|
|||
int i;
|
||||
|
||||
/* Register the frame class */
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = (WNDPROC)MainWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = 0;
|
||||
wc.hCursor = LoadCursor (NULL,IDC_ARROW);
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = (WNDPROC)MainWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = 0;
|
||||
wc.hCursor = LoadCursor (NULL,IDC_ARROW);
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.lpszClassName = "FitzQuake"; //johnfitz -- was WinQuake
|
||||
wc.lpszMenuName = 0;
|
||||
wc.lpszClassName = "FitzQuake"; //johnfitz -- was WinQuake
|
||||
|
||||
if (!RegisterClass (&wc) )
|
||||
if (!RegisterClass (&wc) )
|
||||
Sys_Error ("Couldn't register window class");
|
||||
|
||||
modelist[0].type = MS_WINDOWED;
|
||||
|
@ -2297,18 +2294,18 @@ void VID_Init (void)
|
|||
|
||||
VID_SetMode (vid_default);
|
||||
|
||||
maindc = GetDC(mainwindow);
|
||||
maindc = GetDC(mainwindow);
|
||||
bSetupPixelFormat(maindc);
|
||||
|
||||
baseRC = wglCreateContext( maindc );
|
||||
baseRC = wglCreateContext( maindc );
|
||||
if (!baseRC)
|
||||
Sys_Error ("Could not initialize GL (wglCreateContext failed).\n\nMake sure you in are 65535 color mode, and try running -window.");
|
||||
if (!wglMakeCurrent( maindc, baseRC ))
|
||||
if (!wglMakeCurrent( maindc, baseRC ))
|
||||
Sys_Error ("VID_Init: wglMakeCurrent failed");
|
||||
|
||||
GL_Init ();
|
||||
|
||||
//johnfitz -- removed code to create "glquake" subdirectory
|
||||
//johnfitz -- removed code creating "glquake" subdirectory
|
||||
|
||||
vid_realmode = vid_modenum;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
Copyright (C) 1996-2001 Id Software, Inc.
|
||||
Copyright (C) 2002-2005 John Fitzgibbons and others
|
||||
Copyright (C) 2002-2009 John Fitzgibbons and others
|
||||
Copyright (C) 2007-2008 Kristian Duske
|
||||
Copyright (C) 2010 Ozkan Sezer and Steven Atkinson
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -43,6 +44,7 @@ typedef struct {
|
|||
int dib;
|
||||
int fullscreen;
|
||||
int bpp;
|
||||
// int refreshrate; //johnfitz
|
||||
int halfscreen;
|
||||
char modedesc[17];
|
||||
} vmode_t;
|
||||
|
@ -130,9 +132,9 @@ void GL_SetupState (void); //johnfitz
|
|||
//====================================
|
||||
|
||||
//johnfitz -- new cvars
|
||||
cvar_t vid_fullscreen = {"vid_fullscreen", "0", true};
|
||||
cvar_t vid_width = {"vid_width", "800", true};
|
||||
cvar_t vid_height = {"vid_height", "600", true};
|
||||
cvar_t vid_fullscreen = {"vid_fullscreen", "0", true}; // QuakeSpasm, was "1"
|
||||
cvar_t vid_width = {"vid_width", "800", true}; // QuakeSpasm, was 640
|
||||
cvar_t vid_height = {"vid_height", "600", true}; // QuakeSpasm, was 480
|
||||
cvar_t vid_bpp = {"vid_bpp", "16", true};
|
||||
cvar_t vid_refreshrate = {"vid_refreshrate", "60", true};
|
||||
cvar_t vid_vsync = {"vid_vsync", "0", true};
|
||||
|
@ -208,7 +210,8 @@ void VID_Gamma_f (void)
|
|||
|
||||
for (i=0; i<256; i++)
|
||||
{
|
||||
vid_gamma_red[i] = CLAMP(0, (int) (255 * pow ((i+0.5)/255.5, vid_gamma.value) + 0.5), 255) << 8;
|
||||
vid_gamma_red[i] =
|
||||
CLAMP(0, (int) (255 * pow ((i+0.5)/255.5, vid_gamma.value) + 0.5), 255) << 8;
|
||||
vid_gamma_green[i] = vid_gamma_red[i];
|
||||
vid_gamma_blue[i] = vid_gamma_red[i];
|
||||
}
|
||||
|
@ -564,13 +567,12 @@ CheckArrayExtensions
|
|||
*/
|
||||
void CheckArrayExtensions (void)
|
||||
{
|
||||
unsigned char *tmp;
|
||||
const char *tmp;
|
||||
|
||||
/* check for texture extension */
|
||||
tmp = (GLubyte *)glGetString(GL_EXTENSIONS);
|
||||
tmp = (const char *)glGetString(GL_EXTENSIONS);
|
||||
while (*tmp)
|
||||
{
|
||||
if (strncmp((const char*)tmp, "GL_EXT_vertex_array", strlen("GL_EXT_vertex_array")) == 0)
|
||||
if (strncmp(tmp, "GL_EXT_vertex_array", sizeof("GL_EXT_vertex_array") -1) == 0)
|
||||
{
|
||||
if (((glArrayElementEXT = SDL_GL_GetProcAddress("glArrayElementEXT")) == NULL) ||
|
||||
((glColorPointerEXT = SDL_GL_GetProcAddress("glColorPointerEXT")) == NULL) ||
|
||||
|
@ -578,7 +580,6 @@ void CheckArrayExtensions (void)
|
|||
((glVertexPointerEXT = SDL_GL_GetProcAddress("glVertexPointerEXT")) == NULL) )
|
||||
{
|
||||
Sys_Error ("GetProcAddress for vertex extension failed");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1052,7 +1053,7 @@ void VID_InitDIB (void)
|
|||
if (COM_CheckParm("-width"))
|
||||
modelist[0].width = Q_atoi(com_argv[COM_CheckParm("-width")+1]);
|
||||
else
|
||||
modelist[0].width = 800;
|
||||
modelist[0].width = 800; // QuakeSpasm, was 640
|
||||
|
||||
if (modelist[0].width < 320)
|
||||
modelist[0].width = 320;
|
||||
|
@ -1374,8 +1375,11 @@ void VID_Init (void)
|
|||
PL_SetWindowIcon();
|
||||
|
||||
VID_SetMode (vid_default);
|
||||
|
||||
GL_Init ();
|
||||
|
||||
//johnfitz -- removed code creating "glquake" subdirectory
|
||||
|
||||
vid_realmode = vid_modenum;
|
||||
|
||||
vid_menucmdfn = VID_Menu_f; //johnfitz
|
||||
|
@ -1430,7 +1434,6 @@ vrestart:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
VID_SyncCvars -- johnfitz -- set vid cvars to match current video mode
|
||||
|
@ -1807,39 +1810,39 @@ void VID_MenuDraw (void)
|
|||
M_PrintWhite ((320-8*strlen(title))/2, 32, title);
|
||||
|
||||
// options
|
||||
M_Print (16, video_cursor_table[i], " Video mode");
|
||||
M_Print (216, video_cursor_table[i], va("%ix%i", (int)vid_width.value, (int)vid_height.value));
|
||||
M_Print (16, video_cursor_table[i], " Video mode");
|
||||
M_Print (184, video_cursor_table[i], va("%ix%i", (int)vid_width.value, (int)vid_height.value));
|
||||
i++;
|
||||
|
||||
M_Print (16, video_cursor_table[i], " Color depth");
|
||||
M_Print (216, video_cursor_table[i], va("%i", (int)vid_bpp.value));
|
||||
M_Print (16, video_cursor_table[i], " Color depth");
|
||||
M_Print (184, video_cursor_table[i], va("%i", (int)vid_bpp.value));
|
||||
i++;
|
||||
|
||||
M_Print (16, video_cursor_table[i], " Refresh rate");
|
||||
// M_Print (216, video_cursor_table[i], va("%i Hz", (int)vid_refreshrate.value)); refresh rates are disabled for now -- kristian
|
||||
M_Print (216, video_cursor_table[i], "N/A");
|
||||
M_Print (16, video_cursor_table[i], " Refresh rate");
|
||||
// M_Print (184, video_cursor_table[i], va("%i Hz", (int)vid_refreshrate.value)); refresh rates are disabled for now -- kristian
|
||||
M_Print (184, video_cursor_table[i], "N/A");
|
||||
i++;
|
||||
|
||||
M_Print (16, video_cursor_table[i], " Fullscreen");
|
||||
M_DrawCheckbox (216, video_cursor_table[i], (int)vid_fullscreen.value);
|
||||
M_Print (16, video_cursor_table[i], " Fullscreen");
|
||||
M_DrawCheckbox (184, video_cursor_table[i], (int)vid_fullscreen.value);
|
||||
i++;
|
||||
|
||||
// added vsync to the video menu -- kristian
|
||||
M_Print (16, video_cursor_table[i], " Vertical Sync");
|
||||
M_Print (16, video_cursor_table[i], " Vertical Sync");
|
||||
if (gl_swap_control)
|
||||
M_DrawCheckbox (216, video_cursor_table[i], (int)vid_vsync.value);
|
||||
M_DrawCheckbox (184, video_cursor_table[i], (int)vid_vsync.value);
|
||||
else
|
||||
M_Print (216, video_cursor_table[i], "N/A");
|
||||
M_Print (184, video_cursor_table[i], "N/A");
|
||||
|
||||
i++;
|
||||
|
||||
M_Print (16, video_cursor_table[i], " Test changes");
|
||||
M_Print (16, video_cursor_table[i], " Test changes");
|
||||
i++;
|
||||
|
||||
M_Print (16, video_cursor_table[i], " Apply changes");
|
||||
M_Print (16, video_cursor_table[i], " Apply changes");
|
||||
|
||||
// cursor
|
||||
M_DrawCharacter (200, video_cursor_table[video_options_cursor], 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (168, video_cursor_table[video_options_cursor], 12+((int)(realtime*4)&1));
|
||||
|
||||
// notes "345678901234567890123456789012345678"
|
||||
// M_Print (16, 172, "Windowed modes always use the desk- ");
|
||||
|
|
Loading…
Reference in a new issue