src/video/ataricommon/SDL_atarigl_c.h
author Patrice Mandin <patmandin@gmail.com>
Sat, 04 Dec 2004 10:31:16 +0000
changeset 1004 d1cd674b2ecd
parent 995 22fc5f45bbb7
child 1005 2ab1cb02a44e
permissions -rw-r--r--
Be sure to compile without OpenGL enabled
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
patmandin@989
    28
#ifdef HAVE_OPENGL
patmandin@989
    29
#include <GL/osmesa.h>
patmandin@989
    30
#endif
patmandin@989
    31
patmandin@989
    32
#include "SDL_sysvideo.h"
patmandin@989
    33
#define _THIS   SDL_VideoDevice *this
patmandin@989
    34
patmandin@989
    35
struct SDL_PrivateGLData {
patmandin@991
    36
patmandin@991
    37
    int gl_active; 	/* to stop switching drivers while we have a valid context */
patmandin@991
    38
	
patmandin@991
    39
	int gl_oldmesa;	/* Old OpenGL support ? */
patmandin@991
    40
patmandin@991
    41
	int	gl_pixelsize;	/* for CopyShadow functions */
patmandin@991
    42
patmandin@991
    43
	Uint8 *gl_shadow;	/* Shadow buffer for old implementations */
patmandin@989
    44
patmandin@989
    45
	/* for unsupported OSMesa buffer formats */
patmandin@991
    46
	void (*ConvertSurface)(_THIS, SDL_Surface *surface);	
patmandin@989
    47
patmandin@991
    48
	/* to convert the shadow buffer to the screen format */
patmandin@991
    49
	void (*CopyShadow)(_THIS, SDL_Surface *surface);	
patmandin@991
    50
patmandin@1004
    51
#ifdef HAVE_OPENGL
patmandin@989
    52
	OSMesaContext	ctx;
patmandin@991
    53
patmandin@993
    54
	/* OpenGL functions */
patmandin@993
    55
	void (*glGetIntegerv)( GLenum pname, GLint *value );
patmandin@993
    56
	void (*glFinish)(void);
patmandin@995
    57
	void (*glFlush)(void);
patmandin@993
    58
patmandin@991
    59
	/* osmesa.ldg */
patmandin@991
    60
	OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
patmandin@991
    61
	void (*OSMesaDestroyContext)( OSMesaContext ctx );
patmandin@991
    62
	GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
patmandin@991
    63
	void (*OSMesaPixelStore)( GLint pname, GLint value );
patmandin@991
    64
	void * (*OSMesaGetProcAddress)( const char *funcName );
patmandin@991
    65
patmandin@991
    66
	/* mesa_gl.ldg, tiny_gl.ldg */
patmandin@991
    67
	void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
patmandin@991
    68
	void (*OSMesaDestroyLDG)(void);
patmandin@992
    69
patmandin@992
    70
	/* Info needed to compare existing context with new asked one */
patmandin@992
    71
	int width, height;
patmandin@992
    72
	GLenum format;
patmandin@992
    73
	GLint depth,stencil,accum;
patmandin@1004
    74
#endif
patmandin@989
    75
};
patmandin@989
    76
patmandin@991
    77
/* Variable names */
patmandin@989
    78
#define gl_active	(this->gl_data->gl_active)
patmandin@989
    79
#define gl_ctx		(this->gl_data->ctx)
patmandin@991
    80
#define gl_oldmesa	(this->gl_data->gl_oldmesa)
patmandin@991
    81
#define gl_pixelsize	(this->gl_data->gl_pixelsize)
patmandin@991
    82
#define gl_shadow	(this->gl_data->gl_shadow)
patmandin@989
    83
#define gl_convert	(this->gl_data->ConvertSurface)
patmandin@991
    84
#define gl_copyshadow	(this->gl_data->CopyShadow)
patmandin@992
    85
#define gl_curformat	(this->gl_data->format)
patmandin@992
    86
#define gl_curdepth		(this->gl_data->depth)
patmandin@992
    87
#define gl_curstencil	(this->gl_data->stencil)
patmandin@992
    88
#define gl_curaccum		(this->gl_data->accum)
patmandin@992
    89
#define gl_curwidth	(this->gl_data->width)
patmandin@992
    90
#define gl_curheight		(this->gl_data->height)
patmandin@989
    91
patmandin@989
    92
/* OpenGL functions */
patmandin@989
    93
extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current);
patmandin@992
    94
extern void SDL_AtariGL_Quit(_THIS, SDL_bool unload);
patmandin@991
    95
extern void SDL_AtariGL_InitPointers(_THIS);
patmandin@989
    96
patmandin@989
    97
extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
patmandin@989
    98
extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
patmandin@989
    99
extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
patmandin@989
   100
extern int SDL_AtariGL_MakeCurrent(_THIS);
patmandin@989
   101
extern void SDL_AtariGL_SwapBuffers(_THIS);
patmandin@989
   102
patmandin@989
   103
#endif /* _SDL_ATARIGL_H_ */