src/video/ataricommon/SDL_atarigl_c.h
author Patrice Mandin <patmandin@gmail.com>
Fri, 26 Nov 2004 16:16:50 +0000
changeset 991 12b13601a544
parent 989 475166d13b44
child 992 0324ce32b2d9
permissions -rw-r--r--
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
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@991
    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@991
    51
	OSMesaContext	ctx;
patmandin@989
    52
patmandin@991
    53
	/* osmesa.ldg */
patmandin@991
    54
	OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
patmandin@991
    55
	void (*OSMesaDestroyContext)( OSMesaContext ctx );
patmandin@991
    56
	GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
patmandin@991
    57
	void (*OSMesaPixelStore)( GLint pname, GLint value );
patmandin@991
    58
	void * (*OSMesaGetProcAddress)( const char *funcName );
patmandin@991
    59
	void (*glGetIntegerv)( GLenum pname, GLint *value );
patmandin@991
    60
patmandin@991
    61
	/* mesa_gl.ldg, tiny_gl.ldg */
patmandin@991
    62
	void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
patmandin@991
    63
	void (*OSMesaDestroyLDG)(void);
patmandin@989
    64
};
patmandin@989
    65
patmandin@991
    66
/* Variable names */
patmandin@989
    67
#define gl_active	(this->gl_data->gl_active)
patmandin@989
    68
#define gl_ctx		(this->gl_data->ctx)
patmandin@991
    69
#define gl_oldmesa	(this->gl_data->gl_oldmesa)
patmandin@991
    70
#define gl_pixelsize	(this->gl_data->gl_pixelsize)
patmandin@991
    71
#define gl_shadow	(this->gl_data->gl_shadow)
patmandin@989
    72
#define gl_convert	(this->gl_data->ConvertSurface)
patmandin@991
    73
#define gl_copyshadow	(this->gl_data->CopyShadow)
patmandin@989
    74
patmandin@989
    75
/* OpenGL functions */
patmandin@989
    76
extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current);
patmandin@989
    77
extern void SDL_AtariGL_Quit(_THIS);
patmandin@991
    78
extern void SDL_AtariGL_InitPointers(_THIS);
patmandin@989
    79
patmandin@989
    80
extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
patmandin@989
    81
extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
patmandin@989
    82
extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
patmandin@989
    83
extern int SDL_AtariGL_MakeCurrent(_THIS);
patmandin@989
    84
extern void SDL_AtariGL_SwapBuffers(_THIS);
patmandin@989
    85
patmandin@989
    86
#endif /* _SDL_ATARIGL_H_ */