31 #ifndef _openglrenderer_h_
32 #define _openglrenderer_h_
34 #include "CEGUIBase.h"
36 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
37 # ifdef OPENGL_GUIRENDERER_EXPORTS
38 # define OPENGL_GUIRENDERER_API __declspec(dllexport)
40 # define OPENGL_GUIRENDERER_API __declspec(dllimport)
43 # define OPENGL_GUIRENDERER_API
47 #if defined(_WIN32)// All this taken from glut.h
49 # define GLUT_APIENTRY_DEFINED
50 # if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) || defined(__GNUC__)
51 # define APIENTRY __stdcall
58 # if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) || defined(__LCC__) || defined(__GNUC__)
59 # define CALLBACK __stdcall
65 # if defined( __LCC__ )
67 # define WINGDIAPI __stdcall
71 # define GLUT_WINGDIAPI_DEFINED
72 # define WINGDIAPI __declspec(dllimport)
76 # ifndef _WCHAR_T_DEFINED
77 typedef unsigned short wchar_t;
78 # define _WCHAR_T_DEFINED
80 # endif //win32 end glut.h stuff
83 #if defined( __APPLE__ )
84 #include <OpenGL/gl.h>
85 #include <OpenGL/glu.h>
93 #include "CEGUIRenderer.h"
94 #include "CEGUITexture.h"
105 #if defined(_MSC_VER)
106 # pragma warning(push)
107 # pragma warning(disable : 4251)
110 #define OGLRENDERER_VBUFF_CAPACITY 4096
172 virtual void doRender(
void);
175 virtual void clearRenderList(
void);
197 virtual Texture* createTexture(
void);
203 virtual Texture* createTexture(
float size);
206 virtual void destroyTexture(
Texture* texture);
209 virtual void destroyAllTextures(
void);
228 virtual float getWidth(
void)
const {
return d_display_area.getWidth();}
238 virtual float getHeight(
void)
const {
return d_display_area.getHeight();}
248 virtual Size getSize(
void)
const {
return d_display_area.getSize();}
309 void setDisplaySize(
const Size& sz);
318 void grabTextures(
void);
325 void restoreTextures(
void);
338 void setImageCodec(
const String& codecName);
356 static void setDefaultImageCodecName(
const String& codecName);
362 static const String& getDefaultImageCodecName();
369 static const int VERTEX_PER_QUAD;
370 static const int VERTEX_PER_TRIANGLE;
371 static const int VERTEXBUFFER_CAPACITY;
395 uint32 bottomLeftCol;
396 uint32 bottomRightCol;
400 bool operator<(
const QuadInfo& other)
const
413 void initPerFrameStates(
void);
416 void exitPerFrameStates(
void);
419 void renderVBuffer(
void);
422 void sortQuads(
void);
425 void renderQuadDirect(
const Rect& dest_rect,
float z,
const Texture* tex,
const Rect& texture_rect,
const ColourRect& colours,
QuadSplitMode quad_split_mode);
428 uint32 colourToOGL(
const colour& col)
const;
431 void setModuleIdentifierString();
434 void setupImageCodec(
const String& codecName);
437 void cleanupImageCodec();
442 typedef std::multiset<QuadInfo> QuadList;
447 MyQuad myBuff[OGLRENDERER_VBUFF_CAPACITY];
454 std::list<OpenGLTexture*> d_texturelist;
455 GLint d_maxTextureSize;
457 ImageCodec* d_imageCodec;
458 DynamicModule* d_imageCodecModule;
460 static String d_defaultImageCodecName;
467 #if defined(_MSC_VER)
468 # pragma warning(pop)
471 #endif // end of guard _openglrenderer_h_