.. index:: pair: class; EE::Graphics::Renderer .. _doxid-class_e_e_1_1_graphics_1_1_renderer: class EE::Graphics::Renderer ============================ .. toctree:: :hidden: enum_EE_Graphics_Renderer_PixelFormat.rst 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. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Renderer { public: // enums enum :ref:`PixelFormat`; // construction virtual :target:`~Renderer`(); // methods static :ref:`GraphicsLibraryVersion` :ref:`glVersionFromString`(std::string glVersion); static std::string :ref:`graphicsLibraryVersionToString`(const :ref:`GraphicsLibraryVersion`& glVersion); static :ref:`GraphicsLibraryVersion` :target:`getDefaultGraphicsLibraryVersion`(); static std::vector<:ref:`GraphicsLibraryVersion`> :target:`getAvailableGraphicsLibraryVersions`(); static Renderer* :target:`createSingleton`(:ref:`GraphicsLibraryVersion` ver); static Renderer* :target:`createSingleton`(); static Renderer* :target:`existsSingleton`(); static Renderer* :target:`instance`(); static void :target:`destroySingleton`(); virtual void :target:`init`(); std::string :ref:`getVendor`(); std::string :ref:`getRenderer`(); std::string :ref:`getVersion`(); std::string :ref:`getShadingLanguageVersion`(); bool :ref:`isExtension`(const std::string& name); bool :ref:`isExtension`(:ref:`GraphicsLibraryExtension` name); bool :target:`pointSpriteSupported`(); void :ref:`configurePointSprite`(); bool :target:`shadersSupported`(); void :target:`clear`(unsigned int mask); void :target:`clearColor`(float red, float green, float blue, float alpha); void :target:`scissor`(int x, int y, int width, int height); void :target:`polygonMode`(unsigned int face, unsigned int mode); std::string :target:`getExtensions`(); const char* :target:`getString`(unsigned int name); void :target:`drawArrays`(unsigned int mode, int first, int count); bool :ref:`drawSubpixelArrays`(unsigned int mode, int first, int count); bool :ref:`drawSubpixelFallbackArrays`(unsigned int mode, int first, int count); void :target:`drawElements`(unsigned int mode, int count, unsigned int type, const void* indices); void :target:`bindTexture`(unsigned int target, unsigned int texture); void :target:`activeTexture`(unsigned int texture); void :target:`clientActiveTextureImpl`(unsigned int texture); void :target:`blendFunc`(unsigned int sfactor, unsigned int dfactor); void :target:`blendFuncSeparate`(unsigned int sfactorRGB, unsigned int dfactorRGB, unsigned int sfactorAlpha, unsigned int dfactorAlpha); void :target:`blendEquationSeparate`(unsigned int modeRGB, unsigned int modeAlpha); bool :target:`bindFragDataLocationIndexed`(unsigned int program, unsigned int colorNumber, unsigned int index, const char* name); void :target:`blitFrameBuffer`( int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, unsigned int mask, unsigned int filter ); void :target:`viewport`(int x, int y, int width, int height); void :target:`lineSmooth`(const bool& enable); void :target:`lineWidth`(float width); void :ref:`lineSmooth`(); bool :target:`isLineSmooth`(); void :target:`polygonSmooth`(const bool& enable); void :ref:`polygonSmooth`(); bool :target:`isPolygonSmooth`(); void :ref:`polygonMode`(const :ref:`PrimitiveFillMode`& Mode); void :ref:`polygonMode`(); void :target:`pixelStorei`(unsigned int pname, int param); void :target:`multisample`(bool enable); bool :target:`isMultisample`(); :ref:`RendererGL`* :target:`getRendererGL`(); RendererGL3* :target:`getRendererGL3`(); RendererGL3CP* :target:`getRendererGL3CP`(); RendererGLES2* :target:`getRendererGLES2`(); virtual void :target:`pointSize`(float size) = 0; virtual float :target:`pointSize`() = 0; virtual void :target:`clientActiveTexture`(unsigned int texture) = 0; virtual void :target:`disable`(unsigned int cap); virtual void :target:`enable`(unsigned int cap); virtual void :ref:`onContextChanged`(); virtual :ref:`GraphicsLibraryVersion` :target:`version`() = 0; virtual std::string :target:`versionStr`() = 0; virtual void :target:`pushMatrix`() = 0; virtual void :target:`popMatrix`() = 0; virtual void :target:`loadIdentity`() = 0; virtual void :target:`translatef`(float x, float y, float z) = 0; virtual void :target:`rotatef`(float angle, float x, float y, float z) = 0; virtual void :target:`scalef`(float x, float y, float z) = 0; virtual void :target:`matrixMode`(unsigned int mode) = 0; virtual void :target:`ortho`(float left, float right, float bottom, float top, float zNear, float zFar) = 0; virtual void :target:`lookAt`( float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ ) = 0; virtual void :target:`perspective`(float fovy, float aspect, float zNear, float zFar) = 0; virtual void :target:`enableClientState`(unsigned int array) = 0; virtual void :target:`disableClientState`(unsigned int array) = 0; virtual void :target:`vertexPointer`(int size, unsigned int type, int stride, const void* pointer, unsigned int allocate) = 0; virtual void :target:`colorPointer`(int size, unsigned int type, int stride, const void* pointer, unsigned int allocate) = 0; virtual void :target:`texCoordPointer`(int size, unsigned int type, int stride, const void* pointer, unsigned int allocate) = 0; virtual void :target:`setShader`(:ref:`ShaderProgram`* Shader); virtual bool :ref:`setTextureColorMode`(:ref:`Int32` mode); virtual void :target:`clip2DPlaneEnable`(const :ref:`Int32`& x, const :ref:`Int32`& y, const :ref:`Int32`& Width, const :ref:`Int32`& Height) = 0; virtual void :target:`clip2DPlaneDisable`() = 0; virtual void :target:`multMatrixf`(const float* m) = 0; virtual void :target:`clipPlane`(unsigned int plane, const double* equation) = 0; virtual void :target:`loadMatrixf`(const float* m) = 0; virtual void :target:`frustum`(float left, float right, float bottom, float top, float near_val, float far_val) = 0; virtual void :target:`getCurrentMatrix`(unsigned int mode, float* m) = 0; virtual unsigned int :target:`getCurrentMatrixMode`() = 0; void :target:`getViewport`(int* viewport); virtual int :target:`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 :target:`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; :ref:`Vector3f` :target:`projectCurrent`(const :ref:`Vector3f`& point); :ref:`Vector3f` :target:`unProjectCurrent`(const :ref:`Vector3f`& point); void :target:`stencilFunc`(unsigned int func, int ref, unsigned int mask); void :target:`stencilOp`(unsigned int fail, unsigned int zfail, unsigned int zpass); void :target:`stencilMask`(unsigned int mask); void :target:`colorMask`(:ref:`Uint8` red, :ref:`Uint8` green, :ref:`Uint8` blue, :ref:`Uint8` alpha); void :target:`getColorMask`(:ref:`Uint8` mask[4]) const; void :target:`bindVertexArray`(unsigned int array); void :target:`deleteVertexArrays`(int n, const unsigned int* arrays); void :target:`genVertexArrays`(int n, unsigned int* arrays); void :target:`genBuffers`(int n, unsigned int* buffers); void :target:`deleteBuffers`(int n, const unsigned int* buffers); void :target:`bindBuffer`(unsigned int target, unsigned int buffer); void :target:`bufferData`(unsigned int target, :ref:`IntPtr` size, const void* data, unsigned int usage); void :target:`bufferSubData`(unsigned int target, :ref:`IntPtr` offset, :ref:`IntPtr` size, const void* data); void :target:`vertexAttribPointer`(unsigned int index, int size, unsigned int type, bool normalized, int stride, const void* pointer); void :target:`enableVertexAttribArray`(unsigned int index); void :target:`disableVertexAttribArray`(unsigned int index); unsigned int :target:`createShader`(unsigned int type); void :target:`deleteShader`(unsigned int shader); void :target:`shaderSource`(unsigned int shader, int count, const char*const* strings, const int* lengths); void :target:`compileShader`(unsigned int shader); void :target:`getShaderiv`(unsigned int shader, unsigned int pname, int* params); void :target:`getShaderInfoLog`(unsigned int shader, int maxLength, int* length, char* infoLog); unsigned int :target:`createProgram`(); void :target:`deleteProgram`(unsigned int program); void :target:`attachShader`(unsigned int program, unsigned int shader); void :target:`linkProgram`(unsigned int program); void :target:`useProgram`(unsigned int program); void :target:`getProgramiv`(unsigned int program, unsigned int pname, int* params); void :target:`getProgramInfoLog`(unsigned int program, int maxLength, int* length, char* infoLog); int :target:`getUniformLocation`(unsigned int program, const char* name); int :target:`getAttribLocation`(unsigned int program, const char* name); void :target:`uniform1i`(int location, int value); void :target:`uniform1f`(int location, float value); void :target:`uniform2fv`(int location, int count, const float* value); void :target:`uniform3fv`(int location, int count, const float* value); void :target:`uniform4f`(int location, float x, float y, float z, float w); void :target:`uniform4fv`(int location, int count, const float* value); void :target:`uniformMatrix4fv`(int location, int count, bool transpose, const float* value); void :target:`compressedTexImage2D`( unsigned int target, int level, unsigned int internalFormat, int width, int height, int border, int imageSize, const void* data ); void :target:`getCompressedTexImage`(unsigned int target, int level, void* pixels); bool :target:`quadsSupported`() const; int :target:`quadVertex`() const; :ref:`ClippingMask`* :target:`getClippingMask`() const; void :target:`genFramebuffers`(int n, unsigned int* framebuffers); void :target:`deleteFramebuffers`(int n, const unsigned int* framebuffers); void :target:`bindFramebuffer`(unsigned int target, unsigned int framebuffer); void :target:`framebufferTexture2D`(unsigned int target, unsigned int attachment, unsigned int textarget, unsigned int texture, int level); void :target:`genRenderbuffers`(int n, unsigned int* renderbuffers); void :target:`deleteRenderbuffers`(int n, const unsigned int* renderbuffers); void :target:`bindRenderbuffer`(unsigned int target, unsigned int renderbuffer); void :target:`renderbufferStorage`(unsigned int target, unsigned int internalformat, int width, int height); void :target:`framebufferRenderbuffer`(unsigned int target, unsigned int attachment, unsigned int renderbuffertarget, unsigned int renderbuffer); unsigned int :target:`checkFramebufferStatus`(unsigned int target); void :target:`discardFramebuffer`(unsigned int target, int numAttachments, const unsigned int* attachments); void* :target:`getProcAddress`(std::string proc); void :target:`readPixels`(int x, int y, unsigned int width, unsigned int height, void* pixels); bool :ref:`readPixels`( int x, int y, unsigned int width, unsigned int height, :ref:`PixelFormat` format, void* pixels, size_t stride ); :ref:`Color` :target:`readPixel`(int x, int y); void :target:`waitForIdle`(); }; .. _details-class_e_e_1_1_graphics_1_1_renderer: 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 ------- .. index:: pair: function; glVersionFromString .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a17f531dff8ea805a9199302a4857bbf3: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`GraphicsLibraryVersion` glVersionFromString(std::string glVersion) .. rubric:: Returns: The graphic library renderer version from a string. .. index:: pair: function; graphicsLibraryVersionToString .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a1d0e05c9ec52bcd6b6cc7fac755e4377: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string graphicsLibraryVersionToString(const :ref:`GraphicsLibraryVersion`& glVersion) .. rubric:: Returns: Converts GralphicsLibraryVersion to a string .. index:: pair: function; getVendor .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a93c54019cd702d19ed992be689ab8b4c: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getVendor() .. rubric:: Returns: The company responsible for this GL implementation. .. index:: pair: function; getRenderer .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a2aa60386bac762c414919b1aa1f687b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getRenderer() .. rubric:: Returns: The name of the renderer. This name is typically specific to a particular configuration of a hardware platform. .. index:: pair: function; getVersion .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a8dcb51a6fafa3b8c0184c6ea6720719e: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getVersion() .. rubric:: Returns: A GL version or release number. .. index:: pair: function; getShadingLanguageVersion .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a6b4429ceeb1c5f068f9800c1d77416d1: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getShadingLanguageVersion() .. rubric:: Returns: The shading language version .. index:: pair: function; isExtension .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a3faa5304288c4e2abc05938f044caae6: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isExtension(const std::string& name) .. rubric:: Returns: If the extension passed is supported by the GPU .. index:: pair: function; isExtension .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a10d67b4b524f6c85af6e28ab68a1d86a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isExtension(:ref:`GraphicsLibraryExtension` name) .. rubric:: Returns: If the extension from the EEGL_extensions is present on the GPU. .. index:: pair: function; configurePointSprite .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a67cfe0d35ff65608e8c4bc521be0b10b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void configurePointSprite() Configures point-sprite coordinate replacement when required by the active graphics API. .. index:: pair: function; drawSubpixelArrays .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a5fa52e91ad386bd91dbc04f84741597c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool drawSubpixelArrays(unsigned int mode, int first, int count) Draws an LCD coverage range into RGB independently and updates destination alpha. .. index:: pair: function; drawSubpixelFallbackArrays .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1ae5144c6e3222b767ffec4b83c18c21d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool drawSubpixelFallbackArrays(unsigned int mode, int first, int count) Draws an LCD coverage range as neutral grayscale using its mean coverage. .. index:: pair: function; lineSmooth .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a3f65a46c579a23ac29635db3f98dccb0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void lineSmooth() Reapply the line smooth state .. index:: pair: function; polygonSmooth .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1aba9ec0b8b6d38c07a446c3299f214e5c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void polygonSmooth() Reapply the polygon smooth state .. index:: pair: function; polygonMode .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a097cdab1c2d386eeddf1ce9efa70387d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void polygonMode(const :ref:`PrimitiveFillMode`& Mode) Set the polygon fill mode ( wireframe or filled ) .. index:: pair: function; polygonMode .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a1a3658ef74b2b9679b81866a8e23b693: .. ref-code-block:: cpp :class: doxyrest-title-code-block void polygonMode() Reapply the polygon mode .. index:: pair: function; onContextChanged .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a5bdb39c4301620df8c7e46d75b7ce0ce: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void onContextChanged() Reapplies renderer state cached outside OpenGL after changing the current context. .. index:: pair: function; setTextureColorMode .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a00e8d1561e077dc226e2e4c270872484: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool setTextureColorMode(:ref:`Int32` mode) Selects built-in texture sampling: normal RGBA (0), LCD R/G/B (1-3), or LCD mean (4). .. index:: pair: function; readPixels .. _doxid-class_e_e_1_1_graphics_1_1_renderer_1a81bc25f88e54501f4106b962c510c7a6: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool readPixels( int x, int y, unsigned int width, unsigned int height, :ref:`PixelFormat` format, void* pixels, size_t stride ) Reads a framebuffer rectangle into caller-owned storage. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Left coordinate of the rectangle. * - y - Bottom coordinate of the rectangle. * - width - Rectangle width in pixels. * - height - Rectangle height in pixels. * - format - Destination pixel format. * - pixels - Destination storage. * - stride - Destination row stride in bytes. .. rubric:: Returns: True if the arguments are valid and the pixels were read.