Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_OPENGL_BASEPIPELINE_H__
00009 #define __SP_OPENGL_BASEPIPELINE_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #if defined(SP_COMPILE_WITH_OPENGL) || defined(SP_COMPILE_WITH_OPENGLES1) || defined(SP_COMPILE_WITH_OPENGLES2)
00015
00016 #include "RenderSystem/spRenderSystem.hpp"
00017 #include "RenderSystem/OpenGL/spOpenGLCoreHeader.hpp"
00018
00019
00020 namespace sp
00021 {
00022 namespace video
00023 {
00024
00025
00027 class SP_EXPORT GLBasePipeline : virtual public RenderSystem
00028 {
00029
00030 public:
00031
00032 virtual ~GLBasePipeline();
00033
00034
00035
00036 virtual io::stringc getRenderer() const;
00037 virtual io::stringc getVersion() const;
00038 virtual io::stringc getVendor() const;
00039 virtual io::stringc getShaderVersion() const;
00040
00041 virtual s32 getMaxAnisotropicFilter() const;
00042
00043 virtual bool queryExtensionSupport(const io::stringc &TargetExtension) const;
00044
00045 virtual dim::EMatrixCoordinateSystmes getProjectionMatrixType() const;
00046
00047
00048
00049 virtual void clearBuffers(const s32 ClearFlags = BUFFER_COLOR | BUFFER_DEPTH);
00050
00051
00052
00053 virtual void setFrontFace(bool isFrontFace);
00054
00055 virtual void setClearColor(const color &Color);
00056 virtual void setColorMask(bool isRed, bool isGreen, bool isBlue, bool isAlpha = true);
00057 virtual void setDepthMask(bool isDepth);
00058
00059 void setDepthRange(f32 Near, f32 Far);
00060
00061
00062
00063 virtual void createVertexBuffer(void* &BufferID);
00064 virtual void createIndexBuffer(void* &BufferID);
00065
00066 virtual void deleteVertexBuffer(void* &BufferID);
00067 virtual void deleteIndexBuffer(void* &BufferID);
00068
00069 virtual void updateVertexBuffer(
00070 void* BufferID, const dim::UniversalBuffer &BufferData, const VertexFormat* Format, const EHWBufferUsage Usage
00071 );
00072 virtual void updateIndexBuffer(
00073 void* BufferID, const dim::UniversalBuffer &BufferData, const IndexFormat* Format, const EHWBufferUsage Usage
00074 );
00075
00076 virtual void updateVertexBufferElement(void* BufferID, const dim::UniversalBuffer &BufferData, u32 Index);
00077 virtual void updateIndexBufferElement(void* BufferID, const dim::UniversalBuffer &BufferData, u32 Index);
00078
00079
00080
00081 virtual void setBlending(const EBlendingTypes SourceBlend, const EBlendingTypes DestBlend);
00082 virtual void setClipping(bool Enable, const dim::point2di &Position, const dim::size2di &Size);
00083 virtual void setViewport(const dim::point2di &Position, const dim::size2di &Size);
00084
00085 virtual void setLineSize(s32 Size = 1);
00086
00087
00088
00089 virtual Texture* createTexture(const STextureCreationFlags &CreationFlags);
00090
00091
00092
00093 virtual void setWorldMatrix(const dim::matrix4f &Matrix);
00094
00096 virtual dim::matrix4f getViewMatrix() const;
00097
00098 protected:
00099
00100 friend class GLTextureBase;
00101 friend class GLFramebufferObject;
00102 friend class OpenGLES1Texture;
00103 friend class OpenGLES2Texture;
00104
00105
00106
00107 GLBasePipeline();
00108
00109 static GLenum getGlTexDimension(const ETextureDimensions DimType);
00110
00111 virtual void setInvertScreen(bool Enable);
00112
00113
00114
00115 static inline void setGlRenderState(GLenum Mode, bool Enable)
00116 {
00117 if (Enable)
00118 glEnable(Mode);
00119 else
00120 glDisable(Mode);
00121 }
00122 static inline bool getGlRenderState(GLenum Mode)
00123 {
00124 GLboolean Enable;
00125 glGetBooleanv(Mode, &Enable);
00126 return Enable == GL_TRUE;
00127 }
00128
00129 inline bool queryGLVersion(s32 Major, s32 Minor) const
00130 {
00131 return GLMajorVersion_ > Major || GLMinorVersion_ >= Minor;
00132 }
00133
00134
00135
00136 s32 GLMajorVersion_, GLMinorVersion_;
00137 s32 MultiTextureCount_;
00138
00139 bool isInvertScreen_;
00140
00141 };
00142
00143
00144 }
00145
00146 }
00147
00148
00149 #endif
00150
00151 #endif
00152
00153
00154
00155