42 std::shared_ptr<Texture>
load_texture(
const std::string& file_path)
override;
44 std::shared_ptr<Texture>
get_texture(
const std::string& path)
override;
46 bool load_font(
const std::string& file_path,
const std::string& font_alias,
int font_size)
override;
55 const Rect2& src_rect,
int z_index,
56 bool flip_h,
bool flip_v,
const UberShader& uber_shader)
override;
58 void draw_rect(
Rect2 rect,
float rotation,
const glm::vec4& color,
bool filled,
int z_index)
override;
60 void draw_text(
const std::string& text,
float x,
float y,
float rotation,
float scale,
const glm::vec4& color,
61 const std::string& font_alias,
int z_index,
const UberShader& uber_shader,
int ft_size)
override;
63 void draw_line(
float x1,
float y1,
float x2,
float y2,
float width,
float rotation,
const glm::vec4& color,
int z_index)
override;
65 void draw_triangle(
float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float rotation,
const glm::vec4& color,
bool filled,
66 int z_index)
override;
68 void draw_circle(
float center_x,
float center_y,
float rotation,
float radius,
const glm::vec4& color,
bool filled,
int segments,
69 int z_index)
override;
71 void draw_polygon(
const std::vector<glm::vec2>& points,
float rotation,
const glm::vec4& color,
bool filled,
int z_index)
override;
73 void flush()
override;
77 void clear(glm::vec4 color)
override;
88 GLuint shader_program;
91 GLuint _fbo_vao,_fbo_vbo,_frame_buffer_object, _fbo_texture;
93 SDL_GLContext context =
nullptr;
95 void render_fbo()
override;
97 void set_effect_uniforms(
const UberShader& uber_shader,
const glm::vec2& texture_size = glm::vec2(1, 1))
override;
99 [[nodiscard]] glm::vec2 get_texture_size(Uint32 texture_id)
const override;
Opengl Renderer implementation.
Definition: ember_gl.h:25
void setup_shaders(Shader *default_shader, Shader *framebuffer_shader)
Definition: ember_gl.cpp:234
void flush() override
Submit all batched draw calls.
Definition: ember_gl.cpp:599
void draw_texture(const Texture *texture, const Rect2 &dest_rect, float rotation, const glm::vec4 &color, const Rect2 &src_rect, int z_index, bool flip_h, bool flip_v, const UberShader &uber_shader) override
Draw a textured quad.
Definition: ember_gl.cpp:559
std::shared_ptr< Texture > get_texture(const std::string &path) override
Get a previously loaded texture.
Definition: ember_gl.cpp:11
void draw_circle(float center_x, float center_y, float rotation, float radius, const glm::vec4 &color, bool filled, int segments, int z_index) override
Draw a circle.
Definition: ember_gl.cpp:148
void unload_font(const Font &font) override
Unload a loaded font.
Definition: ember_gl.cpp:750
void clear(glm::vec4 color) override
Clear the screen to the given color.
Definition: ember_gl.cpp:704
void unload_texture(Uint32 id) override
Unload a texture by its ID.
Definition: ember_gl.cpp:764
void draw_triangle(float x1, float y1, float x2, float y2, float x3, float y3, float rotation, const glm::vec4 &color, bool filled, int z_index) override
Draw a triangle.
Definition: ember_gl.cpp:124
OpenglRenderer()
Definition: ember_gl.cpp:5
void destroy() override
Destroy rendering resources.
Definition: ember_gl.cpp:374
~OpenglRenderer() override
void draw_polygon(const std::vector< glm::vec2 > &points, float rotation, const glm::vec4 &color, bool filled, int z_index) override
Draw a polygon.
Definition: ember_gl.cpp:193
bool load_font(const std::string &file_path, const std::string &font_alias, int font_size) override
Load a font.
Definition: ember_gl.cpp:481
Uint32 get_framebuffer_texture() const override
Definition: ember_gl.h:79
void draw_text(const std::string &text, float x, float y, float rotation, float scale, const glm::vec4 &color, const std::string &font_alias, int z_index, const UberShader &uber_shader, int ft_size) override
Draw text to screen.
Definition: ember_gl.cpp:36
void draw_rect(Rect2 rect, float rotation, const glm::vec4 &color, bool filled, int z_index) override
Draw a rectangle (filled or outlined).
Definition: ember_gl.cpp:29
std::shared_ptr< Texture > load_texture(const std::string &file_path) override
Load a texture from disk.
Definition: ember_gl.cpp:410
void initialize() override
Initialize the renderer and its resources.
Definition: ember_gl.cpp:242
void resize_viewport(int view_width, int view_height) override
Resize the rendering context.
Definition: ember_gl.cpp:333
void present() override
Swap buffers to present the rendered frame.
Definition: ember_gl.cpp:673
void draw_line(float x1, float y1, float x2, float y2, float width, float rotation, const glm::vec4 &color, int z_index) override
Draw a line.
Definition: ember_gl.cpp:96
void set_default_font(const std::string &font_name) override
Set the current font to use for rendering.
Definition: ember_gl.cpp:21
void * get_context() override
Get the platform-specific rendering context.
Definition: ember_gl.cpp:370
void set_context(const void *ctx) override
Set the platform-specific rendering context.
Definition: ember_gl.cpp:366
Opengl Shader implementation.
Definition: shader_gl.h:18
Base class for all renderers.
Definition: ember_core.h:109
Shader Abstract class.
Definition: shader.h:67
constexpr int MAX_INDICES
Definition: ember_gl.h:8
constexpr int MAX_QUADS
Definition: ember_gl.h:6
constexpr int MAX_TEXTURE_SLOTS
sampler2D (array) supported by platform DESKTOP - 32 WEBGL - 16 ANDROID - 32 IOS - 32
Definition: ember_gl.h:18
constexpr int MAX_VERTICES
Definition: ember_gl.h:7
Font struct.
Definition: engine_structs.h:137
Float rectangle struct.
Definition: engine_structs.h:33
Texture base class.
Definition: engine_structs.h:14
UberShader shader effects for rendering texts and sprites.
Definition: shader.h:8