Mercurial > sdl-ios-xcode
comparison src/video/cybergfx/SDL_cgxgl.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
30 AmigaMesaContext glcont = NULL; | 30 AmigaMesaContext glcont = NULL; |
31 #endif | 31 #endif |
32 | 32 |
33 /* Init OpenGL */ | 33 /* Init OpenGL */ |
34 int | 34 int |
35 CGX_GL_Init (_THIS) | 35 CGX_GL_Init(_THIS) |
36 { | 36 { |
37 #if SDL_VIDEO_OPENGL | 37 #if SDL_VIDEO_OPENGL |
38 int i = 0; | 38 int i = 0; |
39 struct TagItem attributes[14]; /* 14 should be more than enough :) */ | 39 struct TagItem attributes[14]; /* 14 should be more than enough :) */ |
40 struct Window *win = (struct Window *) SDL_Window; | 40 struct Window *win = (struct Window *) SDL_Window; |
87 attributes[i++].ti_Data = GL_TRUE; | 87 attributes[i++].ti_Data = GL_TRUE; |
88 } | 88 } |
89 // done... | 89 // done... |
90 attributes[i].ti_Tag = TAG_DONE; | 90 attributes[i].ti_Tag = TAG_DONE; |
91 | 91 |
92 glcont = AmigaMesaCreateContext (attributes); | 92 glcont = AmigaMesaCreateContext(attributes); |
93 if (glcont == NULL) { | 93 if (glcont == NULL) { |
94 SDL_SetError ("Couldn't create OpenGL context"); | 94 SDL_SetError("Couldn't create OpenGL context"); |
95 return (-1); | 95 return (-1); |
96 } | 96 } |
97 this->gl_data->gl_active = 1; | 97 this->gl_data->gl_active = 1; |
98 this->gl_config.driver_loaded = 1; | 98 this->gl_config.driver_loaded = 1; |
99 | 99 |
100 return (0); | 100 return (0); |
101 #else | 101 #else |
102 SDL_SetError ("OpenGL support not configured"); | 102 SDL_SetError("OpenGL support not configured"); |
103 return (-1); | 103 return (-1); |
104 #endif | 104 #endif |
105 } | 105 } |
106 | 106 |
107 /* Quit OpenGL */ | 107 /* Quit OpenGL */ |
108 void | 108 void |
109 CGX_GL_Quit (_THIS) | 109 CGX_GL_Quit(_THIS) |
110 { | 110 { |
111 #if SDL_VIDEO_OPENGL | 111 #if SDL_VIDEO_OPENGL |
112 if (glcont != NULL) { | 112 if (glcont != NULL) { |
113 AmigaMesaDestroyContext (glcont); | 113 AmigaMesaDestroyContext(glcont); |
114 glcont = NULL; | 114 glcont = NULL; |
115 this->gl_data->gl_active = 0; | 115 this->gl_data->gl_active = 0; |
116 this->gl_config.driver_loaded = 0; | 116 this->gl_config.driver_loaded = 0; |
117 } | 117 } |
118 #endif | 118 #endif |
119 } | 119 } |
120 | 120 |
121 /* Attach context to another window */ | 121 /* Attach context to another window */ |
122 int | 122 int |
123 CGX_GL_Update (_THIS) | 123 CGX_GL_Update(_THIS) |
124 { | 124 { |
125 #if SDL_VIDEO_OPENGL | 125 #if SDL_VIDEO_OPENGL |
126 struct TagItem tags[2]; | 126 struct TagItem tags[2]; |
127 struct Window *win = (struct Window *) SDL_Window; | 127 struct Window *win = (struct Window *) SDL_Window; |
128 if (glcont == NULL) { | 128 if (glcont == NULL) { |
129 return -1; //should never happen | 129 return -1; //should never happen |
130 } | 130 } |
131 tags[0].ti_Tag = AMA_Window; | 131 tags[0].ti_Tag = AMA_Window; |
132 tags[0].ti_Data = (unsigned long) win; | 132 tags[0].ti_Data = (unsigned long) win; |
133 tags[1].ti_Tag = TAG_DONE; | 133 tags[1].ti_Tag = TAG_DONE; |
134 AmigaMesaSetRast (glcont, tags); | 134 AmigaMesaSetRast(glcont, tags); |
135 | 135 |
136 return 0; | 136 return 0; |
137 #else | 137 #else |
138 SDL_SetError ("OpenGL support not configured"); | 138 SDL_SetError("OpenGL support not configured"); |
139 return -1; | 139 return -1; |
140 #endif | 140 #endif |
141 } | 141 } |
142 | 142 |
143 #if SDL_VIDEO_OPENGL | 143 #if SDL_VIDEO_OPENGL |
144 | 144 |
145 /* Make the current context active */ | 145 /* Make the current context active */ |
146 int | 146 int |
147 CGX_GL_MakeCurrent (_THIS) | 147 CGX_GL_MakeCurrent(_THIS) |
148 { | 148 { |
149 if (glcont == NULL) | 149 if (glcont == NULL) |
150 return -1; | 150 return -1; |
151 | 151 |
152 AmigaMesaMakeCurrent (glcont, glcont->buffer); | 152 AmigaMesaMakeCurrent(glcont, glcont->buffer); |
153 return 0; | 153 return 0; |
154 } | 154 } |
155 | 155 |
156 void | 156 void |
157 CGX_GL_SwapBuffers (_THIS) | 157 CGX_GL_SwapBuffers(_THIS) |
158 { | 158 { |
159 AmigaMesaSwapBuffers (glcont); | 159 AmigaMesaSwapBuffers(glcont); |
160 } | 160 } |
161 | 161 |
162 int | 162 int |
163 CGX_GL_GetAttribute (_THIS, SDL_GLattr attrib, int *value) | 163 CGX_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value) |
164 { | 164 { |
165 GLenum mesa_attrib; | 165 GLenum mesa_attrib; |
166 | 166 |
167 switch (attrib) { | 167 switch (attrib) { |
168 case SDL_GL_RED_SIZE: | 168 case SDL_GL_RED_SIZE: |
200 break; | 200 break; |
201 default: | 201 default: |
202 return -1; | 202 return -1; |
203 } | 203 } |
204 | 204 |
205 AmigaMesaGetConfig (glcont->visual, mesa_attrib, value); | 205 AmigaMesaGetConfig(glcont->visual, mesa_attrib, value); |
206 return 0; | 206 return 0; |
207 } | 207 } |
208 | 208 |
209 void * | 209 void * |
210 CGX_GL_GetProcAddress (_THIS, const char *proc) | 210 CGX_GL_GetProcAddress(_THIS, const char *proc) |
211 { | 211 { |
212 void *func = NULL; | 212 void *func = NULL; |
213 func = AmiGetGLProc (proc); | 213 func = AmiGetGLProc(proc); |
214 return func; | 214 return func; |
215 } | 215 } |
216 | 216 |
217 int | 217 int |
218 CGX_GL_LoadLibrary (_THIS, const char *path) | 218 CGX_GL_LoadLibrary(_THIS, const char *path) |
219 { | 219 { |
220 /* Library is always open */ | 220 /* Library is always open */ |
221 this->gl_config.driver_loaded = 1; | 221 this->gl_config.driver_loaded = 1; |
222 | 222 |
223 return 0; | 223 return 0; |