Mercurial > sdl-ios-xcode
annotate docs/html/sdlflip.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_Flip</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_UpdateRects" | |
17 HREF="sdlupdaterects.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_SetColors" | |
20 HREF="sdlsetcolors.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="sdlupdaterects.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="sdlsetcolors.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="SDLFLIP" | |
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_Flip</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="AEN1426" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_Flip -- Swaps screen buffers</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="AEN1429" |
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="AEN1430" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >int <B | |
106 CLASS="FSFUNC" | |
107 >SDL_Flip</B | |
108 ></CODE | |
109 >(SDL_Surface *screen);</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="AEN1436" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 >On hardware that supports double-buffering, this function sets up a flip | |
124 and returns. The hardware will wait for vertical retrace, and then swap | |
125 video buffers before the next video surface blit or lock will return. | |
126 On hardware that doesn't support double-buffering, this is equivalent | |
127 to calling <A | |
128 HREF="sdlupdaterect.html" | |
129 >SDL_UpdateRect</A | |
130 ><TT | |
131 CLASS="PARAMETER" | |
132 ><I | |
133 >(screen, 0, 0, 0, 0)</I | |
134 ></TT | |
135 ></P | |
136 ><P | |
137 >The <TT | |
138 CLASS="LITERAL" | |
139 >SDL_DOUBLEBUF</TT | |
140 > flag must have been passed to | |
141 <A | |
142 HREF="sdlsetvideomode.html" | |
143 >SDL_SetVideoMode</A | |
144 >, | |
145 when | |
146 setting the video mode for this function to perform hardware flipping.</P | |
147 ></DIV | |
148 ><DIV | |
149 CLASS="REFSECT1" | |
150 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
151 NAME="AEN1444" |
0 | 152 ></A |
153 ><H2 | |
154 >Return Value</H2 | |
155 ><P | |
156 >This function returns <SPAN | |
157 CLASS="RETURNVALUE" | |
158 >0</SPAN | |
159 > if successful, or | |
160 <SPAN | |
161 CLASS="RETURNVALUE" | |
162 >-1</SPAN | |
163 > if there was an error.</P | |
164 ></DIV | |
165 ><DIV | |
166 CLASS="REFSECT1" | |
167 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
168 NAME="AEN1449" |
0 | 169 ></A |
170 ><H2 | |
171 >See Also</H2 | |
172 ><P | |
173 ><A | |
174 HREF="sdlsetvideomode.html" | |
175 ><TT | |
176 CLASS="FUNCTION" | |
177 >SDL_SetVideoMode</TT | |
178 ></A | |
179 >, | |
180 <A | |
181 HREF="sdlupdaterect.html" | |
182 ><TT | |
183 CLASS="FUNCTION" | |
184 >SDL_UpdateRect</TT | |
185 ></A | |
186 >, | |
187 <A | |
188 HREF="sdlsurface.html" | |
189 ><SPAN | |
190 CLASS="STRUCTNAME" | |
191 >SDL_Surface</SPAN | |
192 ></A | |
193 ></P | |
194 ></DIV | |
195 ><DIV | |
196 CLASS="NAVFOOTER" | |
197 ><HR | |
198 ALIGN="LEFT" | |
199 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
200 SUMMARY="Footer navigation table" |
0 | 201 WIDTH="100%" |
202 BORDER="0" | |
203 CELLPADDING="0" | |
204 CELLSPACING="0" | |
205 ><TR | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="left" | |
209 VALIGN="top" | |
210 ><A | |
211 HREF="sdlupdaterects.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
212 ACCESSKEY="P" |
0 | 213 >Prev</A |
214 ></TD | |
215 ><TD | |
216 WIDTH="34%" | |
217 ALIGN="center" | |
218 VALIGN="top" | |
219 ><A | |
220 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
221 ACCESSKEY="H" |
0 | 222 >Home</A |
223 ></TD | |
224 ><TD | |
225 WIDTH="33%" | |
226 ALIGN="right" | |
227 VALIGN="top" | |
228 ><A | |
229 HREF="sdlsetcolors.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
230 ACCESSKEY="N" |
0 | 231 >Next</A |
232 ></TD | |
233 ></TR | |
234 ><TR | |
235 ><TD | |
236 WIDTH="33%" | |
237 ALIGN="left" | |
238 VALIGN="top" | |
239 >SDL_UpdateRects</TD | |
240 ><TD | |
241 WIDTH="34%" | |
242 ALIGN="center" | |
243 VALIGN="top" | |
244 ><A | |
245 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
246 ACCESSKEY="U" |
0 | 247 >Up</A |
248 ></TD | |
249 ><TD | |
250 WIDTH="33%" | |
251 ALIGN="right" | |
252 VALIGN="top" | |
253 >SDL_SetColors</TD | |
254 ></TR | |
255 ></TABLE | |
256 ></DIV | |
257 ></BODY | |
258 ></HTML | |
259 > |