class EE::Graphics::Renderer¶
Overview¶
This class is an abstraction of some OpenGL functionality. eepp has 4 different rendering pipelines: OpenGL 2, OpenGL 3, OpenGL 3 Core Profile and OpenGL ES 2. This abstraction is to encapsulate this pipelines. eepp implements its own state machine to simulate fixed-pipeline commands with OpenGL 3 and OpenGL ES 2. Most of the commands can be found in the OpenGL documentation. This is only useful for advanced users that want some control of the OpenGL pipeline. It’s mostly used internally by the engine. More…
#include <renderer.hpp> class Renderer { public: // construction virtual ~Renderer(); // methods static GraphicsLibraryVersion glVersionFromString(std::string glVersion); static std::string graphicsLibraryVersionToString(const GraphicsLibraryVersion& glVersion); static GraphicsLibraryVersion getDefaultGraphicsLibraryVersion(); static std::vector<GraphicsLibraryVersion> getAvailableGraphicsLibraryVersions(); static Renderer* createSingleton(GraphicsLibraryVersion ver); static Renderer* createSingleton(); static Renderer* existsSingleton(); static Renderer* instance(); static void destroySingleton(); virtual void init(); std::string getVendor(); std::string getRenderer(); std::string getVersion(); std::string getShadingLanguageVersion(); bool isExtension(const std::string& name); bool isExtension(GraphicsLibraryExtension name); bool pointSpriteSupported(); bool shadersSupported(); void clear(unsigned int mask); void clearColor(float red, float green, float blue, float alpha); void scissor(int x, int y, int width, int height); void polygonMode(unsigned int face, unsigned int mode); std::string getExtensions(); const char* getString(unsigned int name); void drawArrays(unsigned int mode, int first, int count); void drawElements(unsigned int mode, int count, unsigned int type, const void* indices); void bindTexture(unsigned int target, unsigned int texture); void activeTexture(unsigned int texture); void blendFunc(unsigned int sfactor, unsigned int dfactor); void blendFuncSeparate(unsigned int sfactorRGB, unsigned int dfactorRGB, unsigned int sfactorAlpha, unsigned int dfactorAlpha); void blendEquationSeparate(unsigned int modeRGB, unsigned int modeAlpha); void blitFrameBuffer( int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, unsigned int mask, unsigned int filter ); void viewport(int x, int y, int width, int height); void lineSmooth(const bool& enable); void lineWidth(float width); void lineSmooth(); bool isLineSmooth(); void polygonSmooth(const bool& enable); void polygonSmooth(); bool isPolygonSmooth(); void polygonMode(const PrimitiveFillMode& Mode); void polygonMode(); void pixelStorei(unsigned int pname, int param); void multisample(bool enable); bool isMultisample(); RendererGL* getRendererGL(); RendererGL3* getRendererGL3(); RendererGL3CP* getRendererGL3CP(); RendererGLES2* getRendererGLES2(); virtual void pointSize(float size) = 0; virtual float pointSize() = 0; virtual void clientActiveTexture(unsigned int texture) = 0; virtual void disable(unsigned int cap); virtual void enable(unsigned int cap); virtual GraphicsLibraryVersion version() = 0; virtual std::string versionStr() = 0; virtual void pushMatrix() = 0; virtual void popMatrix() = 0; virtual void loadIdentity() = 0; virtual void translatef(float x, float y, float z) = 0; virtual void rotatef(float angle, float x, float y, float z) = 0; virtual void scalef(float x, float y, float z) = 0; virtual void matrixMode(unsigned int mode) = 0; virtual void ortho(float left, float right, float bottom, float top, float zNear, float zFar) = 0; virtual void lookAt( float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ ) = 0; virtual void perspective(float fovy, float aspect, float zNear, float zFar) = 0; virtual void enableClientState(unsigned int array) = 0; virtual void disableClientState(unsigned int array) = 0; virtual void vertexPointer(int size, unsigned int type, int stride, const void* pointer, unsigned int allocate) = 0; virtual void colorPointer(int size, unsigned int type, int stride, const void* pointer, unsigned int allocate) = 0; virtual void texCoordPointer(int size, unsigned int type, int stride, const void* pointer, unsigned int allocate) = 0; virtual void setShader(ShaderProgram* Shader); virtual void clip2DPlaneEnable(const Int32& x, const Int32& y, const Int32& Width, const Int32& Height) = 0; virtual void clip2DPlaneDisable() = 0; virtual void multMatrixf(const float* m) = 0; virtual void clipPlane(unsigned int plane, const double* equation) = 0; virtual void loadMatrixf(const float* m) = 0; virtual void frustum(float left, float right, float bottom, float top, float near_val, float far_val) = 0; virtual void getCurrentMatrix(unsigned int mode, float* m) = 0; virtual unsigned int getCurrentMatrixMode() = 0; void getViewport(int* viewport); virtual int project( float objx, float objy, float objz, const float modelMatrix[16], const float projMatrix[16], const int viewport[4], float* winx, float* winy, float* winz ) = 0; virtual int unProject( float winx, float winy, float winz, const float modelMatrix[16], const float projMatrix[16], const int viewport[4], float* objx, float* objy, float* objz ) = 0; Vector3f projectCurrent(const Vector3f& point); Vector3f unProjectCurrent(const Vector3f& point); void stencilFunc(unsigned int func, int ref, unsigned int mask); void stencilOp(unsigned int fail, unsigned int zfail, unsigned int zpass); void stencilMask(unsigned int mask); void colorMask(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha); void bindVertexArray(unsigned int array); void deleteVertexArrays(int n, const unsigned int* arrays); void genVertexArrays(int n, unsigned int* arrays); const bool& quadsSupported() const; const int& quadVertexs() const; ClippingMask* getClippingMask() const; void genFramebuffers(int n, unsigned int* framebuffers); void deleteFramebuffers(int n, const unsigned int* framebuffers); void bindFramebuffer(unsigned int target, unsigned int framebuffer); void framebufferTexture2D(unsigned int target, unsigned int attachment, unsigned int textarget, unsigned int texture, int level); void genRenderbuffers(int n, unsigned int* renderbuffers); void deleteRenderbuffers(int n, const unsigned int* renderbuffers); void bindRenderbuffer(unsigned int target, unsigned int renderbuffer); void renderbufferStorage(unsigned int target, unsigned int internalformat, int width, int height); void framebufferRenderbuffer(unsigned int target, unsigned int attachment, unsigned int renderbuffertarget, unsigned int renderbuffer); unsigned int checkFramebufferStatus(unsigned int target); void discardFramebuffer(unsigned int target, int numAttachments, const unsigned int* attachments); void* getProcAddress(std::string proc); void readPixels(int x, int y, unsigned int width, unsigned int height, void* pixels); Color readPixel(int x, int y); };
Detailed Documentation¶
This class is an abstraction of some OpenGL functionality. eepp has 4 different rendering pipelines: OpenGL 2, OpenGL 3, OpenGL 3 Core Profile and OpenGL ES 2. This abstraction is to encapsulate this pipelines. eepp implements its own state machine to simulate fixed-pipeline commands with OpenGL 3 and OpenGL ES 2. Most of the commands can be found in the OpenGL documentation. This is only useful for advanced users that want some control of the OpenGL pipeline. It’s mostly used internally by the engine.
Methods¶
static GraphicsLibraryVersion glVersionFromString(std::string glVersion)
Returns:
The graphic library renderer version from a string.
static std::string graphicsLibraryVersionToString(const GraphicsLibraryVersion& glVersion)
Returns:
Converts GralphicsLibraryVersion to a string
std::string getVendor()
Returns:
The company responsible for this GL implementation.
std::string getRenderer()
Returns:
The name of the renderer.
This name is typically specific to a particular configuration of a hardware platform.
std::string getVersion()
Returns:
A GL version or release number.
std::string getShadingLanguageVersion()
Returns:
The shading language version
bool isExtension(const std::string& name)
Returns:
If the extension passed is supported by the GPU
bool isExtension(GraphicsLibraryExtension name)
Returns:
If the extension from the EEGL_extensions is present on the GPU.
void lineSmooth()
Reapply the line smooth state
void polygonSmooth()
Reapply the polygon smooth state
void polygonMode(const PrimitiveFillMode& Mode)
Set the polygon fill mode ( wireframe or filled )
void polygonMode()
Reapply the polygon mode