Quake II RTX doxygen  1.0 dev
wgl.c File Reference
#include "client.h"
#include "glimp.h"
#include "wgl.h"

Go to the source code of this file.

Macros

#define GPA(x)   (void *)GetProcAddress(glw.hinstOpenGL, x);
 
#define GPA(x)   (void *)qwglGetProcAddress(x)
 

Functions

 void (APIENTRY *qwglDrawBuffer)(GLenum mode)
 
const GLubyte *APIENTRYqwglGetString (GLenum name)
 
 int (WINAPI *qwglChoosePixelFormat)(HDC
 
 BOOL (WINAPI *qwglSetPixelFormat)(HDC
 
 HGLRC (WINAPI *qwglCreateContext)(HDC)
 
 PROC (WINAPI *qwglGetProcAddress)(LPCSTR)
 
const char *WINAPI * qwglGetExtensionsStringARB (HDC hdc)
 
void WGL_Shutdown (void)
 
qboolean WGL_Init (const char *dllname)
 
void WGL_ShutdownExtensions (unsigned mask)
 
void WGL_InitExtensions (unsigned mask)
 
unsigned WGL_ParseExtensionString (const char *s)
 

Variables

CONST PIXELFORMATDESCRIPTOR int
 
CONST PIXELFORMATDESCRIPTOR UINT
 
CONST PIXELFORMATDESCRIPTOR LPPIXELFORMATDESCRIPTOR
 
 HGLRC
 

Macro Definition Documentation

◆ GPA [1/2]

#define GPA (   x)    (void *)GetProcAddress(glw.hinstOpenGL, x);

Definition at line 103 of file wgl.c.

◆ GPA [2/2]

#define GPA (   x)    (void *)qwglGetProcAddress(x)

Definition at line 103 of file wgl.c.

Function Documentation

◆ BOOL()

const int const FLOAT int UINT * BOOL ( WINAPI *  qwglSetPixelFormat)

◆ HGLRC()

HGLRC ( WINAPI *  qwglCreateContext)

◆ int()

int ( WINAPI *  qwglChoosePixelFormat)

◆ PROC()

PROC ( WINAPI *  qwglGetProcAddress)

◆ qwglGetExtensionsStringARB()

const char* WINAPI* qwglGetExtensionsStringARB ( HDC  hdc)

◆ qwglGetString()

const GLubyte* APIENTRY* qwglGetString ( GLenum  name)

Referenced by VID_Init(), WGL_Init(), and WGL_Shutdown().

◆ void()

void ( APIENTRY qwglDrawBuffer)

◆ WGL_Init()

qboolean WGL_Init ( const char *  dllname)

Definition at line 66 of file wgl.c.

67 {
68  if ((glw.hinstOpenGL = LoadLibrary(dllname)) == NULL) {
69  return qfalse;
70  }
71 
72  qwglDrawBuffer = GPA("glDrawBuffer");
73  qwglGetString = GPA("glGetString");
74 
75  qwglChoosePixelFormat = GPA("wglChoosePixelFormat");
76  qwglDescribePixelFormat = GPA("wglDescribePixelFormat");
77  qwglSetPixelFormat = GPA("wglSetPixelFormat");
78  qwglSwapBuffers = GPA("wglSwapBuffers");
79 
80  qwglCreateContext = GPA("wglCreateContext");
81  qwglDeleteContext = GPA("wglDeleteContext");
82  qwglGetProcAddress = GPA("wglGetProcAddress");
83  qwglMakeCurrent = GPA("wglMakeCurrent");
84 
85  return qtrue;
86 }

Referenced by LoadGL().

◆ WGL_InitExtensions()

void WGL_InitExtensions ( unsigned  mask)

Definition at line 105 of file wgl.c.

106 {
107  if (mask & QWGL_ARB_extensions_string) {
108  qwglGetExtensionsStringARB = GPA("wglGetExtensionsStringARB");
109  }
110  if (mask & QWGL_ARB_pixel_format) {
111  qwglChoosePixelFormatARB = GPA("wglChoosePixelFormatARB");
112  }
113  if (mask & QWGL_EXT_swap_control) {
114  qwglSwapIntervalEXT = GPA("wglSwapIntervalEXT");
115  }
116 }

Referenced by GetFakeWindowExtensions(), and VID_Init().

◆ WGL_ParseExtensionString()

unsigned WGL_ParseExtensionString ( const char *  s)

Definition at line 120 of file wgl.c.

121 {
122  // must match defines in win_wgl.h!
123  static const char *const extnames[] = {
124  "WGL_ARB_extensions_string",
125  "WGL_ARB_multisample",
126  "WGL_ARB_pixel_format",
127  "WGL_EXT_swap_control",
128  "WGL_EXT_swap_control_tear",
129  NULL
130  };
131 
132  return Com_ParseExtensionString(s, extnames);
133 }

Referenced by GetFakeWindowExtensions(), and VID_Init().

◆ WGL_Shutdown()

void WGL_Shutdown ( void  )

Definition at line 41 of file wgl.c.

42 {
43  if (glw.hinstOpenGL) {
44  FreeLibrary(glw.hinstOpenGL);
45  glw.hinstOpenGL = NULL;
46  }
47 
48  qwglDrawBuffer = NULL;
49  qwglGetString = NULL;
50 
51  qwglChoosePixelFormat = NULL;
52  qwglDescribePixelFormat = NULL;
53  qwglSetPixelFormat = NULL;
54  qwglSwapBuffers = NULL;
55 
56  qwglCreateContext = NULL;
57  qwglDeleteContext = NULL;
58  qwglGetProcAddress = NULL;
59  qwglMakeCurrent = NULL;
60 
62 }

Referenced by LoadGL(), and VID_Shutdown().

◆ WGL_ShutdownExtensions()

void WGL_ShutdownExtensions ( unsigned  mask)

Definition at line 90 of file wgl.c.

91 {
92  if (mask & QWGL_ARB_extensions_string) {
94  }
95  if (mask & QWGL_ARB_pixel_format) {
96  qwglChoosePixelFormatARB = NULL;
97  }
98  if (mask & QWGL_EXT_swap_control) {
99  qwglSwapIntervalEXT = NULL;
100  }
101 }

Referenced by WGL_Shutdown().

Variable Documentation

◆ HGLRC

HGLRC

Definition at line 33 of file wgl.c.

Referenced by GetFakeWindowExtensions().

◆ int

◆ LPPIXELFORMATDESCRIPTOR

CONST PIXELFORMATDESCRIPTOR LPPIXELFORMATDESCRIPTOR

Definition at line 26 of file wgl.c.

◆ UINT

const int const FLOAT UINT
QWGL_ARB_pixel_format
#define QWGL_ARB_pixel_format
Definition: wgl.h:25
QWGL_ARB_extensions_string
#define QWGL_ARB_extensions_string
Definition: wgl.h:23
glw
glwstate_t glw
Definition: glimp.c:35
QWGL_EXT_swap_control
#define QWGL_EXT_swap_control
Definition: wgl.h:26
WGL_ShutdownExtensions
void WGL_ShutdownExtensions(unsigned mask)
Definition: wgl.c:90
GPA
#define GPA(x)
Definition: wgl.c:103
qwglGetString
const GLubyte *APIENTRY * qwglGetString(GLenum name)
glwstate_t::hinstOpenGL
HINSTANCE hinstOpenGL
Definition: glimp.h:28
qwglGetExtensionsStringARB
const char *WINAPI * qwglGetExtensionsStringARB(HDC hdc)