src/video/x11/SDL_x11opengl.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 08 Apr 2011 13:03:26 -0700
changeset 5535 96594ac5fd1a
parent 5262 b530ef003506
child 5572 32a785da3f49
permissions -rw-r--r--
SDL 1.3 is now under the zlib license.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     3
  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
#include "SDL_config.h"
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
#ifndef _SDL_x11opengl_h
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
#define _SDL_x11opengl_h
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
#if SDL_VIDEO_OPENGL_GLX
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
#include "SDL_opengl.h"
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#include <GL/glx.h>
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
struct SDL_GLDriverData
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
{
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
    SDL_bool HAS_GLX_EXT_visual_rating;
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
    void *(*glXGetProcAddress) (const GLubyte * procName);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
    XVisualInfo *(*glXChooseVisual)
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
      (Display * dpy, int screen, int *attribList);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
      GLXContext(*glXCreateContext)
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
      (Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
    void (*glXDestroyContext)
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
      (Display * dpy, GLXContext ctx);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
      Bool(*glXMakeCurrent)
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
      (Display * dpy, GLXDrawable drawable, GLXContext ctx);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
    void (*glXSwapBuffers)
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
      (Display * dpy, GLXDrawable drawable);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    50
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
    int (*glXSwapIntervalSGI) (int interval);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
      GLint(*glXSwapIntervalMESA) (unsigned interval);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
      GLint(*glXGetSwapIntervalMESA) (void);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
};
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
/* OpenGL functions */
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
extern int X11_GL_LoadLibrary(_THIS, const char *path);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
3057
089a77aebb7d Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    59
extern void X11_GL_UnloadLibrary(_THIS);
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
                              SDL_GLContext context);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
extern int X11_GL_SetSwapInterval(_THIS, int interval);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
extern int X11_GL_GetSwapInterval(_THIS);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
#endif /* SDL_VIDEO_OPENGL_GLX */
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
#endif /* _SDL_x11opengl_h */
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    72
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    73
/* vi: set ts=4 sw=4 expandtab: */