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