Mercurial > sdl-ios-xcode
annotate docs/html/sdlcolor.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_Color</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_Rect" | |
17 HREF="sdlrect.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_Palette" | |
20 HREF="sdlpalette.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="sdlrect.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="sdlpalette.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="SDLCOLOR" | |
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_Color</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="AEN3082" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_Color -- Format independent color description</DIV | |
84 ><DIV | |
85 CLASS="REFSECT1" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN3085" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 r; | |
95 Uint8 g; | |
96 Uint8 b; | |
97 Uint8 unused; | |
98 } SDL_Color;</PRE | |
99 ></DIV | |
100 ><DIV | |
101 CLASS="REFSECT1" | |
102 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
103 NAME="AEN3088" |
0 | 104 ></A |
105 ><H2 | |
106 >Structure Data</H2 | |
107 ><DIV | |
108 CLASS="INFORMALTABLE" | |
109 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
110 NAME="AEN3090" |
0 | 111 ></A |
112 ><P | |
113 ></P | |
114 ><TABLE | |
115 BORDER="0" | |
116 CLASS="CALSTABLE" | |
117 ><TBODY | |
118 ><TR | |
119 ><TD | |
120 ALIGN="LEFT" | |
121 VALIGN="TOP" | |
122 ><TT | |
123 CLASS="STRUCTFIELD" | |
124 ><I | |
125 >r</I | |
126 ></TT | |
127 ></TD | |
128 ><TD | |
129 ALIGN="LEFT" | |
130 VALIGN="TOP" | |
131 >Red intensity</TD | |
132 ></TR | |
133 ><TR | |
134 ><TD | |
135 ALIGN="LEFT" | |
136 VALIGN="TOP" | |
137 ><TT | |
138 CLASS="STRUCTFIELD" | |
139 ><I | |
140 >g</I | |
141 ></TT | |
142 ></TD | |
143 ><TD | |
144 ALIGN="LEFT" | |
145 VALIGN="TOP" | |
146 >Green intensity</TD | |
147 ></TR | |
148 ><TR | |
149 ><TD | |
150 ALIGN="LEFT" | |
151 VALIGN="TOP" | |
152 ><TT | |
153 CLASS="STRUCTFIELD" | |
154 ><I | |
155 >b</I | |
156 ></TT | |
157 ></TD | |
158 ><TD | |
159 ALIGN="LEFT" | |
160 VALIGN="TOP" | |
161 >Blue intensity</TD | |
162 ></TR | |
163 ><TR | |
164 ><TD | |
165 ALIGN="LEFT" | |
166 VALIGN="TOP" | |
167 ><TT | |
168 CLASS="STRUCTFIELD" | |
169 ><I | |
170 >unused</I | |
171 ></TT | |
172 ></TD | |
173 ><TD | |
174 ALIGN="LEFT" | |
175 VALIGN="TOP" | |
176 >Unused</TD | |
177 ></TR | |
178 ></TBODY | |
179 ></TABLE | |
180 ><P | |
181 ></P | |
182 ></DIV | |
183 ></DIV | |
184 ><DIV | |
185 CLASS="REFSECT1" | |
186 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
187 NAME="AEN3109" |
0 | 188 ></A |
189 ><H2 | |
190 >Description</H2 | |
191 ><P | |
192 ><SPAN | |
193 CLASS="STRUCTNAME" | |
194 >SDL_Color</SPAN | |
195 > describes a color in a format independent way. You can convert a <SPAN | |
196 CLASS="STRUCTNAME" | |
197 >SDL_Color</SPAN | |
198 > to a pixel value for a certain pixel format using <A | |
199 HREF="sdlmaprgb.html" | |
200 ><TT | |
201 CLASS="FUNCTION" | |
202 >SDL_MapRGB</TT | |
203 ></A | |
204 >.</P | |
205 ></DIV | |
206 ><DIV | |
207 CLASS="REFSECT1" | |
208 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
209 NAME="AEN3116" |
0 | 210 ></A |
211 ><H2 | |
212 >See Also</H2 | |
213 ><P | |
214 ><A | |
215 HREF="sdlpixelformat.html" | |
216 ><SPAN | |
217 CLASS="STRUCTNAME" | |
218 >SDL_PixelFormat</SPAN | |
219 ></A | |
220 >, | |
221 <A | |
222 HREF="sdlsetcolors.html" | |
223 ><TT | |
224 CLASS="FUNCTION" | |
225 >SDL_SetColors</TT | |
226 ></A | |
227 >, | |
228 <A | |
229 HREF="sdlpalette.html" | |
230 ><TT | |
231 CLASS="FUNCTION" | |
232 >SDL_Palette</TT | |
233 ></A | |
234 ></P | |
235 ></DIV | |
236 ><DIV | |
237 CLASS="NAVFOOTER" | |
238 ><HR | |
239 ALIGN="LEFT" | |
240 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
241 SUMMARY="Footer navigation table" |
0 | 242 WIDTH="100%" |
243 BORDER="0" | |
244 CELLPADDING="0" | |
245 CELLSPACING="0" | |
246 ><TR | |
247 ><TD | |
248 WIDTH="33%" | |
249 ALIGN="left" | |
250 VALIGN="top" | |
251 ><A | |
252 HREF="sdlrect.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
253 ACCESSKEY="P" |
0 | 254 >Prev</A |
255 ></TD | |
256 ><TD | |
257 WIDTH="34%" | |
258 ALIGN="center" | |
259 VALIGN="top" | |
260 ><A | |
261 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
262 ACCESSKEY="H" |
0 | 263 >Home</A |
264 ></TD | |
265 ><TD | |
266 WIDTH="33%" | |
267 ALIGN="right" | |
268 VALIGN="top" | |
269 ><A | |
270 HREF="sdlpalette.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
271 ACCESSKEY="N" |
0 | 272 >Next</A |
273 ></TD | |
274 ></TR | |
275 ><TR | |
276 ><TD | |
277 WIDTH="33%" | |
278 ALIGN="left" | |
279 VALIGN="top" | |
280 >SDL_Rect</TD | |
281 ><TD | |
282 WIDTH="34%" | |
283 ALIGN="center" | |
284 VALIGN="top" | |
285 ><A | |
286 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
287 ACCESSKEY="U" |
0 | 288 >Up</A |
289 ></TD | |
290 ><TD | |
291 WIDTH="33%" | |
292 ALIGN="right" | |
293 VALIGN="top" | |
294 >SDL_Palette</TD | |
295 ></TR | |
296 ></TABLE | |
297 ></DIV | |
298 ></BODY | |
299 ></HTML | |
300 > |