src/video/ataricommon/SDL_atarigl_c.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 Feb 2006 10:11:48 +0000
changeset 1361 19418e4422cb
parent 1005 2ab1cb02a44e
child 1402 d910939febfa
permissions -rw-r--r--
New configure-based build system. Still work in progress, but much improved
     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 
    23 /* Atari OSMesa.ldg implementation of SDL OpenGL support */
    24 
    25 #ifndef _SDL_ATARIGL_H_
    26 #define _SDL_ATARIGL_H_
    27 
    28 #if SDL_VIDEO_OPENGL
    29 #include <GL/osmesa.h>
    30 #endif
    31 
    32 #include "../SDL_sysvideo.h"
    33 
    34 /* Hidden "this" pointer for the video functions */
    35 #define _THIS   SDL_VideoDevice *this
    36 
    37 struct SDL_PrivateGLData {
    38 
    39     int gl_active; 	/* to stop switching drivers while we have a valid context */
    40 	
    41 	int gl_oldmesa;	/* Old OpenGL support ? */
    42 
    43 	int	gl_pixelsize;	/* for CopyShadow functions */
    44 
    45 	SDL_bool gl_upsidedown; /* Some implementations draw upside down */
    46 
    47 	Uint8 *gl_shadow;	/* Shadow buffer for old implementations */
    48 
    49 	/* for unsupported OSMesa buffer formats */
    50 	void (*ConvertSurface)(_THIS, SDL_Surface *surface);	
    51 
    52 	/* to convert the shadow buffer to the screen format */
    53 	void (*CopyShadow)(_THIS, SDL_Surface *surface);	
    54 
    55 #if SDL_VIDEO_OPENGL
    56 	OSMesaContext	ctx;
    57 
    58 	/* OpenGL functions */
    59 	void (*glGetIntegerv)( GLenum pname, GLint *value );
    60 	void (*glFinish)(void);
    61 	void (*glFlush)(void);
    62 
    63 	/* osmesa.ldg */
    64 	OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
    65 	void (*OSMesaDestroyContext)( OSMesaContext ctx );
    66 	GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
    67 	void (*OSMesaPixelStore)( GLint pname, GLint value );
    68 	void * (*OSMesaGetProcAddress)( const char *funcName );
    69 
    70 	/* mesa_gl.ldg, tiny_gl.ldg */
    71 	void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
    72 	void (*OSMesaDestroyLDG)(void);
    73 
    74 	/* Info needed to compare existing context with new asked one */
    75 	int width, height;
    76 	GLenum format;
    77 	GLint depth,stencil,accum;
    78 #endif
    79 };
    80 
    81 /* Variable names */
    82 #define gl_active		(this->gl_data->gl_active)
    83 #define gl_ctx			(this->gl_data->ctx)
    84 #define gl_oldmesa		(this->gl_data->gl_oldmesa)
    85 #define gl_pixelsize	(this->gl_data->gl_pixelsize)
    86 #define gl_upsidedown	(this->gl_data->gl_upsidedown)
    87 #define gl_shadow		(this->gl_data->gl_shadow)
    88 #define gl_convert		(this->gl_data->ConvertSurface)
    89 #define gl_copyshadow	(this->gl_data->CopyShadow)
    90 #define gl_curformat	(this->gl_data->format)
    91 #define gl_curdepth		(this->gl_data->depth)
    92 #define gl_curstencil	(this->gl_data->stencil)
    93 #define gl_curaccum		(this->gl_data->accum)
    94 #define gl_curwidth		(this->gl_data->width)
    95 #define gl_curheight	(this->gl_data->height)
    96 
    97 /* OpenGL functions */
    98 extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current);
    99 extern void SDL_AtariGL_Quit(_THIS, SDL_bool unload);
   100 extern void SDL_AtariGL_InitPointers(_THIS);
   101 
   102 extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
   103 extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
   104 extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
   105 extern int SDL_AtariGL_MakeCurrent(_THIS);
   106 extern void SDL_AtariGL_SwapBuffers(_THIS);
   107 
   108 #endif /* _SDL_ATARIGL_H_ */