src/video/x11/SDL_x11opengl.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 09 Feb 2009 05:32:12 +0000
changeset 3057 089a77aebb7d
parent 2859 99210400e8b9
child 3697 f7b03b6838cb
permissions -rw-r--r--
Added test program for SDL_CreateWindowFrom()
Make sure OpenGL library is loaded before working with OpenGL windows,
even those created with SDL_CreateWindowFrom()
slouken@1952
     1
/*
slouken@1952
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 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
    SDL_bool HAS_GLX_EXT_visual_rating;
slouken@1952
    34
slouken@1952
    35
    void *(*glXGetProcAddress) (const GLubyte * procName);
slouken@1952
    36
slouken@1952
    37
    XVisualInfo *(*glXChooseVisual)
slouken@1952
    38
      (Display * dpy, int screen, int *attribList);
slouken@1952
    39
slouken@1952
    40
      GLXContext(*glXCreateContext)
slouken@1952
    41
      (Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
slouken@1952
    42
slouken@1952
    43
    void (*glXDestroyContext)
slouken@1952
    44
      (Display * dpy, GLXContext ctx);
slouken@1952
    45
slouken@1952
    46
      Bool(*glXMakeCurrent)
slouken@1952
    47
      (Display * dpy, GLXDrawable drawable, GLXContext ctx);
slouken@1952
    48
slouken@1952
    49
    void (*glXSwapBuffers)
slouken@1952
    50
      (Display * dpy, GLXDrawable drawable);
slouken@1952
    51
slouken@1952
    52
    int (*glXSwapIntervalSGI) (int interval);
slouken@1952
    53
      GLint(*glXSwapIntervalMESA) (unsigned interval);
slouken@1952
    54
      GLint(*glXGetSwapIntervalMESA) (void);
slouken@1952
    55
};
slouken@1952
    56
slouken@1952
    57
/* OpenGL functions */
slouken@1952
    58
extern int X11_GL_LoadLibrary(_THIS, const char *path);
slouken@1952
    59
extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
slouken@3057
    60
extern void X11_GL_UnloadLibrary(_THIS);
slouken@1952
    61
extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
slouken@1952
    62
extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
slouken@1952
    63
extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
slouken@1952
    64
                              SDL_GLContext context);
slouken@1952
    65
extern int X11_GL_SetSwapInterval(_THIS, int interval);
slouken@1952
    66
extern int X11_GL_GetSwapInterval(_THIS);
slouken@1952
    67
extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
slouken@1952
    68
extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
slouken@1952
    69
slouken@1952
    70
#endif /* SDL_VIDEO_OPENGL_GLX */
slouken@1952
    71
slouken@1952
    72
#endif /* _SDL_x11opengl_h */
slouken@1952
    73
slouken@1952
    74
/* vi: set ts=4 sw=4 expandtab: */