Mercurial > sdl-ios-xcode
annotate src/video/ataricommon/SDL_atarigl_c.h @ 1001:70bfe658442c
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 30 Nov 2004 19:02:42 +0000 |
parents | 22fc5f45bbb7 |
children | d1cd674b2ecd |
rev | line source |
---|---|
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
1 /* |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
4 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
9 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
13 Library General Public License for more details. |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
14 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
18 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
19 Sam Lantinga |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
20 slouken@libsdl.org |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
21 */ |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
22 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
23 /* Atari OSMesa.ldg implementation of SDL OpenGL support */ |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
24 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
25 #ifndef _SDL_ATARIGL_H_ |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
26 #define _SDL_ATARIGL_H_ |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
27 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
28 #ifdef HAVE_OPENGL |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
29 #include <GL/osmesa.h> |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
30 #endif |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
31 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
32 #include "SDL_sysvideo.h" |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
33 #define _THIS SDL_VideoDevice *this |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
34 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
35 struct SDL_PrivateGLData { |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
36 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
37 int gl_active; /* to stop switching drivers while we have a valid context */ |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
38 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
39 int gl_oldmesa; /* Old OpenGL support ? */ |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
40 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
41 int gl_pixelsize; /* for CopyShadow functions */ |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
42 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
43 Uint8 *gl_shadow; /* Shadow buffer for old implementations */ |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
44 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
45 /* for unsupported OSMesa buffer formats */ |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
46 void (*ConvertSurface)(_THIS, SDL_Surface *surface); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
47 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
48 /* to convert the shadow buffer to the screen format */ |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
49 void (*CopyShadow)(_THIS, SDL_Surface *surface); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
50 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
51 OSMesaContext ctx; |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
52 |
993
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
53 /* OpenGL functions */ |
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
54 void (*glGetIntegerv)( GLenum pname, GLint *value ); |
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
55 void (*glFinish)(void); |
995
22fc5f45bbb7
TinyGL does not have glFinish, only glFlush
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
56 void (*glFlush)(void); |
993
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
57 |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
58 /* osmesa.ldg */ |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
59 OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
60 void (*OSMesaDestroyContext)( OSMesaContext ctx ); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
61 GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height ); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
62 void (*OSMesaPixelStore)( GLint pname, GLint value ); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
63 void * (*OSMesaGetProcAddress)( const char *funcName ); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
64 |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
65 /* mesa_gl.ldg, tiny_gl.ldg */ |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
66 void *(*OSMesaCreateLDG)( long format, long type, long width, long height ); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
67 void (*OSMesaDestroyLDG)(void); |
992
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
68 |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
69 /* Info needed to compare existing context with new asked one */ |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
70 int width, height; |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
71 GLenum format; |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
72 GLint depth,stencil,accum; |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
73 }; |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
74 |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
75 /* Variable names */ |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
76 #define gl_active (this->gl_data->gl_active) |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
77 #define gl_ctx (this->gl_data->ctx) |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
78 #define gl_oldmesa (this->gl_data->gl_oldmesa) |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
79 #define gl_pixelsize (this->gl_data->gl_pixelsize) |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
80 #define gl_shadow (this->gl_data->gl_shadow) |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
81 #define gl_convert (this->gl_data->ConvertSurface) |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
82 #define gl_copyshadow (this->gl_data->CopyShadow) |
992
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
83 #define gl_curformat (this->gl_data->format) |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
84 #define gl_curdepth (this->gl_data->depth) |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
85 #define gl_curstencil (this->gl_data->stencil) |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
86 #define gl_curaccum (this->gl_data->accum) |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
87 #define gl_curwidth (this->gl_data->width) |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
88 #define gl_curheight (this->gl_data->height) |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
89 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
90 /* OpenGL functions */ |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
91 extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current); |
992
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
92 extern void SDL_AtariGL_Quit(_THIS, SDL_bool unload); |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
93 extern void SDL_AtariGL_InitPointers(_THIS); |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
94 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
95 extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path); |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
96 extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc); |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
97 extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int* value); |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
98 extern int SDL_AtariGL_MakeCurrent(_THIS); |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
99 extern void SDL_AtariGL_SwapBuffers(_THIS); |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
100 |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
101 #endif /* _SDL_ATARIGL_H_ */ |