src/video/ataricommon/SDL_atarigl_c.h
author Sam Lantinga
Mon, 08 Dec 2008 00:27:32 +0000
changeset 2859 99210400e8b9
parent 2033 b657f0bc72c2
permissions -rw-r--r--
Updated copyright date
patmandin@989
     1
/*
patmandin@989
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 Sam Lantinga
patmandin@989
     4
patmandin@989
     5
    This library is free software; you can redistribute it and/or
patmandin@989
     6
    modify it under the terms of the GNU Library General Public
patmandin@989
     7
    License as published by the Free Software Foundation; either
patmandin@989
     8
    version 2 of the License, or (at your option) any later version.
patmandin@989
     9
patmandin@989
    10
    This library is distributed in the hope that it will be useful,
patmandin@989
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
patmandin@989
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
patmandin@989
    13
    Library General Public License for more details.
patmandin@989
    14
patmandin@989
    15
    You should have received a copy of the GNU Library General Public
patmandin@989
    16
    License along with this library; if not, write to the Free
patmandin@989
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
patmandin@989
    18
patmandin@989
    19
    Sam Lantinga
patmandin@989
    20
    slouken@libsdl.org
patmandin@989
    21
*/
slouken@1402
    22
#include "SDL_config.h"
patmandin@989
    23
patmandin@989
    24
/* Atari OSMesa.ldg implementation of SDL OpenGL support */
patmandin@989
    25
patmandin@989
    26
#ifndef _SDL_ATARIGL_H_
patmandin@989
    27
#define _SDL_ATARIGL_H_
patmandin@989
    28
slouken@1361
    29
#if SDL_VIDEO_OPENGL
patmandin@989
    30
#include <GL/osmesa.h>
patmandin@989
    31
#endif
patmandin@989
    32
slouken@1361
    33
#include "../SDL_sysvideo.h"
slouken@1361
    34
patmandin@2033
    35
struct SDL_GLDriverData
slouken@1895
    36
{
patmandin@991
    37
slouken@1895
    38
    int gl_active;              /* to stop switching drivers while we have a valid context */
patmandin@991
    39
slouken@1895
    40
    int gl_oldmesa;             /* Old OpenGL support ? */
slouken@1895
    41
slouken@1895
    42
    int gl_pixelsize;           /* for CopyShadow functions */
patmandin@991
    43
slouken@1895
    44
    SDL_bool gl_upsidedown;     /* Some implementations draw upside down */
patmandin@1005
    45
slouken@1895
    46
    Uint8 *gl_shadow;           /* Shadow buffer for old implementations */
patmandin@989
    47
slouken@1895
    48
    /* for unsupported OSMesa buffer formats */
slouken@1895
    49
    void (*ConvertSurface) (_THIS, SDL_Surface * surface);
patmandin@991
    50
slouken@1895
    51
    /* to convert the shadow buffer to the screen format */
slouken@1895
    52
    void (*CopyShadow) (_THIS, SDL_Surface * surface);
patmandin@991
    53
slouken@1361
    54
#if SDL_VIDEO_OPENGL
slouken@1895
    55
    OSMesaContext ctx;
patmandin@989
    56
slouken@1895
    57
    /* OpenGL functions */
slouken@1895
    58
    void (*glGetIntegerv) (GLenum pname, GLint * value);
slouken@1895
    59
    void (*glFinish) (void);
slouken@1895
    60
    void (*glFlush) (void);
patmandin@993
    61
slouken@1895
    62
    /* osmesa.ldg */
slouken@1895
    63
      OSMesaContext(*OSMesaCreateContextExt) (GLenum format, GLint depthBits,
slouken@1895
    64
                                              GLint stencilBits,
slouken@1895
    65
                                              GLint accumBits,
slouken@1895
    66
                                              OSMesaContext sharelist);
slouken@1895
    67
    void (*OSMesaDestroyContext) (OSMesaContext ctx);
slouken@1895
    68
      GLboolean(*OSMesaMakeCurrent) (OSMesaContext ctx, void *buffer,
slouken@1895
    69
                                     GLenum type, GLsizei width,
slouken@1895
    70
                                     GLsizei height);
slouken@1895
    71
    void (*OSMesaPixelStore) (GLint pname, GLint value);
slouken@1895
    72
    void *(*OSMesaGetProcAddress) (const char *funcName);
patmandin@991
    73
slouken@1895
    74
    /* mesa_gl.ldg, tiny_gl.ldg */
slouken@1895
    75
    void *(*OSMesaCreateLDG) (long format, long type, long width,
slouken@1895
    76
                              long height);
slouken@1895
    77
    void (*OSMesaDestroyLDG) (void);
patmandin@992
    78
slouken@1895
    79
    /* Info needed to compare existing context with new asked one */
slouken@1895
    80
    int width, height;
slouken@1895
    81
    GLenum format;
slouken@1895
    82
    GLint depth, stencil, accum;
patmandin@1004
    83
#endif
patmandin@989
    84
};
patmandin@989
    85
patmandin@991
    86
/* Variable names */
patmandin@2033
    87
#define gl_active		(_this->gl_data->gl_active)
patmandin@2033
    88
#define gl_ctx			(_this->gl_data->ctx)
patmandin@2033
    89
#define gl_oldmesa		(_this->gl_data->gl_oldmesa)
patmandin@2033
    90
#define gl_pixelsize	(_this->gl_data->gl_pixelsize)
patmandin@2033
    91
#define gl_upsidedown	(_this->gl_data->gl_upsidedown)
patmandin@2033
    92
#define gl_shadow		(_this->gl_data->gl_shadow)
patmandin@2033
    93
#define gl_convert		(_this->gl_data->ConvertSurface)
patmandin@2033
    94
#define gl_copyshadow	(_this->gl_data->CopyShadow)
patmandin@2033
    95
#define gl_curformat	(_this->gl_data->format)
patmandin@2033
    96
#define gl_curdepth		(_this->gl_data->depth)
patmandin@2033
    97
#define gl_curstencil	(_this->gl_data->stencil)
patmandin@2033
    98
#define gl_curaccum		(_this->gl_data->accum)
patmandin@2033
    99
#define gl_curwidth		(_this->gl_data->width)
patmandin@2033
   100
#define gl_curheight	(_this->gl_data->height)
patmandin@989
   101
patmandin@989
   102
/* OpenGL functions */
slouken@1895
   103
extern int SDL_AtariGL_Init(_THIS, SDL_Surface * current);
patmandin@992
   104
extern void SDL_AtariGL_Quit(_THIS, SDL_bool unload);
patmandin@991
   105
extern void SDL_AtariGL_InitPointers(_THIS);
patmandin@989
   106
patmandin@989
   107
extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
patmandin@989
   108
extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
slouken@1895
   109
extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
patmandin@989
   110
extern int SDL_AtariGL_MakeCurrent(_THIS);
patmandin@989
   111
extern void SDL_AtariGL_SwapBuffers(_THIS);
patmandin@989
   112
patmandin@989
   113
#endif /* _SDL_ATARIGL_H_ */
slouken@1895
   114
/* vi: set ts=4 sw=4 expandtab: */