0
|
1 <HTML
|
|
2 ><HEAD
|
|
3 ><TITLE
|
|
4 >SDL_GL_SetAttribute</TITLE
|
|
5 ><META
|
|
6 NAME="GENERATOR"
|
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.61
|
|
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_GL_GetAttribute"
|
|
17 HREF="sdlglgetattribute.html"><LINK
|
|
18 REL="NEXT"
|
|
19 TITLE="SDL_GL_SwapBuffers"
|
|
20 HREF="sdlglswapbuffers.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
|
|
31 WIDTH="100%"
|
|
32 BORDER="0"
|
|
33 CELLPADDING="0"
|
|
34 CELLSPACING="0"
|
|
35 ><TR
|
|
36 ><TH
|
|
37 COLSPAN="3"
|
|
38 ALIGN="center"
|
|
39 >SDL Library Documentation</TH
|
|
40 ></TR
|
|
41 ><TR
|
|
42 ><TD
|
|
43 WIDTH="10%"
|
|
44 ALIGN="left"
|
|
45 VALIGN="bottom"
|
|
46 ><A
|
|
47 HREF="sdlglgetattribute.html"
|
|
48 >Prev</A
|
|
49 ></TD
|
|
50 ><TD
|
|
51 WIDTH="80%"
|
|
52 ALIGN="center"
|
|
53 VALIGN="bottom"
|
|
54 ></TD
|
|
55 ><TD
|
|
56 WIDTH="10%"
|
|
57 ALIGN="right"
|
|
58 VALIGN="bottom"
|
|
59 ><A
|
|
60 HREF="sdlglswapbuffers.html"
|
|
61 >Next</A
|
|
62 ></TD
|
|
63 ></TR
|
|
64 ></TABLE
|
|
65 ><HR
|
|
66 ALIGN="LEFT"
|
|
67 WIDTH="100%"></DIV
|
|
68 ><H1
|
|
69 ><A
|
|
70 NAME="SDLGLSETATTRIBUTE"
|
|
71 >SDL_GL_SetAttribute</A
|
|
72 ></H1
|
|
73 ><DIV
|
|
74 CLASS="REFNAMEDIV"
|
|
75 ><A
|
|
76 NAME="AEN2244"
|
|
77 ></A
|
|
78 ><H2
|
|
79 >Name</H2
|
|
80 >SDL_GL_SetAttribute -- Set a special SDL/OpenGL attribute</DIV
|
|
81 ><DIV
|
|
82 CLASS="REFSYNOPSISDIV"
|
|
83 ><A
|
|
84 NAME="AEN2247"
|
|
85 ></A
|
|
86 ><H2
|
|
87 >Synopsis</H2
|
|
88 ><DIV
|
|
89 CLASS="FUNCSYNOPSIS"
|
|
90 ><A
|
|
91 NAME="AEN2248"
|
|
92 ></A
|
|
93 ><P
|
|
94 ></P
|
|
95 ><PRE
|
|
96 CLASS="FUNCSYNOPSISINFO"
|
|
97 >#include "SDL.h"</PRE
|
|
98 ><P
|
|
99 ><CODE
|
|
100 ><CODE
|
|
101 CLASS="FUNCDEF"
|
|
102 >int <B
|
|
103 CLASS="FSFUNC"
|
|
104 >SDL_GL_SetAttribute</B
|
|
105 ></CODE
|
|
106 >(SDL_GLattr attr, int value);</CODE
|
|
107 ></P
|
|
108 ><P
|
|
109 ></P
|
|
110 ></DIV
|
|
111 ></DIV
|
|
112 ><DIV
|
|
113 CLASS="REFSECT1"
|
|
114 ><A
|
|
115 NAME="AEN2254"
|
|
116 ></A
|
|
117 ><H2
|
|
118 >Description</H2
|
|
119 ><P
|
|
120 >Sets the OpenGL <A
|
|
121 HREF="sdlglattr.html"
|
|
122 >attribute</A
|
|
123 > <TT
|
|
124 CLASS="PARAMETER"
|
|
125 ><I
|
|
126 >attr</I
|
|
127 ></TT
|
|
128 > to <TT
|
|
129 CLASS="PARAMETER"
|
|
130 ><I
|
|
131 >value</I
|
|
132 ></TT
|
|
133 >. The attributes you set don't take effect until after a call to <A
|
|
134 HREF="sdlsetvideomode.html"
|
|
135 ><TT
|
|
136 CLASS="FUNCTION"
|
|
137 >SDL_SetVideoMode</TT
|
|
138 ></A
|
|
139 >. You should use <A
|
|
140 HREF="sdlglgetattribute.html"
|
|
141 ><TT
|
|
142 CLASS="FUNCTION"
|
|
143 >SDL_GL_GetAttribute</TT
|
|
144 ></A
|
|
145 > to check the values after a <TT
|
|
146 CLASS="FUNCTION"
|
|
147 >SDL_SetVideoMode</TT
|
|
148 > call.</P
|
|
149 ></DIV
|
|
150 ><DIV
|
|
151 CLASS="REFSECT1"
|
|
152 ><A
|
|
153 NAME="AEN2265"
|
|
154 ></A
|
|
155 ><H2
|
|
156 >Return Value</H2
|
|
157 ><P
|
|
158 >Returns <SPAN
|
|
159 CLASS="RETURNVALUE"
|
|
160 >0</SPAN
|
|
161 > on success, or <SPAN
|
|
162 CLASS="RETURNVALUE"
|
|
163 >-1</SPAN
|
|
164 > on error.</P
|
|
165 ></DIV
|
|
166 ><DIV
|
|
167 CLASS="REFSECT1"
|
|
168 ><A
|
|
169 NAME="AEN2270"
|
|
170 ></A
|
|
171 ><H2
|
|
172 >Example</H2
|
|
173 ><PRE
|
|
174 CLASS="PROGRAMLISTING"
|
|
175 >SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
|
|
176 SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
|
|
177 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
|
|
178 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
|
|
179 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
|
|
180 if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
|
|
181 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
|
|
182 SDL_Quit();
|
|
183 return;
|
|
184 }</PRE
|
|
185 ><DIV
|
|
186 CLASS="NOTE"
|
|
187 ><BLOCKQUOTE
|
|
188 CLASS="NOTE"
|
|
189 ><P
|
|
190 ><B
|
|
191 >Note: </B
|
|
192 >The <TT
|
|
193 CLASS="LITERAL"
|
|
194 >SDL_DOUBLEBUF</TT
|
|
195 > flag is not required to enable double buffering when setting an OpenGL video mode. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute.</P
|
|
196 ></BLOCKQUOTE
|
|
197 ></DIV
|
|
198 ></DIV
|
|
199 ><DIV
|
|
200 CLASS="REFSECT1"
|
|
201 ><A
|
|
202 NAME="AEN2276"
|
|
203 ></A
|
|
204 ><H2
|
|
205 >See Also</H2
|
|
206 ><P
|
|
207 ><A
|
|
208 HREF="sdlglgetattribute.html"
|
|
209 ><TT
|
|
210 CLASS="FUNCTION"
|
|
211 >SDL_GL_GetAttribute</TT
|
|
212 ></A
|
|
213 >,
|
|
214 <A
|
|
215 HREF="sdlglattr.html"
|
|
216 >GL Attributes</A
|
|
217 ></P
|
|
218 ></DIV
|
|
219 ><DIV
|
|
220 CLASS="NAVFOOTER"
|
|
221 ><HR
|
|
222 ALIGN="LEFT"
|
|
223 WIDTH="100%"><TABLE
|
|
224 WIDTH="100%"
|
|
225 BORDER="0"
|
|
226 CELLPADDING="0"
|
|
227 CELLSPACING="0"
|
|
228 ><TR
|
|
229 ><TD
|
|
230 WIDTH="33%"
|
|
231 ALIGN="left"
|
|
232 VALIGN="top"
|
|
233 ><A
|
|
234 HREF="sdlglgetattribute.html"
|
|
235 >Prev</A
|
|
236 ></TD
|
|
237 ><TD
|
|
238 WIDTH="34%"
|
|
239 ALIGN="center"
|
|
240 VALIGN="top"
|
|
241 ><A
|
|
242 HREF="index.html"
|
|
243 >Home</A
|
|
244 ></TD
|
|
245 ><TD
|
|
246 WIDTH="33%"
|
|
247 ALIGN="right"
|
|
248 VALIGN="top"
|
|
249 ><A
|
|
250 HREF="sdlglswapbuffers.html"
|
|
251 >Next</A
|
|
252 ></TD
|
|
253 ></TR
|
|
254 ><TR
|
|
255 ><TD
|
|
256 WIDTH="33%"
|
|
257 ALIGN="left"
|
|
258 VALIGN="top"
|
|
259 >SDL_GL_GetAttribute</TD
|
|
260 ><TD
|
|
261 WIDTH="34%"
|
|
262 ALIGN="center"
|
|
263 VALIGN="top"
|
|
264 ><A
|
|
265 HREF="video.html"
|
|
266 >Up</A
|
|
267 ></TD
|
|
268 ><TD
|
|
269 WIDTH="33%"
|
|
270 ALIGN="right"
|
|
271 VALIGN="top"
|
|
272 >SDL_GL_SwapBuffers</TD
|
|
273 ></TR
|
|
274 ></TABLE
|
|
275 ></DIV
|
|
276 ></BODY
|
|
277 ></HTML
|
|
278 > |