gl_graphic_core.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00033 #ifndef __gl_graphic_core__header__
00034 #define __gl_graphic_core__header__
00035
00036 #include "gpucalc/graphic_core.h"
00037
00038 #include "gpucalc/log_manager.h"
00039 #include "gpucalc/application.h"
00040
00041
00042 #include <GL/glew.h>
00043
00044 namespace gpucalc
00045 {
00046
00065 const char _GLGraphicCoreObjectName [] = "GLGraphicCore";
00066
00067
00068 class GLTexture;
00069 class GLFrameBuffer;
00070
00071
00077 class _GpuCalcPrivate GLGraphicCore: public GraphicCore
00078 {
00079
00080 OBJ_DISABLE_COPY(GLGraphicCore)
00081
00082
00083 friend class GLGraphicCorePlugin;
00084
00085 public:
00086 GLGraphicCore();
00087
00088
00089 ~GLGraphicCore();
00090
00091
00092 void start(int argc, char * argv []);
00093 void stop();
00094
00095
00096 void setMatrixMode(float Width, float Height);
00097 void draw(float TexCoordX, float TexCoordY);
00098
00099
00100 Texture * create(const std::string & TextureName, TextureUsage Usage);
00101
00102
00103 Texture * getTextureByName(const std::string & TextureName) const;
00104
00105
00106 Texture * getActiveTexture() const
00107 {
00108 return mActiveTexture;
00109 }
00110
00111
00112 void initialize(const Data & data, Texture & texture);
00113
00114
00115 bool isTextureCreated(const std::string & TextureName) const;
00116
00117
00118 FrameBuffer * create(const std::string & FrameBufferName);
00119
00120
00121 FrameBuffer * getFrameBufferByName(const std::string & FrameBufferName) const;
00122
00123
00124 FrameBuffer * getActiveFrameBuffer() const
00125 {
00126 return mActiveFrameBuffer;
00127 }
00128
00129
00130 void bind(Texture * texture);
00131
00132
00133 void bind(FrameBuffer * framebuffer);
00134
00135
00136 void unbind(Texture * texture);
00137
00138
00139 void unbind(FrameBuffer * framebuffer);
00140
00141
00142 bool isFrameBufferCreated(const std::string & FrameBufferName) const;
00143
00144
00145 void destroy(Texture * texture);
00146
00147
00148 void destroy(FrameBuffer * fb);
00149
00150
00151 void checkErrors(const std::string & where);
00152
00153
00154 bool isAcceptSystem(const ShaderSystem * System) const;
00155
00156
00157 void addAcceptableShaderSystemID(const std::string & ShaderSystemID);
00158
00159
00160 Vendor getVendor() const
00161 {
00162 assert(mIsStarted && "GLGraphicCore is not started!!!");
00163 return mGLVendor;
00164 }
00165
00166
00167 GLint maxTextureSize() const
00168 {
00169 assert(mIsStarted && "GLGraphicCore is not started!!!");
00170 return mGLMaxTextureSize;
00171 }
00172
00173
00174 GLint maxFramebufferAttachmentPoints() const
00175 {
00176 assert(mIsStarted && "GLGraphicCore is not started!!!");
00177 return mGLMaxFrameBufferAttachmentPoints;
00178 }
00179
00180
00181
00182 private:
00183
00184 int mGLUTWindow;
00185
00186
00187 Vendor mGLVendor;
00188
00189
00190 GLint mGLMaxFrameBufferAttachmentPoints;
00191
00192
00193 GLint mGLMaxTextureSize;
00194
00195
00196 float mGLDefaultWidth;
00197
00198
00199 float mGLDefaultHeight;
00200
00201
00202 bool mIsStarted;
00203
00204
00208 typedef std::map<std::string, GLTexture *> GLTextureMap;
00209
00210
00216 GLTextureMap mGLTextureMap;
00217
00218
00222 typedef std::map<std::string, GLFrameBuffer *> GLFrameBufferMap;
00223
00224
00230 GLFrameBufferMap mGLFrameBufferMap;
00231
00232
00233 typedef std::set<std::string> AcceptableShaderSystemIDSet;
00234
00235
00236 AcceptableShaderSystemIDSet mAcceptableShaderSystemIDSet;
00237
00238
00239 FrameBuffer * mActiveFrameBuffer;
00240
00241
00242 Texture * mActiveTexture;
00243
00244
00245 Vendor FindCorrectVendor(const std::string & GLVendorString);
00246
00247
00248 void ConvertToTexture(const Data & data, GLTexture & texture);
00249
00250
00251 void ConvertToNVTexture(const Data & data, GLTexture & texture);
00252
00253
00254 void ConvertToATITexture(const Data & data, GLTexture & texture);
00255
00256 };
00257 }
00258
00259 #endif