zenilib: zenilib/jni/external/zenilib/zeni_graphics/Video_GL_Fixed.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Video_GL_Fixed.cpp
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <zeni_graphics.h>
19
20 #ifndef DISABLE_GL
21
22 #if defined(REQUIRE_GL_ES)
23 #include <GLES/gl.h>
24 #else
25 #include <GL/glew.h>
26 #endif
27
28 #include <SDL/SDL.h>
29 #ifndef TEMP_DISABLE
30 #ifdef REQUIRE_GL_ES
31 #include <SDL/SDL_opengles.h>
32 #else
33 namespace SDLOPENGL {
34 #include <SDL/SDL_opengl.h>
35 }
36 #endif
37 #endif
38
39 #ifdef _LINUX
40 namespace GLXEW {
41 #include <GL/glxew.h>
42 }
43 #endif
44
45 #include <GLSLANG/ShaderLang.h>
46
47 #include <iostream>
48
49 #if defined(_DEBUG) && defined(_WINDOWS)
50 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
51 #define new DEBUG_NEW
52 #endif
53
54 #ifndef TEMP_DISABLE
55 #ifdef REQUIRE_GL_ES
56 extern "C" GL_API int GL_APIENTRY _dgles_load_library(void *, void *(*)(void *, const char *));
57
58 static void * proc_loader(void *, const char * name) {
59 return SDL_GL_GetProcAddress(name);
60 }
61 #endif
62 #endif
63
64 namespace Zeni {
65
66 Video_GL_Fixed::Video_GL_Fixed()
67 :
68 #if SDL_VERSION_ATLEAST(1,3,0)
69 m_context(0),
70 #endif
71 #ifdef _LINUX
72 m_pglSwapIntervalEXT(0),
73 #endif
74 #ifndef REQUIRE_GL_ES
75 m_pglBindBufferARB(0),
76 m_pglDeleteBuffersARB(0),
77 m_pglGenBuffersARB(0),
78 m_pglBufferDataARB(0),
79 #endif
80 m_maximum_anisotropy(-1),
81 m_zwrite(false),
82 m_render_target(0)
83 #ifdef MANUAL_GL_VSYNC_DELAY
84 ,
85 m_buffer_swap_end_time(0u),
86 m_time_taken(0.0f),
87 m_weight_new(0.2f)
88 #endif
89 {
90 init();
91 }
92
93 Video_GL_Fixed::~Video_GL_Fixed() {
94 uninit();
95 }
96
97 bool Video_GL_Fixed::begin_prerender() {
98 assert(!m_render_target);
99
100 #ifdef _WINDOWS
101 glFlush();
102 #else
103 glFinish();
104 #endif
105
106 get_Textures().unlose_resources();
107 get_Fonts().unlose_resources();
108
109 return true;
110 }
111
112 bool Video_GL_Fixed::begin_render() {
113 assert(!m_render_target);
114
115 glViewport(0, 0, get_Window().get_width(), get_Window().get_height());
116
117 if(!is_zwrite_enabled())
118 glDepthMask(GL_TRUE);
119 set_clear_Color(get_clear_Color());
120 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
121 if(!is_zwrite_enabled())
122 glDepthMask(GL_FALSE);
123
124 return true;
125 }
126
127 void Video_GL_Fixed::end_render() {
128 /*** Begin CPU saver ***/
129 #ifdef MANUAL_GL_VSYNC_DELAY
130 Timer &tr = get_Timer();
131
132 if(get_vertical_sync()) {
133 Time buffer_swap_start_time = tr.get_time();
134
135 const unsigned int time_allowed = 1000u/60u - 2u;
136 const unsigned int new_time_taken = buffer_swap_start_time.get_ticks_since(m_buffer_swap_end_time);
137 m_time_taken = (1.0f - m_weight_new) * m_time_taken + m_weight_new * new_time_taken;
138
139 if(m_time_taken < time_allowed)
140 SDL_Delay(static_cast<unsigned int>(time_allowed - m_time_taken));
141 }
142 #endif
143
145 #ifndef TEMP_DISABLE
146 #if SDL_VERSION_ATLEAST(1,3,0)
147 SDL_GL_SwapWindow(get_Window().get_window());
148 #else
149 SDL_GL_SwapBuffers();
150 #endif
151 #endif
152
153 #ifdef MANUAL_GL_VSYNC_DELAY
154 m_buffer_swap_end_time = tr.get_time();
155 #endif
156 }
157
158 #if SDL_VERSION_ATLEAST(1,3,0)
159 void Video_GL_Fixed::alert_window_destroyed() {
160 m_context = 0;
161 }
162 #endif
163
164 void Video_GL_Fixed::render(const Renderable &renderable) {
165 class PrePostRenderActor {
166 PrePostRenderActor & operator=(const PrePostRenderActor &) {return *this;}
167
168 public:
169 PrePostRenderActor(const Renderable &renderable_)
170 : renderable(renderable_)
171 {
172 renderable.pre_render();
173 }
174
175 ~PrePostRenderActor() {
176 renderable.post_render();
177 }
178 private:
179 const Renderable &renderable;
180 } ppra(renderable);
181
182 renderable.render_to(*this);
183 }
184
185 void Video_GL_Fixed::clear_depth_buffer() {
186 if(!is_zwrite_enabled())
187 glDepthMask(GL_TRUE);
188 glClear(GL_DEPTH_BUFFER_BIT);
189 if(!is_zwrite_enabled())
190 glDepthMask(GL_FALSE);
191 }
192
193 int Video_GL_Fixed::get_maximum_anisotropy() const {
194 return m_maximum_anisotropy;
195 }
196
197 bool Video_GL_Fixed::has_vertex_buffers() const {
198 return GLEW_ARB_vertex_buffer_object != 0;
199 }
200
201 void Video_GL_Fixed::set_2d_view(const std::pair<Point2f, Point2f> &camera2d, const std::pair<Point2i, Point2i> &viewport, const bool &fix_aspect_ratio) {
202 Video::set_2d_view(camera2d, viewport, fix_aspect_ratio);
203
204 if(m_render_target) {
205 select_world_matrix();
206 translate_scene(Vector3f(0.0f, camera2d.second.y, 0.0f));
207 scale_scene(Vector3f(1.0f, -1.0f, 1.0f));
208 translate_scene(Vector3f(0.0f, -camera2d.first.y, 0.0f));
209
210 if(get_backface_culling())
211 glCullFace(GL_FRONT);
212 }
213 else if(get_backface_culling())
214 glCullFace(GL_BACK);
215 }
216
217 void Video_GL_Fixed::set_3d_view(const Camera &camera, const std::pair<Point2i, Point2i> &viewport) {
218 Video::set_3d_view(camera, viewport);
219
220 if(m_render_target) {
221 if(get_backface_culling())
222 glCullFace(GL_FRONT);
223 }
224 else if(get_backface_culling())
225 glCullFace(GL_BACK);
226 }
227
228 void Video_GL_Fixed::set_backface_culling(const bool &on) {
229 Video::set_backface_culling(on);
230
231 if(on) {
232 // Enable Backface Culling
233 glEnable(GL_CULL_FACE);
234
235 if(m_render_target)
236 glCullFace(GL_FRONT);
237 else
238 glCullFace(GL_BACK);
239 }
240 else
241 glDisable(GL_CULL_FACE);
242 }
243
244 void Video_GL_Fixed::set_vertical_sync(const bool &on_) {
245 Core::assert_no_error();
246 Video::set_vertical_sync(on_);
247
248 #ifdef MANUAL_GL_VSYNC_DELAY
249 const bool on = false;
250 #else
251 const bool on = on_;
252 #endif
253
254 #ifndef TEMP_DISABLE
255 #if SDL_VERSION_ATLEAST(1,3,0)
256 SDL_GL_SetSwapInterval(on);
257 #elif !defined(DISABLE_WGL)
258 typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
259 PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;
260
261 const char *extensions = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
262
263 if(strstr(extensions, "WGL_EXT_swap_control")) {
264 wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");
265
266 if(wglSwapIntervalEXT)
267 wglSwapIntervalEXT(on);
268 }
269 #elif defined(_LINUX)
270 if(m_pglSwapIntervalSGI)
271 m_pglSwapIntervalSGI(on);
272 else if(m_pglSwapIntervalEXT)
273 m_pglSwapIntervalEXT(0, 0, on);
274 else
275 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, on);
276 #else
277 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, on);
278 #endif
279 #endif
280
281 SDL_ClearError();
282 }
283
284 void Video_GL_Fixed::set_zwrite(const bool &enabled) {
285 Video::set_zwrite(enabled);
286
287 glDepthMask(GLboolean(enabled));
288 }
289
290 void Video_GL_Fixed::set_ztest(const bool &enabled) {
291 Video::set_ztest(enabled);
292
293 if(enabled) {
294 glEnable(GL_DEPTH_TEST);
295 glDepthFunc(GL_LEQUAL);
296 }
297 else
298 glDisable(GL_DEPTH_TEST);
299 }
300
301 void Video_GL_Fixed::set_alpha_test(const bool &enabled,
302 const TEST &test,
303 const float &value)
304 {
305 Video::set_alpha_test(enabled, test, value);
306
307 GLenum func;
308
309 switch(test) {
310 case ZENI_NEVER: func = GL_NEVER; break;
311 case ZENI_LESS: func = GL_LESS; break;
312 case ZENI_EQUAL: func = GL_EQUAL; break;
313 case ZENI_GREATER: func = GL_GREATER; break;
314 case ZENI_NOT_EQUAL: func = GL_NOTEQUAL; break;
315 case ZENI_LESS_OR_EQUAL: func = GL_LEQUAL; break;
316 case ZENI_GREATER_OR_EQUAL: func = GL_GEQUAL; break;
317 case ZENI_ALWAYS: func = GL_ALWAYS; break;
318 default:
319 assert(false);
320 return;
321 }
322
323 if(enabled)
324 glEnable(GL_ALPHA_TEST);
325 else
326 glDisable(GL_ALPHA_TEST);
327
328 glAlphaFunc(func, value);
329 }
330
331 void Video_GL_Fixed::set_Color(const Color &color) {
332 Video::set_Color(color);
333
334 glColor4f(color.r, color.g, color.b, color.a);
335 }
336
337 void Video_GL_Fixed::set_clear_Color(const Color &color) {
338 Video::set_clear_Color(color);
339
340 glClearColor(color.r, color.g, color.b, color.a);
341 }
342
343 void Video_GL_Fixed::apply_Texture(const unsigned long &id) {
344 get_Textures().apply_Texture(id);
345 }
346
347 void Video_GL_Fixed::apply_Texture(const Texture &texture) {
348 texture.apply_Texture();
349 }
350
351 void Video_GL_Fixed::unapply_Texture() {
352 glDisable(GL_TEXTURE_2D);
353 }
354
355 void Video_GL_Fixed::set_lighting(const bool &on) {
356 Video::set_lighting(on);
357
358 if(on)
359 glEnable(GL_LIGHTING);
360 else
361 glDisable(GL_LIGHTING);
362 }
363
364 void Video_GL_Fixed::set_ambient_lighting(const Color &color) {
365 Video::set_ambient_lighting(color);
366
367 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, reinterpret_cast<const GLfloat *>(&color));
368 }
369
370 void Video_GL_Fixed::set_Light(const int &number, const Light &light) {
371 GLenum ln;
372 switch(number) {
373 case 0: ln = GL_LIGHT0; break;
374 case 1: ln = GL_LIGHT1; break;
375 case 2: ln = GL_LIGHT2; break;
376 case 3: ln = GL_LIGHT3; break;
377 case 4: ln = GL_LIGHT4; break;
378 case 5: ln = GL_LIGHT5; break;
379 case 6: ln = GL_LIGHT6; break;
380 case 7: ln = GL_LIGHT7; break;
381 default:
382 throw Light_Out_of_Range();
383 }
384
385 Video::set_Light(number, light);
386
387 light.set(ln, *this);
388 }
389
390 void Video_GL_Fixed::unset_Light(const int &number) {
391 GLenum ln;
392 switch(number) {
393 case 0: ln = GL_LIGHT0; break;
394 case 1: ln = GL_LIGHT1; break;
395 case 2: ln = GL_LIGHT2; break;
396 case 3: ln = GL_LIGHT3; break;
397 case 4: ln = GL_LIGHT4; break;
398 case 5: ln = GL_LIGHT5; break;
399 case 6: ln = GL_LIGHT6; break;
400 case 7: ln = GL_LIGHT7; break;
401 default:
402 throw Light_Out_of_Range();
403 }
404
405 Video::unset_Light(number);
406
407 glDisable(ln);
408 }
409
410 void Video_GL_Fixed::set_Material(const Material &material) {
411 material.set(*this);
412 }
413
414 void Video_GL_Fixed::unset_Material(const Material &material) {
415 material.unset(*this);
416 }
417
418 void Video_GL_Fixed::set_Fog(const Fog &fog) {
419 Video::set_Fog(fog);
420
421 glEnable(GL_FOG);
422 fog.set(*this);
423 }
424
425 void Video_GL_Fixed::unset_Fog() {
426 Video::unset_Fog();
427
428 glDisable(GL_FOG);
429 }
430
431 void Video_GL_Fixed::set_program(Program &program) {
432 program.link();
433 glUseProgramObjectARB(dynamic_cast<Program_GL_Fixed &>(program).get());
434 }
435
436 void Video_GL_Fixed::unset_program() {
437 glUseProgramObjectARB(0);
438 }
439
440 void Video_GL_Fixed::set_render_target(Texture &
441 #if !defined(REQUIRE_GL_ES) || defined(GL_OES_VERSION_2_0)
442 texture
443 #endif
444 )
445 {
446 #if defined(REQUIRE_GL_ES) && !defined(GL_OES_VERSION_2_0)
447 throw Video_Render_To_Texture_Error();
448 #else
449 if(m_render_target)
450 throw Video_Render_To_Texture_Error();
451
452 Texture_GL &tgl = dynamic_cast< Texture_GL &>(texture);
453
454 if(!tgl.m_frame_buffer_object) {
455 const Point2i &tex_size = tgl.get_size();
456
457 // Generate Depth Buffer
458 glGenRenderbuffersEXT(1, &tgl.m_render_buffer);
459 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, tgl.m_render_buffer);
460 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, tex_size.x, tex_size.y);
461 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
462
463 // Generate Framebuffer Object
464 glGenFramebuffersEXT(1, &tgl.m_frame_buffer_object);
465 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tgl.m_frame_buffer_object);
466
467 // Bind Both to the Texture
468 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, tgl.m_render_buffer);
469 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tgl.m_texture_id, 0);
470 }
471 else
472 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tgl.m_frame_buffer_object);
473
474 m_render_target = &tgl;
475 #endif
476 }
477
478 void Video_GL_Fixed::unset_render_target() {
479 #if defined(REQUIRE_GL_ES) && !defined(GL_OES_VERSION_2_0)
480 throw Video_Render_To_Texture_Error();
481 #else
482 if(!m_render_target)
483 throw Video_Render_To_Texture_Error();
484
485 // Unbind all
486 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
487
488 // Prepare to Generate Mipmap
489 glBindTexture(GL_TEXTURE_2D, m_render_target->m_texture_id);
490 glEnable(GL_TEXTURE_2D);
491 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
492 Textures::get_bilinear_filtering() ? GL_LINEAR : GL_NEAREST);
493
494 glGenerateMipmapEXT(GL_TEXTURE_2D);
495
496 // Cleanup after Mipmap Generation
497 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
498 Textures::get_mipmapping() ?
499 (Textures::get_bilinear_filtering() ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST) :
500 (Textures::get_bilinear_filtering() ? GL_LINEAR : GL_NEAREST));
501 glDisable(GL_TEXTURE_2D);
502 glBindTexture(GL_TEXTURE_2D, 0);
503
504 m_render_target = 0;
505 #endif
506 }
507
508 void Video_GL_Fixed::clear_render_target(const Color &color) {
509 set_clear_Color(color);
510 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
511 }
512
513 inline const Point2i & Video_GL_Fixed::get_render_target_size() const {
514 if(m_render_target)
515 return m_render_target->get_size();
516 else
517 return get_Window().get_size();
518 }
519
520 void Video_GL_Fixed::select_world_matrix() {
521 glMatrixMode(GL_MODELVIEW);
522 }
523
524 void Video_GL_Fixed::push_world_stack() {
525 glMatrixMode(GL_MODELVIEW);
526 glPushMatrix();
527 }
528
529 void Video_GL_Fixed::pop_world_stack() {
530 glMatrixMode(GL_MODELVIEW);
531 glPopMatrix();
532 }
533
534 void Video_GL_Fixed::translate_scene(const Vector3f &direction) {
535 glTranslatef(direction.i, direction.j, direction.k);
536 }
537
538 void Video_GL_Fixed::rotate_scene(const Vector3f &about, const float &radians) {
539 glRotatef(radians * 180.0f / Global::pi, about.i, about.j, about.k);
540 }
541
542 void Video_GL_Fixed::scale_scene(const Vector3f &factor) {
543 glScalef(factor.i, factor.j, factor.k);
544 }
545
546 void Video_GL_Fixed::transform_scene(const Matrix4f &transformation) {
547 glMultMatrixf(reinterpret_cast<const GLfloat * const>(&transformation));
548 }
549
550 Point2f Video_GL_Fixed::get_pixel_offset() const {
551 return Point2f(0.0f, 0.0f);
552 }
553
554 void Video_GL_Fixed::set_view_matrix(const Matrix4f &view) {
555 Video::set_view_matrix(view);
556
557 glMatrixMode(GL_MODELVIEW);
558 glLoadMatrixf(reinterpret_cast<GLfloat *>(const_cast<Matrix4f *>(&view)));
559 }
560
561 void Video_GL_Fixed::set_projection_matrix(const Matrix4f &projection) {
562 Video::set_projection_matrix(projection);
563
564 glMatrixMode(GL_PROJECTION);
565 if(m_render_target && is_3d()) {
566 const Matrix4f flipped = Matrix4f::Scale(Vector3f(1.0f, -1.0f, 1.0f)) * projection;
567 glLoadMatrixf(reinterpret_cast<GLfloat *>(const_cast<Matrix4f *>(&flipped)));
568 }
569 else
570 glLoadMatrixf(reinterpret_cast<GLfloat *>(const_cast<Matrix4f *>(&projection)));
571 }
572
573 void Video_GL_Fixed::set_viewport(const std::pair<Point2i, Point2i> &viewport) {
574 Video::set_viewport(viewport);
575
576 if(m_render_target)
577 glViewport(viewport.first.x, viewport.first.y, viewport.second.x - viewport.first.x, viewport.second.y - viewport.first.y);
578 else
579 glViewport(viewport.first.x, get_Window().get_height() - viewport.second.y, viewport.second.x - viewport.first.x, viewport.second.y - viewport.first.y);
580 }
581
582 Texture * Video_GL_Fixed::load_Texture(const String &filename, const bool &repeat, const bool &lazy_loading) {
583 return new Texture_GL(filename, repeat, lazy_loading);
584 }
585
586 Texture * Video_GL_Fixed::create_Texture(const Image &image) {
587 return new Texture_GL(image);
588 }
589
590 Texture * Video_GL_Fixed::create_Texture(const Point2i &size, const bool &repeat) {
591 return new Texture_GL(size, repeat);
592 }
593
594 Font * Video_GL_Fixed::create_Font(const String &filename, const float &glyph_height, const float &virtual_screen_height) {
595 return new Font_FT(filename, glyph_height, virtual_screen_height);
596 }
597
598 Vertex_Buffer_Renderer * Video_GL_Fixed::create_Vertex_Buffer_Renderer(Vertex_Buffer &vertex_buffer) {
599 return new Vertex_Buffer_Renderer_GL_Fixed(vertex_buffer);
600 }
601
602 Shader * Video_GL_Fixed::create_Vertex_Shader(const String &filename) {
603 return new Shader_GL_Fixed(compile_glsles_shader(filename, m_vertex_compiler), Shader::VERTEX);
604 }
605
606 Shader * Video_GL_Fixed::create_Fragment_Shader(const String &filename) {
607 return new Shader_GL_Fixed(compile_glsles_shader(filename, m_fragment_compiler), Shader::FRAGMENT);
608 }
609
610 Program * Video_GL_Fixed::create_Program() {
611 return new Program_GL_Fixed();
612 }
613
614 void Video_GL_Fixed::init() {
615 Core::assert_no_error();
616
617 std::cerr << "Initializing OpenGL" << std::endl;
618
619 #ifndef TEMP_DISABLE
620 //double buffer, no stencil, no accumulation buffer
621 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
622 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
623 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
624 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
625 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
626 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
627 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
628 SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, 0);
629 SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, 0);
630 SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 0);
631 SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0);
632
633 if(get_multisampling() > 1) {
634 SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, get_multisampling());
635 SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 1);
636 }
637
638 #ifdef REQUIRE_GL_ES
639 {
640 int err = _dgles_load_library(0, proc_loader);
641 if(err)
642 throw Video_Init_Failure();
643 }
644 #endif
645
646 Core::assert_no_error();
647
648 #if SDL_VERSION_ATLEAST(2,0,0)
649 std::list<std::pair<int, int> > contexts;
650 contexts.push_back(std::make_pair(1, 4));
651 contexts.push_back(std::make_pair(1, 3));
652 contexts.push_back(std::make_pair(1, 2));
653 contexts.push_back(std::make_pair(1, 1));
654
655 while(!contexts.empty()) {
656 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, contexts.front().first);
657 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, contexts.front().second);
658
659 m_context = SDL_GL_CreateContext(get_Window().get_window());
660 if(m_context)
661 break;
662
663 std::cerr << "OpenGL context " << contexts.front().first << '.' << contexts.front().second << " failed." << std::endl;
664 SDL_ClearError();
665 contexts.pop_front();
666 }
667
668 if(!m_context)
669 throw Video_Init_Failure();
670
671 /* This had to be before SDL_GL_CreateContext to work correctly on OS X some time ago.
672 * Now it causes an error to be before. Test.
673 */
674 Core::assert_no_error();
675 SDL_GL_SetSwapInterval(get_vertical_sync());
676 SDL_ClearError();
677 #endif
678
679 Core::assert_no_error();
680
681 #ifndef REQUIRE_GL_ES
682 {
683 const GLenum err = glewInit();
684 if(GLEW_OK != err) {
685 std::cerr << "GLEW Error: " << glewGetErrorString(err) << std::endl;
686 throw Video_Init_Failure();
687 }
688 }
689 #endif
690 #endif
691
692 Core::assert_no_error();
693
694 // Set Fill/Shade Mode
695 glShadeModel(GL_SMOOTH);
696 #ifndef REQUIRE_GL_ES
697 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
698 #endif
699 glEnable(GL_NORMALIZE); //GL_RESCALE_NORMALIZE);
700
701 // Enable Alpha Blitting
702 glEnable(GL_BLEND);
703 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
704 //glBlendEquation(GL_FUNC_ADD); // default // would require ARB ext
705
706 // Set lighting variables
707 #ifndef REQUIRE_GL_ES
708 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
709 glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
710 if(glGetError() == GL_INVALID_ENUM)
711 std::cerr << "Quality Warning: Your graphics card does not support separate specular lighting in OpenGL.\n";
712 #endif
713
714 // Initialize Assorted Variables
715 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
716 //glPointSize(static_cast<GLfloat>(sqrt(pow(double(get_screen_width()), 2.) * pow(double(get_screen_height()), 2.)) / 1000000));
717 //glLineWidth(static_cast<GLfloat>(sqrt(pow(double(get_screen_width()), 2.) * pow(double(get_screen_height()), 2.)) / 1000000));
718
719 Core::assert_no_error();
720
721 // Finish with a few function calls
722 set_2d();
723 set_Color(get_Color());
724 set_clear_Color(get_clear_Color());
725 set_backface_culling(get_backface_culling());
726 set_lighting(get_lighting());
727 set_ambient_lighting(get_ambient_lighting());
728 for(int i = 0; i != 8; ++i)
729 if(const Light * const lp = get_Light(i))
730 set_Light(i, *lp);
731 if(const Fog * const fp = get_Fog())
732 set_Fog(*fp);
733 set_alpha_test(is_alpha_test_enabled(), get_alpha_test_function(), get_alpha_test_value());
734 set_zwrite(is_zwrite_enabled());
735 set_ztest(is_ztest_enabled());
736
737 Core::assert_no_error();
738
739 #ifndef REQUIRE_GL_ES
740 union {
741 void * v;
742 #ifdef _LINUX
743 GLXEW::PFNGLXSWAPINTERVALEXTPROC pglSwapIntervalEXT;
744 GLXEW::PFNGLXSWAPINTERVALSGIPROC pglSwapIntervalSGI;
745 #endif
746 PFNGLBINDBUFFERARBPROC pglBindBufferARB;
747 PFNGLDELETEBUFFERSARBPROC pglDeleteBuffersARB;
748 PFNGLGENBUFFERSARBPROC pglGenBuffersARB;
749 PFNGLBUFFERDATAARBPROC pglBufferDataARB;
750 } ptr;
751
752 #ifdef _LINUX
753 ptr.v = SDL_GL_GetProcAddress("glXSwapIntervalEXT");
754 if(!ptr.v)
755 ptr.v = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
756 m_pglSwapIntervalEXT = ptr.pglSwapIntervalEXT;
757
758 ptr.v = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
759 if(!ptr.v)
760 ptr.v = SDL_GL_GetProcAddress("wglSwapIntervalSGI");
761 m_pglSwapIntervalSGI = ptr.pglSwapIntervalSGI;
762 #endif
763
764 if(GLEW_ARB_vertex_buffer_object) {
765 ptr.v = SDL_GL_GetProcAddress("glBindBufferARB");
766 m_pglBindBufferARB = ptr.pglBindBufferARB;
767
768 ptr.v = SDL_GL_GetProcAddress("glDeleteBuffersARB");
769 m_pglDeleteBuffersARB = ptr.pglDeleteBuffersARB;
770
771 ptr.v = SDL_GL_GetProcAddress("glGenBuffersARB");
772 m_pglGenBuffersARB = ptr.pglGenBuffersARB;
773
774 ptr.v = SDL_GL_GetProcAddress("glBufferDataARB");
775 m_pglBufferDataARB = ptr.pglBufferDataARB;
776
777 if(!(m_pglBindBufferARB && m_pglDeleteBuffersARB && m_pglGenBuffersARB && m_pglBufferDataARB)) {
778 m_pglBindBufferARB = 0;
779 m_pglDeleteBuffersARB = 0;
780 m_pglGenBuffersARB = 0;
781 m_pglBufferDataARB = 0;
782
783 std::cerr << "Performance Warning: Your graphics card does not offer Vertex Buffer Objects (VBO) in OpenGL.\n";
784 }
785 }
786 else
787 std::cerr << "Performance Warning: Your graphics card does not offer Vertex Buffer Objects (VBO) in OpenGL.\n";
788
789 if(GLEW_EXT_texture_filter_anisotropic)
790 glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, reinterpret_cast<GLint *>(&m_maximum_anisotropy));
791 else
792 m_maximum_anisotropy = 0;
793 #else
794 m_maximum_anisotropy = 0;
795 #endif
796
797 // Has to be done after finding the function pointer
798 set_vertical_sync(get_vertical_sync());
799
801
802 ShBuiltInResources resources;
803 ShInitBuiltInResources(&resources);
804
805 resources.MaxVertexAttribs = 8;
806 resources.MaxVertexUniformVectors = 128;
807 resources.MaxVaryingVectors = 8;
808 resources.MaxVertexTextureImageUnits = 0;
809 resources.MaxCombinedTextureImageUnits = 8;
810 resources.MaxTextureImageUnits = 8;
811 resources.MaxFragmentUniformVectors = 16;
812 resources.MaxDrawBuffers = 1;
813
814 resources.OES_standard_derivatives = 0;
815 resources.OES_EGL_image_external = 0;
816
817 m_vertex_compiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, SH_GLSL_OUTPUT, &resources);
818 m_fragment_compiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_GLSL_OUTPUT, &resources);
819
820 Core::assert_no_error();
821 }
822
823 void Video_GL_Fixed::uninit() {
824 ShDestruct(m_vertex_compiler);
825 ShDestruct(m_fragment_compiler);
826
827 #if SDL_VERSION_ATLEAST(1,3,0)
828 if(m_context)
829 SDL_GL_DeleteContext(m_context);
830 #endif
831 }
832
833 }
834
835 #else
836
837 namespace Zeni {
838 void * this_pointer_is_also_dead_beef = (void *)0xDEADBEEF;
839 }
840
841 #endif
glDisable
#define glDisable
Definition: gl_mangle.h:393
glTexParameteri
#define glTexParameteri
Definition: gl_mangle.h:1763
GL_TRUE
#define GL_TRUE
Definition: gl2.h:51
Zeni::Vertex_Buffer_Renderer_GL_Fixed
Definition: Vertex_Buffer.h:213
GL_FOG
#define GL_FOG
Definition: glew_head.h:360
Zeni::Point2i::y
Sint32 y
Definition: Coordinate.h:94
pi
static const double pi
Definition: e_atan2.c:47
Zeni::Program::link
virtual void link()=0
GL_FRONT
#define GL_FRONT
Definition: gl2.h:130
Zeni::Light
An Abstraction of a Light.
Definition: Light.h:57
GLEW_EXT_texture_filter_anisotropic
#define GLEW_EXT_texture_filter_anisotropic
Definition: glew.h:10087
GL_LINEAR_MIPMAP_LINEAR
#define GL_LINEAR_MIPMAP_LINEAR
Definition: gl2.h:316
Zeni::Texture_GL
Definition: Texture.h:111
GL_FALSE
#define GL_FALSE
Definition: gl2.h:50
GL_BLEND
#define GL_BLEND
Definition: gl2.h:147
GL_CULL_FACE
#define GL_CULL_FACE
Definition: gl2.h:146
wglSwapIntervalEXT
#define wglSwapIntervalEXT
Definition: wglew.h:716
SDL_GL_GetProcAddress
DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
Definition: SDL_video.c:2340
light
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum light
Definition: SDL_glfuncs.h:144
glLightModelfv
#define glLightModelfv
Definition: gl_mangle.h:990
color
GLuint color
Definition: glew.h:7185
GLenum
unsigned int GLenum
Definition: gl2.h:23
SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:186
Zeni::Video_Init_Failure
Definition: Video.h:293
SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:185
Zeni::Camera
Camera / Point of View.
Definition: Camera.h:49
Zeni::Renderable::post_render
virtual void post_render() const
Definition: Renderable.cpp:61
Zeni::Renderable::render_to
virtual void render_to(Video_GL_Fixed &screen) const =0
Overridden for OpenGL rendering.
glPolygonMode
#define glPolygonMode
Definition: gl_mangle.h:1295
GL_SRC_ALPHA
#define GL_SRC_ALPHA
Definition: gl2.h:77
SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:173
glCullFace
#define glCullFace
Definition: gl_mangle.h:332
f
GLclampf f
Definition: glew.h:3390
GLboolean
unsigned char GLboolean
Definition: gl2.h:24
SDL_GL_CreateContext
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *window)
Create an OpenGL context for use with an OpenGL window, and make it current.
Definition: SDL_video.c:2758
GL_LIGHT6
#define GL_LIGHT6
Definition: glew_head.h:674
GL_BACK
#define GL_BACK
Definition: gl2.h:131
ShBuiltInResources::MaxDrawBuffers
int MaxDrawBuffers
Definition: ShaderLang.h:213
SH_FRAGMENT_SHADER
Definition: ShaderLang.h:49
enabled
GLenum GLsizei const GLuint GLboolean enabled
Definition: glew.h:2538
GL_EQUAL
#define GL_EQUAL
Definition: gl2.h:283
GL_TEXTURE_2D
#define GL_TEXTURE_2D
Definition: gl2.h:145
GL_NORMALIZE
#define GL_NORMALIZE
Definition: glew_head.h:383
ShBuiltInResources::MaxTextureImageUnits
int MaxTextureImageUnits
Definition: ShaderLang.h:211
Zeni::Program
Definition: Shader.h:108
ShBuiltInResources::MaxVertexUniformVectors
int MaxVertexUniformVectors
Definition: ShaderLang.h:207
ShaderLang.h
ShConstructCompiler
COMPILER_EXPORT ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output, const ShBuiltInResources *resources)
Definition: ShaderLang.cpp:140
glGetIntegerv
#define glGetIntegerv
Definition: gl_mangle.h:679
ShBuiltInResources::MaxFragmentUniformVectors
int MaxFragmentUniformVectors
Definition: ShaderLang.h:212
init
static void init(struct bs2b *bs2b)
Definition: bs2b.c:46
GL_DEPTH_COMPONENT16
#define GL_DEPTH_COMPONENT16
Definition: gl2.h:433
SDL_GL_GREEN_SIZE
Definition: SDL_video.h:169
Zeni::render
static void render(const Vertex_Buffer_Macrorenderer &macrorenderer, std::vector< Vertex_Buffer::Vertex_Buffer_Range * > &descriptors)
Definition: Vertex_Buffer.cpp:581
ShBuiltInResources::MaxVertexTextureImageUnits
int MaxVertexTextureImageUnits
Definition: ShaderLang.h:209
Zeni::Material
An Abstraction of a Material.
Definition: Material.h:56
glBindFramebufferEXT
#define glBindFramebufferEXT
Definition: glew.h:8999
glTranslatef
#define glTranslatef
Definition: gl_mangle.h:1802
GL_LIGHT4
#define GL_LIGHT4
Definition: glew_head.h:672
Zeni::Font_FT
Definition: Font.h:99
GL_FRONT_AND_BACK
#define GL_FRONT_AND_BACK
Definition: gl2.h:132
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
GL_LIGHT3
#define GL_LIGHT3
Definition: glew_head.h:671
Zeni::Light::set
void set(const GLenum &number, Video_GL_Fixed &screen) const
Definition: Light.cpp:52
Zeni::Time::get_ticks_since
Tick_Type get_ticks_since(const Time &time) const
Get the number of clock ticks passed between &#39;time&#39; and this Time.
Definition: Timer.hxx:40
assert
#define assert(x)
Definition: SDL_malloc.c:1234
GL_LIGHTING
#define GL_LIGHTING
Definition: glew_head.h:352
Zeni::Renderable
A Renderable Interface.
Definition: Renderable.h:47
if
if(!yyg->yy_init)
Definition: glslang_lex.cpp:1037
SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:178
func
GLenum func
Definition: SDL_opengl.h:5654
SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:177
GL_DEPTH_ATTACHMENT_EXT
#define GL_DEPTH_ATTACHMENT_EXT
Definition: glew.h:8963
Zeni::Image
Image.
Definition: Image.h:52
image
EGLImageKHR image
Definition: eglext.h:88
Zeni::Fog::set
void set(Video_GL_Fixed &screen) const
Definition: Fog.cpp:48
SDL_VERSION_ATLEAST
#define SDL_VERSION_ATLEAST(X, Y, Z)
Definition: SDL_version.h:106
Zeni::String
Definition: String.h:29
glClear
#define glClear
Definition: gl_mangle.h:170
SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:179
glFlush
#define glFlush
Definition: gl_mangle.h:485
SDL_opengles.h
SDL_opengl.h
glFramebufferRenderbufferEXT
#define glFramebufferRenderbufferEXT
Definition: glew.h:9004
GL_LESS
#define GL_LESS
Definition: gl2.h:282
SH_GLES2_SPEC
Definition: ShaderLang.h:54
SDL_GL_SetAttribute
DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL_video.c:2469
glPushMatrix
#define glPushMatrix
Definition: gl_mangle.h:1476
SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:176
SH_VERTEX_SHADER
Definition: ShaderLang.h:50
GL_COLOR_BUFFER_BIT
#define GL_COLOR_BUFFER_BIT
Definition: gl2.h:47
Zeni::Texture
An Abstraction of a Texture.
Definition: Texture.h:61
Zeni::get_Timer
Timer & get_Timer()
Get access to the singleton.
Definition: Timer.cpp:73
Zeni::Vector3f
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
ShBuiltInResources::MaxVertexAttribs
int MaxVertexAttribs
Definition: ShaderLang.h:206
glRotatef
#define glRotatef
Definition: gl_mangle.h:1555
glFinish
#define glFinish
Definition: gl_mangle.h:482
u
ALuint u
Definition: alMain.h:58
SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:181
Zeni::Light_Out_of_Range
Definition: Video.h:297
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
Definition: gl2ext.h:406
GL_TEXTURE_MIN_FILTER
#define GL_TEXTURE_MIN_FILTER
Definition: gl2.h:320
SDL_GL_SetSwapInterval
DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition: SDL_video.c:2843
v
const GLdouble * v
Definition: glew.h:1377
glScalef
#define glScalef
Definition: gl_mangle.h:1572
APIENTRY
#define APIENTRY
Definition: glew_head.h:150
Zeni::Material::unset
void unset(Video_GL_Fixed &screen) const
Definition: Material.cpp:115
int
int
Definition: SDL_systhread.c:37
glViewport
#define glViewport
Definition: gl_mangle.h:2242
Zeni::Timer
A Timer Singleton.
Definition: Timer.h:97
Zeni::Fog
An Abstraction of Fog.
Definition: Fog.h:47
GL_NEVER
#define GL_NEVER
Definition: gl2.h:281
Zeni::Color::a
float a
Definition: Color.h:69
Zeni::Video_Render_To_Texture_Error
Definition: Video.h:301
GL_RENDERBUFFER_EXT
#define GL_RENDERBUFFER_EXT
Definition: glew.h:8966
ShDestruct
COMPILER_EXPORT void ShDestruct(ShHandle handle)
Definition: ShaderLang.cpp:158
sort_controllers.filename
string filename
Definition: sort_controllers.py:8
ShInitBuiltInResources
COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources)
Definition: ShaderLang.cpp:109
GL_ALPHA_TEST
#define GL_ALPHA_TEST
Definition: glew_head.h:393
glShadeModel
#define glShadeModel
Definition: gl_mangle.h:1626
glEnable
#define glEnable
Definition: gl_mangle.h:441
GL_LIGHT_MODEL_COLOR_CONTROL
#define GL_LIGHT_MODEL_COLOR_CONTROL
Definition: glew.h:1226
SDL_GL_DeleteContext
DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context)
Delete an OpenGL context.
Definition: SDL_video.c:2889
SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:171
GLEW_OK
#define GLEW_OK
Definition: glew_tail.h:4
GL_MODELVIEW
#define GL_MODELVIEW
Definition: glew_head.h:581
glLightModeli
#define glLightModeli
Definition: gl_mangle.h:991
SDL_Delay
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
Definition: SDL_systimer.c:70
Zeni::Timer::get_time
Time get_time()
Get the current Time.
Definition: Timer.hxx:69
glUseProgramObjectARB
#define glUseProgramObjectARB
Definition: glew.h:5698
GL_LIGHT1
#define GL_LIGHT1
Definition: glew_head.h:669
Zeni::Font
Font Abstraction.
Definition: Font.h:70
SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:175
glGenerateMipmapEXT
#define glGenerateMipmapEXT
Definition: glew.h:9010
glColor4f
#define glColor4f
Definition: gl_mangle.h:202
GL_FILL
#define GL_FILL
Definition: glew_head.h:601
SDL_GL_BLUE_SIZE
Definition: SDL_video.h:170
Zeni::Vector3f::k
float k
Definition: Vector3f.h:119
glMultMatrixf
#define glMultMatrixf
Definition: gl_mangle.h:1187
program
GLbitfield GLuint program
Definition: gl2ext.h:1203
PFNGLXSWAPINTERVALEXTPROC
void(* PFNGLXSWAPINTERVALEXTPROC)(Display *dpy, GLXDrawable drawable, int interval)
Definition: glxew.h:676
PFNGLXSWAPINTERVALSGIPROC
int(* PFNGLXSWAPINTERVALSGIPROC)(int interval)
Definition: glxew.h:1360
Zeni::Vertex_Buffer
A Vertex_Buffer that accepts Triangle and Quadrilaterals.
Definition: Vertex_Buffer.h:85
glGenFramebuffersEXT
#define glGenFramebuffersEXT
Definition: glew.h:9008
SDL_GL_RED_SIZE
Definition: SDL_video.h:168
glDepthFunc
#define glDepthFunc
Definition: gl_mangle.h:379
GL_LINEAR
#define GL_LINEAR
Definition: gl2.h:308
Zeni::Material::set
void set(Video_GL_Fixed &screen) const
Definition: Material.cpp:83
GL_FRAMEBUFFER_EXT
#define GL_FRAMEBUFFER_EXT
Definition: glew.h:8965
Zeni::get_Textures
Textures & get_Textures()
Get access to the singleton.
Definition: Textures.cpp:64
Zeni::Texture_GL::get_size
const Point2i & get_size() const
Get the resolution of the Texture on the GPU.
Definition: Texture.hxx:48
GL_INVALID_ENUM
#define GL_INVALID_ENUM
Definition: gl2.h:158
glDepthMask
#define glDepthMask
Definition: gl_mangle.h:380
Zeni::get_Window
Window & get_Window()
Get access to the singleton.
Definition: Window.cpp:392
Zeni::Texture::apply_Texture
virtual void apply_Texture() const =0
Apply a Texture to upcoming polygons.
SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:174
Zeni::Color::b
float b
Definition: Color.h:68
Zeni::Textures::apply_Texture
void apply_Texture(const String &name)
Apply a texture for upcoming polygons (Called by Video::apply_Texture)
Definition: Textures.cpp:68
GLEW_ARB_vertex_buffer_object
#define GLEW_ARB_vertex_buffer_object
Definition: glew.h:6922
Zeni::Vector3f::j
float j
Definition: Vector3f.h:115
ShBuiltInResources::MaxCombinedTextureImageUnits
int MaxCombinedTextureImageUnits
Definition: ShaderLang.h:210
GL_COLOR_ATTACHMENT0_EXT
#define GL_COLOR_ATTACHMENT0_EXT
Definition: gl2ext.h:578
texture
GLenum GLenum GLuint texture
Definition: gl2ext.h:850
glClearColor
#define glClearColor
Definition: gl_mangle.h:164
glPopMatrix
#define glPopMatrix
Definition: gl_mangle.h:1301
Zeni::Database::unlose_resources
void unlose_resources()
If resources have been lost, then reload them.
Definition: Database.hxx:415
glLoadMatrixf
#define glLoadMatrixf
Definition: gl_mangle.h:1005
GL_LIGHT_MODEL_LOCAL_VIEWER
#define GL_LIGHT_MODEL_LOCAL_VIEWER
Definition: glew_head.h:353
glGetError
#define glGetError
Definition: gl_mangle.h:643
value
EGLSurface EGLint void ** value
Definition: eglext.h:301
Zeni::Shader
A base class for Vertex_Shader and Fragment_Shader.
Definition: Shader.h:97
GL_EXTENSIONS
#define GL_EXTENSIONS
Definition: gl2.h:304
Zeni::Program_GL_Fixed
Definition: Shader.h:135
SDL_ClearError
DECLSPEC void SDLCALL SDL_ClearError(void)
Definition: SDL_error.c:212
Zeni::Point2i::x
Sint32 x
Definition: Coordinate.h:94
ShBuiltInResources
Definition: ShaderLang.h:203
glBindRenderbufferEXT
#define glBindRenderbufferEXT
Definition: glew.h:9000
GL_GEQUAL
#define GL_GEQUAL
Definition: gl2.h:287
GL_PROJECTION
#define GL_PROJECTION
Definition: glew_head.h:582
SH_GLSL_OUTPUT
Definition: ShaderLang.h:82
GL_SMOOTH
#define GL_SMOOTH
Definition: glew_head.h:606
GL_NOTEQUAL
#define GL_NOTEQUAL
Definition: gl2.h:286
glMatrixMode
#define glMatrixMode
Definition: gl_mangle.h:1053
glewGetErrorString
const GLubyte *GLEWAPIENTRY glewGetErrorString(GLenum error)
Definition: glew_init_tail.c:3
GL_LIGHT_MODEL_AMBIENT
#define GL_LIGHT_MODEL_AMBIENT
Definition: glew_head.h:355
GL_LIGHT7
#define GL_LIGHT7
Definition: glew_head.h:675
GL_ONE_MINUS_SRC_ALPHA
#define GL_ONE_MINUS_SRC_ALPHA
Definition: gl2.h:78
GL_SEPARATE_SPECULAR_COLOR
#define GL_SEPARATE_SPECULAR_COLOR
Definition: glew.h:1228
GL_GREATER
#define GL_GREATER
Definition: gl2.h:285
Zeni::Color::g
float g
Definition: Color.h:67
Zeni::Window::get_size
static const Point2i & get_size()
Definition: Window.hxx:29
GL_LIGHT2
#define GL_LIGHT2
Definition: glew_head.h:670
GL_APIENTRY
#define GL_APIENTRY
Definition: gl2platform.h:27
GL_ALWAYS
#define GL_ALWAYS
Definition: gl2.h:288
SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:182
Zeni::get_Fonts
Fonts & get_Fonts()
Get access to the singleton.
Definition: Fonts.cpp:60
Zeni::Video::TEST
TEST
Definition: Video.h:98
Zeni::Shader_GL_Fixed
Definition: Shader.h:121
glBindTexture
#define glBindTexture
Definition: gl_mangle.h:98
Zeni::Renderable::pre_render
virtual void pre_render() const
Definition: Renderable.cpp:56
Zeni::Matrix4f
A Featureful 4-Space Matrix Class.
Definition: Matrix4f.h:47
Zeni::Color::r
float r
Definition: Color.h:66
i
int i
Definition: pngrutil.c:1377
zeni_graphics.h
GL_DEPTH_BUFFER_BIT
#define GL_DEPTH_BUFFER_BIT
Definition: gl2.h:45
ShBuiltInResources::OES_EGL_image_external
int OES_EGL_image_external
Definition: ShaderLang.h:218
glewInit
GLenum GLEWAPIENTRY glewInit(void)
Definition: glew_init_tail.c:43
GL_NEAREST_MIPMAP_NEAREST
#define GL_NEAREST_MIPMAP_NEAREST
Definition: gl2.h:313
Zeni::Point2f
A 2D Point represented with floats.
Definition: Coordinate.h:98
glGenRenderbuffersEXT
#define glGenRenderbuffersEXT
Definition: glew.h:9009
Zeni::Vector3f::i
float i
Definition: Vector3f.h:111
glAlphaFunc
#define glAlphaFunc
Definition: gl_mangle.h:42
GL_LIGHT5
#define GL_LIGHT5
Definition: glew_head.h:673
GL_LEQUAL
#define GL_LEQUAL
Definition: gl2.h:284
glRenderbufferStorageEXT
#define glRenderbufferStorageEXT
Definition: glew.h:9015
Zeni::Vertex_Buffer_Renderer
Definition: Vertex_Buffer.h:71
false
#define false
Definition: ftrandom.c:50
GL_LIGHT0
#define GL_LIGHT0
Definition: glew_head.h:667
Zeni::Color
Color.
Definition: Color.h:41
ShBuiltInResources::MaxVaryingVectors
int MaxVaryingVectors
Definition: ShaderLang.h:208
SDL_GL_SwapWindow
DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window *window)
Swap the OpenGL buffers for a window, if double-buffering is supported.
Definition: SDL_video.c:2871
glGetString
#define glGetString
Definition: gl_mangle.h:824
ShBuiltInResources::OES_standard_derivatives
int OES_standard_derivatives
Definition: ShaderLang.h:217
GL_NEAREST
#define GL_NEAREST
Definition: gl2.h:307
glBlendFunc
#define glBlendFunc
Definition: gl_mangle.h:135
Zeni::Time
A Snapshot of the Timer.
Definition: Timer.h:63
glFramebufferTexture2DEXT
#define glFramebufferTexture2DEXT
Definition: glew.h:9006
BOOL
typedef BOOL(WINAPI *PFNWGLSETSTEREOEMITTERSTATE3DLPROC)(HDC hDC
GL_DEPTH_TEST
#define GL_DEPTH_TEST
Definition: gl2.h:150
size
GLsizei size
Definition: gl2ext.h:1467
Zeni::Point2i
A 2D Point represented with integers.
Definition: Coordinate.h:85