38inline constexpr GLuint
tint = 12;
103inline void debug_callback(GLenum source, GLenum type, GLuint
id, GLenum severity,
105 GLchar
const* message,
void const*) {
107 std::string source_str;
109 case GL_DEBUG_SOURCE_API:
110 source_str =
"OpenGL API call";
112 case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
113 source_str =
"Window system API";
115 case GL_DEBUG_SOURCE_SHADER_COMPILER:
116 source_str =
"Shading language compiler";
118 case GL_DEBUG_SOURCE_THIRD_PARTY:
119 source_str =
"Application associated with OpenGL";
121 case GL_DEBUG_SOURCE_APPLICATION:
122 source_str =
"User generated";
124 case GL_DEBUG_SOURCE_OTHER:
125 source_str =
"Unknown source";
130 std::string error_type;
132 case GL_DEBUG_TYPE_ERROR:
133 error_type =
"General error";
135 case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
136 error_type =
"Deprecated behavior";
138 case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
139 error_type =
"Undefined behavior";
141 case GL_DEBUG_TYPE_PORTABILITY:
142 error_type =
"Portability issue";
144 case GL_DEBUG_TYPE_PERFORMANCE:
145 error_type =
"Performance issue";
147 case GL_DEBUG_TYPE_MARKER:
148 error_type =
"Command stream annotation";
150 case GL_DEBUG_TYPE_PUSH_GROUP:
151 error_type =
"Error group push";
153 case GL_DEBUG_TYPE_POP_GROUP:
154 error_type =
"Error group pop";
156 case GL_DEBUG_TYPE_OTHER:
157 error_type =
"Uknown error type";
162 std::string severity_str;
164 case GL_DEBUG_SEVERITY_HIGH:
165 severity_str =
"High";
167 case GL_DEBUG_SEVERITY_MEDIUM:
168 severity_str =
"Medium";
170 case GL_DEBUG_SEVERITY_LOW:
171 severity_str =
"Low";
173 case GL_DEBUG_SEVERITY_NOTIFICATION:
174 severity_str =
"Notification";
179 std::string full_message(
"OpenGL error ");
180 full_message += std::to_string(
id);
182 full_message +=
"; Source: ";
183 full_message += source_str;
184 full_message +=
" ; Type: ";
185 full_message += error_type;
186 full_message +=
"; Severity: ";
187 full_message += severity_str;
188 full_message +=
"; ";
189 full_message += message;
190 full_message +=
"\n";
193 OutputDebugStringA(full_message.c_str());
195 printf(
"%s", full_message.c_str());
265GLuint
create_program(std::string_view vertex_shader, std::string_view fragment_shader);
271 float* buffer =
nullptr;
272 GLuint buffer_handle = 0;
273 bool pending_data_update =
true;
279 buffer =
new float[
count * 4];
283 : buffer(o.buffer), buffer_handle(o.buffer_handle), pending_data_update(o.pending_data_update),
count(o.count) {
289 buffer_handle = o.buffer_handle;
290 pending_data_update = o.pending_data_update;
299 void set_y(
float* v);
302void render_colored_rect(
sys::state const& state,
float x,
float y,
float width,
float height,
float red,
float green,
float blue,
ui::rotation r,
bool flipped,
bool rtl);
306 GLuint texture_handle,
ui::rotation r,
bool flipped,
bool rtl);
310void render_linegraph(
sys::state const& state,
color_modification enabled,
float x,
float y,
float width,
float height,
float r,
float g,
float b,
float a, lines& l);
312 data_texture& t,
ui::rotation r,
bool flipped,
bool rtl);
316 float height, GLuint texture_handle,
ui::rotation r,
bool flipped,
bool rtl);
318 GLuint texture_handle, GLuint mask_texture_handle,
ui::rotation r,
bool flipped,
bool rtl);
320 float height, GLuint left_texture_handle, GLuint right_texture_handle,
ui::rotation r,
bool flipped,
bool rtl);
322 GLuint texture_handle,
ui::rotation rot,
bool flipped,
bool rtl);
324 float width,
float height, GLuint texture_handle,
ui::rotation r,
bool flipped,
bool rtl);
326 float r,
float g,
float b,
ui::rotation rot,
bool flipped,
bool rtl);
328 float width,
float height,
float r,
float g,
float b, GLuint texture_handle,
ui::rotation rot,
bool flipped,
bool rtl);
332 color3f const& c, uint16_t font_id);
338 float x,
float y,
float w,
float h
342 float x,
float baseline_y,
353void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint filter, GLuint wrap);
360 GLuint framebuffer = 0;
361 GLuint texture_handle = 0;
373void render_subrect(
sys::state const& state,
float target_x,
float target_y,
float target_width,
float target_height,
float source_x,
float source_y,
float source_width,
float source_height, GLuint texture_handle);
388 decltype(std::chrono::steady_clock::now()) start_time;
389 int32_t ms_run_time = 0;
395 bool running =
false;
void start_animation(sys::state &state, int32_t x, int32_t y, int32_t w, int32_t h, type t, int32_t runtime)
void post_update_frame(sys::state &state)
void render(sys::state &state)
lines(lines &&o) noexcept
lines & operator=(lines &&o) noexcept
void ready(sys::state &state)
void finish(sys::state &state)
constexpr GLuint piechart
constexpr GLuint interactable
constexpr GLuint frame_stretch
constexpr GLuint no_filter
constexpr GLuint transparent_color
constexpr GLuint progress_bar
constexpr GLuint alpha_color
constexpr GLuint use_mask
constexpr GLuint screen_width
constexpr GLuint stripchart
constexpr GLuint linegraph_acolor
constexpr GLuint subsprite_b
constexpr GLuint barchart
constexpr GLuint inner_color
constexpr GLuint disabled
constexpr GLuint screen_height
constexpr GLuint drawing_rectangle
constexpr GLuint border_size
constexpr GLuint linegraph
constexpr GLuint subsprite_c
constexpr GLuint alternate_tint
constexpr GLuint interactable_disabled
constexpr GLuint border_filter
constexpr GLuint solid_color
constexpr GLuint sub_sprite
constexpr GLuint linegraph_color
void render_tinted_subsprite(sys::state const &state, int frame, int total_frames, float x, float y, float width, float height, float r, float g, float b, GLuint texture_handle, ui::rotation rot, bool flipped, bool rtl)
void initialize_opengl(sys::state &state)
GLuint make_gl_texture(uint8_t *data, uint32_t size_x, uint32_t size_y, uint32_t channels)
void create_opengl_context(sys::state &state)
void render_barchart(sys::state const &state, color_modification enabled, float x, float y, float width, float height, data_texture &t, ui::rotation r, bool flipped, bool rtl)
void initialize_msaa(sys::state &state, int32_t size_x, int32_t size_y)
void render_colored_rect(sys::state const &state, float x, float y, float width, float height, float red, float green, float blue, ui::rotation r, bool flipped, bool rtl)
bool msaa_enabled(sys::state const &state)
void load_shaders(sys::state &state)
void render_bordered_rect(sys::state const &state, color_modification enabled, float border_size, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_alpha_colored_rect(sys::state const &state, float x, float y, float width, float height, float red, float green, float blue, float alpha)
void render_piechart(sys::state const &state, color_modification enabled, float x, float y, float size, data_texture &t)
void render_masked_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, GLuint mask_texture_handle, ui::rotation r, bool flipped, bool rtl)
void load_global_squares(sys::state &state)
void deinitialize_msaa(sys::state &state)
void render_new_text(sys::state &state, text::stored_glyphs const &txt, color_modification enabled, float x, float y, float size, color3f const &c, text::font &f)
void render_text_commodity_icon(sys::state &state, text::embedded_commodity_icon ico, float x, float baseline_y, float font_size, text::font &f)
void render_subsprite(sys::state const &state, color_modification enabled, int frame, int total_frames, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_text(sys::state &state, text::stored_glyphs const &txt, color_modification enabled, float x, float y, color3f const &c, uint16_t font_id)
void render_linegraph(sys::state const &state, color_modification enabled, float x, float y, float width, float height, lines &l)
void render_text_flag(sys::state &state, text::embedded_flag ico, float x, float baseline_y, float font_size, text::font &f, ogl::color_modification cmod)
GLuint load_texture_array_from_file(simple_fs::file &file, int32_t tiles_x, int32_t tiles_y)
void render_simple_rect(sys::state const &state, float x, float y, float width, float height, ui::rotation r, bool flipped, bool rtl)
void render_subrect(sys::state const &state, float target_x, float target_y, float target_width, float target_height, float source_x, float source_y, float source_width, float source_height, GLuint texture_handle)
void shutdown_opengl(sys::state &state)
void debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei, GLchar const *message, void const *)
void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint filter, GLuint wrap)
void render_commodity_icon(sys::state &state, dcon::commodity_id cid, float x, float y, float w, float h)
image load_stb_image(simple_fs::file &file)
GLuint create_program(std::string_view vertex_shader, std::string_view fragment_shader)
void render_textured_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
bool display_tag_is_valid(sys::state &state, char tag[3])
void render_tinted_rect(sys::state const &state, float x, float y, float width, float height, float r, float g, float b, ui::rotation rot, bool flipped, bool rtl)
void render_stripchart(sys::state const &state, color_modification enabled, float x, float y, float sizex, float sizey, data_texture &t)
void render_text_icon(sys::state &state, text::embedded_icon ico, float x, float baseline_y, float font_size, text::font &f, ogl::color_modification cmod)
GLint compile_shader(std::string_view source, GLenum type)
void render_tinted_textured_rect(sys::state const &state, float x, float y, float width, float height, float r, float g, float b, GLuint texture_handle, ui::rotation rot, bool flipped, bool rtl)
void render_text_unit_icon(sys::state &state, text::embedded_unit_icon ico, float x, float baseline_y, float font_size, text::font &f, ogl::color_modification cmod)
void render_textured_rect_direct(sys::state const &state, float x, float y, float width, float height, uint32_t handle)
void notify_user_of_fatal_opengl_error(std::string message)
void render_progress_bar(sys::state const &state, color_modification enabled, float progress, float x, float y, float width, float height, GLuint left_texture_handle, GLuint right_texture_handle, ui::rotation r, bool flipped, bool rtl)
std::string_view native_string_view
GLuint global_square_flipped_buffer
GLuint color_blind_cross_icon_tex
GLuint ui_shader_screen_height_uniform
GLuint global_square_right_buffer
tagged_vector< texture, dcon::texture_id > asset_textures
GLuint checkmark_icon_tex
GLuint global_rtl_square_left_flipped_buffer
GLuint ui_shader_border_size_uniform
GLuint msaa_uniform_gaussian_blur
GLuint ui_shader_subroutines_index_uniform
GLuint ui_shader_inner_color_uniform
GLuint global_rtl_square_left_buffer
ankerl::unordered_dense::map< std::string, dcon::texture_id > late_loaded_map
GLuint ui_shader_d_rect_uniform
GLuint global_rtl_square_right_buffer
GLuint global_rtl_square_buffer
GLuint global_rtl_square_flipped_buffer
GLuint msaa_uniform_screen_size
GLuint msaa_shader_program
GLuint ui_shader_secondary_texture_sampler_uniform
GLuint sub_square_buffers[64]
GLuint global_square_left_flipped_buffer
GLuint global_square_left_buffer
GLuint ui_shader_screen_width_uniform
GLuint global_square_buffer
GLuint ui_shader_texture_sampler_uniform
GLuint ui_shader_subrect_uniform
GLuint global_square_right_flipped_buffer
GLuint ui_shader_gamma_uniform
GLuint global_rtl_square_right_flipped_buffer
GLuint msaa_texcolorbuffer
image(image &&other) noexcept
image & operator=(image &&other) noexcept
image(uint8_t *data, int32_t size_x, int32_t size_y, int32_t channels)
image & operator=(image const &other)=delete
image(image const &other)=delete
Holds important data about the game world, state, and other data regarding windowing,...