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