comparison src/video/cybergfx/SDL_cgxgl_c.h @ 0:74212992fb08

Initial revision
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:45:43 +0000
parents
children e8157fcb3114
comparison
equal deleted inserted replaced
-1:000000000000 0:74212992fb08
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Sam Lantinga
20 slouken@devolution.com
21 */
22
23 #ifdef SAVE_RCSID
24 static char rcsid =
25 "@(#) $Id$";
26 #endif
27
28 #include <stdio.h>
29
30 #ifdef HAVE_OPENGL
31 #include <GL/glx.h>
32 #include <dlfcn.h>
33 #endif
34 #include "SDL_sysvideo.h"
35
36 struct SDL_PrivateGLData {
37 int gl_active; /* to stop switching drivers while we have a valid context */
38
39 #ifdef HAVE_OPENGL
40 GLXContext glx_context; /* Current GL context */
41 XVisualInfo* glx_visualinfo; /* XVisualInfo* returned by glXChooseVisual */
42
43 XVisualInfo* (*glXChooseVisual)
44 ( Display* dpy,
45 int screen,
46 int* attribList );
47
48 GLXContext (*glXCreateContext)
49 ( Display* dpy,
50 XVisualInfo* vis,
51 GLXContext shareList,
52 Bool direct );
53
54 void (*glXDestroyContext)
55 ( Display* dpy,
56 GLXContext ctx );
57
58 Bool (*glXMakeCurrent)
59 ( Display* dpy,
60 GLXDrawable drawable,
61 GLXContext ctx );
62
63 void (*glXSwapBuffers)
64 ( Display* dpy,
65 GLXDrawable drawable );
66
67 int (*glXGetConfig)
68 ( Display* dpy,
69 XVisualInfo* visual_info,
70 int attrib,
71 int* value );
72
73 void (*glXReleaseBuffersMESA)
74 ( Display* dpy,
75 GLXDrawable drawable );
76
77 #endif /* HAVE_OPENGL */
78 };
79
80 /* Old variable names */
81 #define gl_active (this->gl_data->gl_active)
82 #define glx_context (this->gl_data->glx_context)
83 #define glx_visualinfo (this->gl_data->glx_visualinfo)
84
85 /* OpenGL functions */
86 extern void *CGX_GL_GetVisual(_THIS);
87 extern int CGX_GL_CreateWindow(_THIS, int w, int h);
88 extern int CGX_GL_CreateContext(_THIS);
89 extern void CGX_GL_Shutdown(_THIS);
90 #ifdef HAVE_OPENGL
91 extern int CGX_GL_MakeCurrent(_THIS);
92 extern int CGX_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
93 extern void CGX_GL_SwapBuffers(_THIS);
94 extern int CGX_GL_LoadLibrary(_THIS, const char* path);
95 extern void *CGX_GL_GetProcAddress(_THIS, const char* proc);
96 #endif
97 extern void CGX_GL_UnloadLibrary(_THIS);
98