14 #define GLM_FORCE_RADIANS 15 #include <glm/gtc/matrix_transform.hpp> 92 vertices[0].
texCoord[0] = texRect.x + texRect.width;
97 vertices[2].
texCoord[1] = texRect.y + texRect.height;
98 vertices[3].
texCoord[0] = texRect.x + texRect.width;
99 vertices[3].
texCoord[1] = texRect.y + texRect.height;
102 vertices[0].
texCoord[0] = texRect.x;
103 vertices[0].
texCoord[1] = texRect.y;
104 vertices[1].
texCoord[0] = texRect.x + texRect.width;
105 vertices[1].
texCoord[1] = texRect.y;
106 vertices[2].
texCoord[0] = texRect.x + texRect.width;
107 vertices[2].
texCoord[1] = texRect.y + texRect.height;
108 vertices[3].
texCoord[0] = texRect.x;
109 vertices[3].
texCoord[1] = texRect.y + texRect.height;
112 for (
u8 i = 0 ; i < 4 ; ++i) {
120 m_vbo.
setData(
sizeof(vertices), vertices, GL_DYNAMIC_DRAW);
130 glCheck(glDisable(GL_CULL_FACE));
131 glCheck(glDisable(GL_DEPTH_TEST));
133 static const GLubyte indices[] = {
void load(const Image &image)
static ResourceHandler & getInstance()
void draw(RenderTarget &target, RenderStates states) const override
Draw the object to a render target.
void setClipRect(float x, float y, u16 width, u16 height)
void updateVertexBuffer() const
T y
Top coordinate of the rectangle.
float a
Alpha (opacity) component.
Image living on the graphics card that can be used for drawing.
static void bind(const VertexBuffer *vertexBuffer)
const Texture * m_texture
u16 height() const
Return the height of the texture.
T x
Left coordinate of the rectangle.
u16 width() const
Return the width of the texture.
T width
Width of the rectangle.
void setData(GLsizeiptr size, const GLvoid *data, GLenum usage) const
void drawElements(const VertexBuffer &vertexBuffer, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, const RenderStates &states=RenderStates::Default)
T height
Height of the rectangle.
void setPosRect(float x, float y, u16 width, u16 height)