src/video/ataricommon/SDL_atarigl_c.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 28 May 2006 13:04:16 +0000
branchSDL-1.3
changeset 1662 782fd950bd46
parent 1402 d910939febfa
child 1668 4da1ee79c9af
permissions -rw-r--r--
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.

WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.

The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce

The headers are being converted to automatically generate doxygen documentation.
patmandin@989
     1
/*
patmandin@989
     2
    SDL - Simple DirectMedia Layer
patmandin@989
     3
    Copyright (C) 1997-2004 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
slouken@1361
    35
/* Hidden "this" pointer for the video functions */
patmandin@989
    36
#define _THIS   SDL_VideoDevice *this
patmandin@989
    37
slouken@1662
    38
struct SDL_PrivateGLData
slouken@1662
    39
{
patmandin@991
    40
slouken@1662
    41
    int gl_active;              /* to stop switching drivers while we have a valid context */
patmandin@991
    42
slouken@1662
    43
    int gl_oldmesa;             /* Old OpenGL support ? */
slouken@1662
    44
slouken@1662
    45
    int gl_pixelsize;           /* for CopyShadow functions */
patmandin@991
    46
slouken@1662
    47
    SDL_bool gl_upsidedown;     /* Some implementations draw upside down */
patmandin@1005
    48
slouken@1662
    49
    Uint8 *gl_shadow;           /* Shadow buffer for old implementations */
patmandin@989
    50
slouken@1662
    51
    /* for unsupported OSMesa buffer formats */
slouken@1662
    52
    void (*ConvertSurface) (_THIS, SDL_Surface * surface);
patmandin@991
    53
slouken@1662
    54
    /* to convert the shadow buffer to the screen format */
slouken@1662
    55
    void (*CopyShadow) (_THIS, SDL_Surface * surface);
patmandin@991
    56
slouken@1361
    57
#if SDL_VIDEO_OPENGL
slouken@1662
    58
    OSMesaContext ctx;
patmandin@989
    59
slouken@1662
    60
    /* OpenGL functions */
slouken@1662
    61
    void (*glGetIntegerv) (GLenum pname, GLint * value);
slouken@1662
    62
    void (*glFinish) (void);
slouken@1662
    63
    void (*glFlush) (void);
patmandin@993
    64
slouken@1662
    65
    /* osmesa.ldg */
slouken@1662
    66
      OSMesaContext (*OSMesaCreateContextExt) (GLenum format, GLint depthBits,
slouken@1662
    67
                                               GLint stencilBits,
slouken@1662
    68
                                               GLint accumBits,
slouken@1662
    69
                                               OSMesaContext sharelist);
slouken@1662
    70
    void (*OSMesaDestroyContext) (OSMesaContext ctx);
slouken@1662
    71
      GLboolean (*OSMesaMakeCurrent) (OSMesaContext ctx, void *buffer,
slouken@1662
    72
                                      GLenum type, GLsizei width,
slouken@1662
    73
                                      GLsizei height);
slouken@1662
    74
    void (*OSMesaPixelStore) (GLint pname, GLint value);
slouken@1662
    75
    void *(*OSMesaGetProcAddress) (const char *funcName);
patmandin@991
    76
slouken@1662
    77
    /* mesa_gl.ldg, tiny_gl.ldg */
slouken@1662
    78
    void *(*OSMesaCreateLDG) (long format, long type, long width,
slouken@1662
    79
                              long height);
slouken@1662
    80
    void (*OSMesaDestroyLDG) (void);
patmandin@992
    81
slouken@1662
    82
    /* Info needed to compare existing context with new asked one */
slouken@1662
    83
    int width, height;
slouken@1662
    84
    GLenum format;
slouken@1662
    85
    GLint depth, stencil, accum;
patmandin@1004
    86
#endif
patmandin@989
    87
};
patmandin@989
    88
patmandin@991
    89
/* Variable names */
patmandin@1005
    90
#define gl_active		(this->gl_data->gl_active)
patmandin@1005
    91
#define gl_ctx			(this->gl_data->ctx)
patmandin@1005
    92
#define gl_oldmesa		(this->gl_data->gl_oldmesa)
patmandin@991
    93
#define gl_pixelsize	(this->gl_data->gl_pixelsize)
patmandin@1005
    94
#define gl_upsidedown	(this->gl_data->gl_upsidedown)
patmandin@1005
    95
#define gl_shadow		(this->gl_data->gl_shadow)
patmandin@1005
    96
#define gl_convert		(this->gl_data->ConvertSurface)
patmandin@991
    97
#define gl_copyshadow	(this->gl_data->CopyShadow)
patmandin@992
    98
#define gl_curformat	(this->gl_data->format)
patmandin@992
    99
#define gl_curdepth		(this->gl_data->depth)
patmandin@992
   100
#define gl_curstencil	(this->gl_data->stencil)
patmandin@992
   101
#define gl_curaccum		(this->gl_data->accum)
patmandin@1005
   102
#define gl_curwidth		(this->gl_data->width)
patmandin@1005
   103
#define gl_curheight	(this->gl_data->height)
patmandin@989
   104
patmandin@989
   105
/* OpenGL functions */
slouken@1662
   106
extern int SDL_AtariGL_Init (_THIS, SDL_Surface * current);
slouken@1662
   107
extern void SDL_AtariGL_Quit (_THIS, SDL_bool unload);
slouken@1662
   108
extern void SDL_AtariGL_InitPointers (_THIS);
patmandin@989
   109
slouken@1662
   110
extern int SDL_AtariGL_LoadLibrary (_THIS, const char *path);
slouken@1662
   111
extern void *SDL_AtariGL_GetProcAddress (_THIS, const char *proc);
slouken@1662
   112
extern int SDL_AtariGL_GetAttribute (_THIS, SDL_GLattr attrib, int *value);
slouken@1662
   113
extern int SDL_AtariGL_MakeCurrent (_THIS);
slouken@1662
   114
extern void SDL_AtariGL_SwapBuffers (_THIS);
patmandin@989
   115
patmandin@989
   116
#endif /* _SDL_ATARIGL_H_ */
slouken@1662
   117
/* vi: set ts=4 sw=4 expandtab: */