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