Mercurial > fife-parpg
comparison engine/core/video/opengl/fife_opengl.h @ 620:853d25234671
* Moved the GLEnable and GLDisable structures from opengl_gui_graphics.cpp to fife_opengl.h as they may prove to be useful elsewhere.
* Fixed the color mask definitions in fife_stdint.h
* Added the nextPow2() function to calculate the nearest (greater) power of 2
* Removed a bunch of re-definitions of RGB masks
* Modified GLImage to only generate one "texture chunk". I hope this makes better use of memory and speeds things up a hair
* Made use of the GLEnable structure when clearing the screen
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 30 Sep 2010 21:24:55 +0000 |
parents | 90005975cdbb |
children | e3140f01749d |
comparison
equal
deleted
inserted
replaced
619:f648bfbae5fe | 620:853d25234671 |
---|---|
57 // FIFE includes | 57 // FIFE includes |
58 // These includes are split up in two parts, separated by one empty line | 58 // These includes are split up in two parts, separated by one empty line |
59 // First block: files included from the FIFE root src directory | 59 // First block: files included from the FIFE root src directory |
60 // Second block: files included from the same folder | 60 // Second block: files included from the same folder |
61 | 61 |
62 namespace FIFE { | |
63 | |
64 struct GLEnable { | |
65 GLenum m_flag; | |
66 GLboolean m_oldval; | |
67 GLEnable(GLenum flag) : m_flag(flag) { | |
68 glGetBooleanv(flag, &m_oldval); | |
69 if (!m_oldval) { | |
70 glEnable(flag); | |
71 } | |
72 } | |
73 ~GLEnable() { | |
74 if (!m_oldval) { | |
75 glDisable(m_flag); | |
76 } | |
77 } | |
78 }; | |
79 | |
80 struct GLDisable { | |
81 GLenum m_flag; | |
82 GLboolean m_oldval; | |
83 GLDisable(GLenum flag) : m_flag(flag) { | |
84 glGetBooleanv(flag, &m_oldval); | |
85 if (m_oldval) { | |
86 glDisable(flag); | |
87 } | |
88 } | |
89 ~GLDisable() { | |
90 if (m_oldval) { | |
91 glEnable(m_flag); | |
92 } | |
93 } | |
94 }; | |
95 | |
96 | |
97 } //FIFE | |
98 | |
62 #endif | 99 #endif |