src/video/x11/SDL_x11opengl.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Jul 2006 08:43:17 +0000
changeset 1952 420716272158
child 1953 214880ed48c3
permissions -rw-r--r--
Implemented X11 OpenGL support.
Added support for the SDL_VIDEO_OPENGL environment variable.
slouken@1952
     1
/*
slouken@1952
     2
    SDL - Simple DirectMedia Layer
slouken@1952
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@1952
     4
slouken@1952
     5
    This library is free software; you can redistribute it and/or
slouken@1952
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1952
     7
    License as published by the Free Software Foundation; either
slouken@1952
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1952
     9
slouken@1952
    10
    This library is distributed in the hope that it will be useful,
slouken@1952
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1952
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1952
    13
    Lesser General Public License for more details.
slouken@1952
    14
slouken@1952
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1952
    16
    License along with this library; if not, write to the Free Software
slouken@1952
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1952
    18
slouken@1952
    19
    Sam Lantinga
slouken@1952
    20
    slouken@libsdl.org
slouken@1952
    21
*/
slouken@1952
    22
#include "SDL_config.h"
slouken@1952
    23
slouken@1952
    24
#ifndef _SDL_x11opengl_h
slouken@1952
    25
#define _SDL_x11opengl_h
slouken@1952
    26
slouken@1952
    27
#if SDL_VIDEO_OPENGL_GLX
slouken@1952
    28
#include "SDL_opengl.h"
slouken@1952
    29
#include <GL/glx.h>
slouken@1952
    30
slouken@1952
    31
struct SDL_GLDriverData
slouken@1952
    32
{
slouken@1952
    33
    int initialized;
slouken@1952
    34
    SDL_bool HAS_GLX_EXT_visual_rating;
slouken@1952
    35
slouken@1952
    36
    void *(*glXGetProcAddress) (const GLubyte * procName);
slouken@1952
    37
slouken@1952
    38
    XVisualInfo *(*glXChooseVisual)
slouken@1952
    39
      (Display * dpy, int screen, int *attribList);
slouken@1952
    40
slouken@1952
    41
      GLXContext(*glXCreateContext)
slouken@1952
    42
      (Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
slouken@1952
    43
slouken@1952
    44
    void (*glXDestroyContext)
slouken@1952
    45
      (Display * dpy, GLXContext ctx);
slouken@1952
    46
slouken@1952
    47
      Bool(*glXMakeCurrent)
slouken@1952
    48
      (Display * dpy, GLXDrawable drawable, GLXContext ctx);
slouken@1952
    49
slouken@1952
    50
    void (*glXSwapBuffers)
slouken@1952
    51
      (Display * dpy, GLXDrawable drawable);
slouken@1952
    52
slouken@1952
    53
    int (*glXGetConfig)
slouken@1952
    54
      (Display * dpy, XVisualInfo * visual_info, int attrib, int *value);
slouken@1952
    55
slouken@1952
    56
    int (*glXSwapIntervalSGI) (int interval);
slouken@1952
    57
      GLint(*glXSwapIntervalMESA) (unsigned interval);
slouken@1952
    58
      GLint(*glXGetSwapIntervalMESA) (void);
slouken@1952
    59
};
slouken@1952
    60
slouken@1952
    61
/* OpenGL functions */
slouken@1952
    62
extern int X11_GL_LoadLibrary(_THIS, const char *path);
slouken@1952
    63
extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
slouken@1952
    64
extern int X11_GL_Initialize(_THIS);
slouken@1952
    65
extern void X11_GL_Shutdown(_THIS);
slouken@1952
    66
extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
slouken@1952
    67
extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
slouken@1952
    68
extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
slouken@1952
    69
                              SDL_GLContext context);
slouken@1952
    70
extern int X11_GL_SetSwapInterval(_THIS, int interval);
slouken@1952
    71
extern int X11_GL_GetSwapInterval(_THIS);
slouken@1952
    72
extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
slouken@1952
    73
extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
slouken@1952
    74
slouken@1952
    75
#endif /* SDL_VIDEO_OPENGL_GLX */
slouken@1952
    76
slouken@1952
    77
#endif /* _SDL_x11opengl_h */
slouken@1952
    78
slouken@1952
    79
/* vi: set ts=4 sw=4 expandtab: */