src/video/x11/SDL_x11gl_c.h
author Ryan C. Gordon <icculus@icculus.org>
Wed, 22 Mar 2006 05:00:59 +0000
changeset 1575 3ba88cb7eb1b
parent 1402 d910939febfa
child 1656 96c2f89cc7e1
permissions -rw-r--r--
Updated dynamic X11 code. See details in Bugzilla #170.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@0
    23
slouken@1361
    24
#if SDL_VIDEO_OPENGL_GLX
slouken@0
    25
#include <GL/glx.h>
icculus@1191
    26
#include "SDL_loadso.h"
slouken@110
    27
#endif
icculus@1191
    28
slouken@1361
    29
#include "../SDL_sysvideo.h"
slouken@0
    30
slouken@0
    31
struct SDL_PrivateGLData {
slouken@0
    32
    int gl_active; /* to stop switching drivers while we have a valid context */
slouken@0
    33
slouken@1361
    34
#if SDL_VIDEO_OPENGL_GLX
slouken@0
    35
    GLXContext glx_context;	/* Current GL context */
slouken@0
    36
    XVisualInfo* glx_visualinfo; /* XVisualInfo* returned by glXChooseVisual */
slouken@0
    37
slouken@0
    38
    void * (*glXGetProcAddress)(const GLubyte *procName);
slouken@0
    39
slouken@0
    40
    XVisualInfo* (*glXChooseVisual)
slouken@0
    41
		( Display*		dpy,
slouken@0
    42
		  int			screen,
slouken@1315
    43
		  int*			attribList );
slouken@0
    44
slouken@0
    45
    GLXContext (*glXCreateContext)
slouken@0
    46
		( Display*		dpy,
slouken@1315
    47
		  XVisualInfo*		vis,
slouken@0
    48
		  GLXContext		shareList,
slouken@1315
    49
		  Bool			direct );
slouken@0
    50
slouken@0
    51
    void (*glXDestroyContext)
slouken@0
    52
		( Display* 		dpy,
slouken@0
    53
		  GLXContext		ctx );
slouken@0
    54
slouken@0
    55
    Bool (*glXMakeCurrent)
slouken@0
    56
		( Display*		dpy,
slouken@0
    57
		  GLXDrawable		drawable,
slouken@0
    58
		  GLXContext		ctx );
slouken@0
    59
slouken@0
    60
    void (*glXSwapBuffers)
slouken@0
    61
		( Display*		dpy,
slouken@0
    62
		  GLXDrawable		drawable );
slouken@0
    63
slouken@0
    64
    int (*glXGetConfig)
slouken@0
    65
	 ( Display* dpy,
slouken@0
    66
	   XVisualInfo* visual_info,
slouken@0
    67
	   int attrib,
slouken@0
    68
	   int* value );
slouken@0
    69
slouken@646
    70
    const char *(*glXQueryExtensionsString)
slouken@638
    71
	    ( Display* dpy,
slouken@1315
    72
	      int screen );
slouken@638
    73
slouken@638
    74
    
slouken@1361
    75
#endif /* SDL_VIDEO_OPENGL_GLX */
slouken@0
    76
};
slouken@0
    77
slouken@0
    78
/* Old variable names */
slouken@0
    79
#define gl_active		(this->gl_data->gl_active)
slouken@0
    80
#define glx_context		(this->gl_data->glx_context)
slouken@0
    81
#define glx_visualinfo		(this->gl_data->glx_visualinfo)
slouken@0
    82
slouken@0
    83
/* OpenGL functions */
slouken@0
    84
extern XVisualInfo *X11_GL_GetVisual(_THIS);
slouken@0
    85
extern int X11_GL_CreateWindow(_THIS, int w, int h);
slouken@0
    86
extern int X11_GL_CreateContext(_THIS);
slouken@0
    87
extern void X11_GL_Shutdown(_THIS);
slouken@1361
    88
#if SDL_VIDEO_OPENGL_GLX
slouken@0
    89
extern int X11_GL_MakeCurrent(_THIS);
slouken@0
    90
extern int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
slouken@0
    91
extern void X11_GL_SwapBuffers(_THIS);
slouken@0
    92
extern int X11_GL_LoadLibrary(_THIS, const char* path);
slouken@0
    93
extern void *X11_GL_GetProcAddress(_THIS, const char* proc);
slouken@0
    94
#endif
slouken@0
    95
extern void X11_GL_UnloadLibrary(_THIS);
slouken@0
    96