Mercurial > sdl-ios-xcode
annotate docs/html/sdlconvertsurface.html @ 3100:7dc982143c06
Date: Sun, 22 Mar 2009 12:52:29 +0000
From: Luke Benstead
Subject: OpenGL 3.0 Context Creation
I've attached a patch which implements OpenGL 3.x context creation on
the latest SVN. I've added two options to SDL_GL_SetAttribute, these
are SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION.
These default to 2 and 1 respectively. If the major version is less
than 3 then the current context creation method is used, otherwise the
appropriate new context creation function is called (depending on the
platform).
Sample code:
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); //Without these 2 lines, SDL will create a GL 2.x context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_Surface* screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL | SDL_FULLSCREEN );
I've implemented context creation on both Win32 and X and run basic
tests on both. This patch doesn't provide access to all the options
allowed by the new context creation (e.g. shared contexts, forward
compatible contexts) but they can be added pretty easily.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 24 Mar 2009 10:43:53 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_ConvertSurface</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Video" | |
14 HREF="video.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_GetClipRect" | |
17 HREF="sdlgetcliprect.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_BlitSurface" | |
20 HREF="sdlblitsurface.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlgetcliprect.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlblitsurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLCONVERTSURFACE" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_ConvertSurface</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN2258" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_ConvertSurface -- Converts a surface to the same format as another surface.</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN2261" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN2262" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
100 >#include "SDL/SDL.h"</PRE |
0 | 101 ><P |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >SDL_Surface *<B | |
106 CLASS="FSFUNC" | |
107 >SDL_ConvertSurface</B | |
108 ></CODE | |
109 >(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);</CODE | |
110 ></P | |
111 ><P | |
112 ></P | |
113 ></DIV | |
114 ></DIV | |
115 ><DIV | |
116 CLASS="REFSECT1" | |
117 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
118 NAME="AEN2268" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 >Creates a new surface of the specified format, and then copies and maps | |
124 the given surface to it. If this function fails, it returns | |
125 <TT | |
126 CLASS="LITERAL" | |
127 >NULL</TT | |
128 >.</P | |
129 ><P | |
130 >The <TT | |
131 CLASS="PARAMETER" | |
132 ><I | |
133 >flags</I | |
134 ></TT | |
135 > parameter is passed to | |
136 <A | |
137 HREF="sdlcreatergbsurface.html" | |
138 ><TT | |
139 CLASS="FUNCTION" | |
140 >SDL_CreateRGBSurface</TT | |
141 ></A | |
142 > | |
143 and has those semantics.</P | |
144 ><P | |
145 >This function is used internally by | |
146 <A | |
147 HREF="sdldisplayformat.html" | |
148 ><TT | |
149 CLASS="FUNCTION" | |
150 >SDL_DisplayFormat</TT | |
151 ></A | |
152 >.</P | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
153 ><P |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
154 >This function can only be called after SDL_Init.</P |
0 | 155 ></DIV |
156 ><DIV | |
157 CLASS="REFSECT1" | |
158 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
159 NAME="AEN2280" |
0 | 160 ></A |
161 ><H2 | |
162 >Return Value</H2 | |
163 ><P | |
164 >Returns either a pointer to the new surface, or | |
165 <TT | |
166 CLASS="LITERAL" | |
167 >NULL</TT | |
168 > on error.</P | |
169 ></DIV | |
170 ><DIV | |
171 CLASS="REFSECT1" | |
172 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
173 NAME="AEN2284" |
0 | 174 ></A |
175 ><H2 | |
176 >See Also</H2 | |
177 ><P | |
178 ><A | |
179 HREF="sdlcreatergbsurface.html" | |
180 ><TT | |
181 CLASS="FUNCTION" | |
182 >SDL_CreateRGBSurface</TT | |
183 ></A | |
184 >, | |
185 <A | |
186 HREF="sdldisplayformat.html" | |
187 ><TT | |
188 CLASS="FUNCTION" | |
189 >SDL_DisplayFormat</TT | |
190 ></A | |
191 >, | |
192 <A | |
193 HREF="sdlpixelformat.html" | |
194 ><SPAN | |
195 CLASS="STRUCTNAME" | |
196 >SDL_PixelFormat</SPAN | |
197 ></A | |
198 >, | |
199 <A | |
200 HREF="sdlsurface.html" | |
201 ><SPAN | |
202 CLASS="STRUCTNAME" | |
203 >SDL_Surface</SPAN | |
204 ></A | |
205 ></P | |
206 ></DIV | |
207 ><DIV | |
208 CLASS="NAVFOOTER" | |
209 ><HR | |
210 ALIGN="LEFT" | |
211 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
212 SUMMARY="Footer navigation table" |
0 | 213 WIDTH="100%" |
214 BORDER="0" | |
215 CELLPADDING="0" | |
216 CELLSPACING="0" | |
217 ><TR | |
218 ><TD | |
219 WIDTH="33%" | |
220 ALIGN="left" | |
221 VALIGN="top" | |
222 ><A | |
223 HREF="sdlgetcliprect.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
224 ACCESSKEY="P" |
0 | 225 >Prev</A |
226 ></TD | |
227 ><TD | |
228 WIDTH="34%" | |
229 ALIGN="center" | |
230 VALIGN="top" | |
231 ><A | |
232 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
233 ACCESSKEY="H" |
0 | 234 >Home</A |
235 ></TD | |
236 ><TD | |
237 WIDTH="33%" | |
238 ALIGN="right" | |
239 VALIGN="top" | |
240 ><A | |
241 HREF="sdlblitsurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
242 ACCESSKEY="N" |
0 | 243 >Next</A |
244 ></TD | |
245 ></TR | |
246 ><TR | |
247 ><TD | |
248 WIDTH="33%" | |
249 ALIGN="left" | |
250 VALIGN="top" | |
251 >SDL_GetClipRect</TD | |
252 ><TD | |
253 WIDTH="34%" | |
254 ALIGN="center" | |
255 VALIGN="top" | |
256 ><A | |
257 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
258 ACCESSKEY="U" |
0 | 259 >Up</A |
260 ></TD | |
261 ><TD | |
262 WIDTH="33%" | |
263 ALIGN="right" | |
264 VALIGN="top" | |
265 >SDL_BlitSurface</TD | |
266 ></TR | |
267 ></TABLE | |
268 ></DIV | |
269 ></BODY | |
270 ></HTML | |
271 > |