12 return "GL_INVALID_ENUM";
13 case GL_INVALID_VALUE:
14 return "GL_INVALID_VALUE";
15 case GL_INVALID_OPERATION:
16 return "GL_INVALID_OPERATION";
17 case GL_INVALID_FRAMEBUFFER_OPERATION:
18 return "GL_INVALID_FRAMEBUFFER_OPERATION";
19 case GL_OUT_OF_MEMORY:
20 return "GL_OUT_OF_MEMORY";
21 case GL_STACK_UNDERFLOW:
22 return "GL_STACK_UNDERFLOW";
23 case GL_STACK_OVERFLOW:
24 return "GL_STACK_OVERFLOW";
33 std::string full_message = message;
41 GLuint return_value = glCreateShader(type);
43 if(return_value == 0) {
47 std::string s_source(source);
48 GLchar
const* texts[] = {
50 "#extension GL_ARB_explicit_uniform_location : enable\r\n",
51 "#extension GL_ARB_explicit_attrib_location : enable\r\n",
52 "#extension GL_ARB_shader_subroutine : enable\r\n",
53 "#extension GL_ARB_vertex_array_object : enable\r\n"
54 "#define M_PI 3.1415926535897932384626433832795\r\n",
55 "#define PI 3.1415926535897932384626433832795\r\n",
58 glShaderSource(return_value, 7, texts,
nullptr);
59 glCompileShader(return_value);
62 glGetShaderiv(return_value, GL_COMPILE_STATUS, &result);
63 if(result == GL_FALSE) {
65 glGetShaderiv(return_value, GL_INFO_LOG_LENGTH, &log_length);
67 auto log = std::unique_ptr<char[]>(
new char[
static_cast<size_t>(log_length)]);
69 glGetShaderInfoLog(return_value, log_length, &written, log.get());
75GLuint
create_program(std::string_view vertex_shader, std::string_view fragment_shader) {
76 GLuint return_value = glCreateProgram();
77 if(return_value == 0) {
82 auto f_shader =
compile_shader(fragment_shader, GL_FRAGMENT_SHADER);
84 glAttachShader(return_value, v_shader);
85 glAttachShader(return_value, f_shader);
86 glLinkProgram(return_value);
89 glGetProgramiv(return_value, GL_LINK_STATUS, &result);
90 if(result == GL_FALSE) {
92 glGetProgramiv(return_value, GL_INFO_LOG_LENGTH, &logLen);
94 char* log =
new char[
static_cast<size_t>(logLen)];
96 glGetProgramInfoLog(return_value, logLen, &written, log);
100 glDeleteShader(v_shader);
101 glDeleteShader(f_shader);
107 auto root = get_root(state.common_fs);
160 case GL_FRAMEBUFFER_UNDEFINED:
161 return "GL_FRAMEBUFFER_UNDEFINED";
162 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
163 return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
164 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
165 return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT ";
166 case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
167 return "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER";
168 case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
169 return "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER";
170 case GL_FRAMEBUFFER_UNSUPPORTED:
171 return "GL_FRAMEBUFFER_UNSUPPORTED";
172 case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
173 return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
174 case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
175 return "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS";
183 if(state.user_settings.antialias_level == 0)
185 if(!size_x || !size_y)
187 glEnable(GL_MULTISAMPLE);
189 static const float sq_vertices[] = {
191 -1.0f, 1.0f, 0.0f, 1.0f,
192 -1.0f, -1.0f, 0.0f, 0.0f,
193 1.0f, -1.0f, 1.0f, 0.0f,
194 -1.0f, 1.0f, 0.0f, 1.0f,
195 1.0f, -1.0f, 1.0f, 0.0f,
196 1.0f, 1.0f, 1.0f, 1.0f
198 glGenVertexArrays(1, &state.open_gl.msaa_vao);
199 glGenBuffers(1, &state.open_gl.msaa_vbo);
200 glBindVertexArray(state.open_gl.msaa_vao);
201 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.msaa_vbo);
202 glBufferData(GL_ARRAY_BUFFER,
sizeof(sq_vertices), &sq_vertices, GL_STATIC_DRAW);
203 glEnableVertexAttribArray(0);
204 glEnableVertexAttribArray(1);
205 glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 *
sizeof(
float), (
void*)0);
206 glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 *
sizeof(
float), (
void*)(2 *
sizeof(
float)));
208 glGenFramebuffers(1, &state.open_gl.msaa_framebuffer);
209 glBindFramebuffer(GL_FRAMEBUFFER, state.open_gl.msaa_framebuffer);
211 glGenTextures(1, &state.open_gl.msaa_texcolorbuffer);
212 glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, state.open_gl.msaa_texcolorbuffer);
213 glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, GLsizei(state.user_settings.antialias_level), GL_RGBA, size_x, size_y, GL_TRUE);
214 glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
215 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, state.open_gl.msaa_texcolorbuffer, 0);
217 glGenRenderbuffers(1, &state.open_gl.msaa_rbo);
218 glBindRenderbuffer(GL_RENDERBUFFER, state.open_gl.msaa_rbo);
219 glRenderbufferStorageMultisample(GL_RENDERBUFFER, GLsizei(state.user_settings.antialias_level), GL_DEPTH24_STENCIL8, size_x, size_y);
220 glBindRenderbuffer(GL_RENDERBUFFER, 0);
221 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, state.open_gl.msaa_rbo);
222 if(
auto r = glCheckFramebufferStatus(GL_FRAMEBUFFER); r != GL_FRAMEBUFFER_COMPLETE) {
224 state.user_settings.antialias_level--;
226 if(state.user_settings.antialias_level != 0) {
229 state.open_gl.msaa_enabled =
false;
234 glGenFramebuffers(1, &state.open_gl.msaa_interbuffer);
235 glBindFramebuffer(GL_FRAMEBUFFER, state.open_gl.msaa_interbuffer);
237 glGenTextures(1, &state.open_gl.msaa_texture);
238 glBindTexture(GL_TEXTURE_2D, state.open_gl.msaa_texture);
239 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_x, size_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
240 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
241 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
242 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, state.open_gl.msaa_texture, 0);
243 if(
auto r = glCheckFramebufferStatus(GL_FRAMEBUFFER); r != GL_FRAMEBUFFER_COMPLETE) {
246 glBindFramebuffer(GL_FRAMEBUFFER, 0);
248 auto root = get_root(state.common_fs);
249 auto msaa_fshader = open_file(root,
NATIVE(
"assets/shaders/glsl/msaa_f_shader.glsl"));
250 auto msaa_vshader = open_file(root,
NATIVE(
"assets/shaders/glsl/msaa_v_shader.glsl"));
251 if(
bool(msaa_fshader) &&
bool(msaa_vshader)) {
252 auto vertex_content = view_contents(*msaa_vshader);
253 auto fragment_content = view_contents(*msaa_fshader);
254 state.open_gl.msaa_shader_program =
create_program(std::string_view(vertex_content.data, vertex_content.file_size), std::string_view(fragment_content.data, fragment_content.file_size));
255 state.open_gl.msaa_uniform_screen_size = glGetUniformLocation(state.open_gl.msaa_shader_program,
"screen_size");
256 state.open_gl.msaa_uniform_gaussian_blur = glGetUniformLocation(state.open_gl.msaa_shader_program,
"gaussian_radius");
260 state.open_gl.msaa_enabled =
true;
265 if(!state.open_gl.msaa_enabled)
268 state.open_gl.msaa_enabled =
false;
269 if(state.open_gl.msaa_texture)
270 glDeleteTextures(1, &state.open_gl.msaa_texture);
271 if(state.open_gl.msaa_interbuffer)
272 glDeleteFramebuffers(1, &state.open_gl.msaa_framebuffer);
273 if(state.open_gl.msaa_rbo)
274 glDeleteRenderbuffers(1, &state.open_gl.msaa_rbo);
275 if(state.open_gl.msaa_texcolorbuffer)
276 glDeleteTextures(1, &state.open_gl.msaa_texcolorbuffer);
277 if(state.open_gl.msaa_framebuffer)
278 glDeleteFramebuffers(1, &state.open_gl.msaa_framebuffer);
279 if(state.open_gl.msaa_vbo)
280 glDeleteBuffers(1, &state.open_gl.msaa_vbo);
281 if(state.open_gl.msaa_vao)
282 glDeleteVertexArrays(1, &state.open_gl.msaa_vao);
283 if(state.open_gl.msaa_shader_program)
284 glDeleteProgram(state.open_gl.msaa_shader_program);
285 glDisable(GL_MULTISAMPLE);
291 glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
292 glEnable(GL_LINE_SMOOTH);
299 state.world.for_each_national_identity([&](dcon::national_identity_id ident_id) {
301 auto nat_id = fat_id.get_nation_from_identity_holder().id;
302 for(
auto gov_id : state.world.in_government_type) {
307 std::sort(state.flag_types.begin(), state.flag_types.end());
308 state.flag_types.erase(std::unique(state.flag_types.begin(), state.flag_types.end()), state.flag_types.end());
312 for(
auto type : state.flag_types)
314 assert(state.flag_type_map[0] == 0);
317 state.open_gl.asset_textures.resize(
318 state.ui_defs.textures.size() + (state.world.national_identity_size() + 1) * state.flag_types.size());
320 state.map_state.load_map(state);
327static const GLfloat global_square_data[] = {
328 0.0f, 0.0f, 0.0f, 0.0f,
329 0.0f, 1.0f, 0.0f, 1.0f,
330 1.0f, 1.0f, 1.0f, 1.0f,
331 1.0f, 0.0f, 1.0f, 0.0f
333static const GLfloat global_square_right_data[] = {
334 0.0f, 0.0f, 0.0f, 1.0f,
335 0.0f, 1.0f, 1.0f, 1.0f,
336 1.0f, 1.0f, 1.0f, 0.0f,
337 1.0f, 0.0f, 0.0f, 0.0f
339static const GLfloat global_square_left_data[] = {
340 0.0f, 0.0f, 1.0f, 0.0f,
341 0.0f, 1.0f, 0.0f, 0.0f,
342 1.0f, 1.0f, 0.0f, 1.0f,
343 1.0f, 0.0f, 1.0f, 1.0f
345static const GLfloat global_square_flipped_data[] = {
346 0.0f, 0.0f, 0.0f, 1.0f,
347 0.0f, 1.0f, 0.0f, 0.0f,
348 1.0f, 1.0f, 1.0f, 0.0f,
349 1.0f, 0.0f, 1.0f, 1.0f
351static const GLfloat global_square_right_flipped_data[] = {
352 0.0f, 0.0f, 0.0f, 0.0f,
353 0.0f, 1.0f, 1.0f, 0.0f,
354 1.0f, 1.0f, 1.0f, 1.0f,
355 1.0f, 0.0f, 0.0f, 1.0f
357static const GLfloat global_square_left_flipped_data[] = {
358 0.0f, 0.0f, 1.0f, 1.0f,
359 0.0f, 1.0f, 0.0f, 1.0f,
360 1.0f, 1.0f, 0.0f, 0.0f,
361 1.0f, 0.0f, 1.0f, 0.0f
365static const GLfloat global_rtl_square_data[] = {
366 0.0f, 0.0f, 1.0f, 0.0f,
367 0.0f, 1.0f, 1.0f, 1.0f,
368 1.0f, 1.0f, 0.0f, 1.0f,
369 1.0f, 0.0f, 0.0f, 0.0f
371static const GLfloat global_rtl_square_right_data[] = {
372 0.0f, 1.0f, 1.0f, 0.0f,
373 0.0f, 0.0f, 0.0f, 0.0f,
374 1.0f, 0.0f, 0.0f, 1.0f,
375 1.0f, 1.0f, 1.0f, 1.0f
377static const GLfloat global_rtl_square_left_data[] = {
378 0.0f, 0.0f, 0.0f, 0.0f,
379 0.0f, 1.0f, 1.0f, 0.0f,
380 1.0f, 1.0f, 1.0f, 1.0f,
381 1.0f, 0.0f, 0.0f, 1.0f
383static const GLfloat global_rtl_square_flipped_data[] = {
384 0.0f, 0.0f, 1.0f, 1.0f,
385 0.0f, 1.0f, 1.0f, 0.0f,
386 1.0f, 1.0f, 0.0f, 0.0f,
387 1.0f, 0.0f, 0.0f, 1.0f
389static const GLfloat global_rtl_square_right_flipped_data[] = {
390 0.0f, 0.0f, 1.0f, 0.0f,
391 0.0f, 1.0f, 0.0f, 0.0f,
392 1.0f, 1.0f, 0.0f, 1.0f,
393 1.0f, 0.0f, 1.0f, 1.0f
395static const GLfloat global_rtl_square_left_flipped_data[] = {
396 0.0f, 0.0f, 0.0f, 1.0f,
397 0.0f, 1.0f, 1.0f, 1.0f,
398 1.0f, 1.0f, 1.0f, 0.0f,
399 1.0f, 0.0f, 0.0f, 0.0f
403 auto root = get_root(state.common_fs);
404 auto ui_fshader = open_file(root,
NATIVE(
"assets/shaders/glsl/ui_f_shader.glsl"));
405 auto ui_vshader = open_file(root,
NATIVE(
"assets/shaders/glsl/ui_v_shader.glsl"));
406 if(
bool(ui_fshader) &&
bool(ui_vshader)) {
407 auto vertex_content = view_contents(*ui_vshader);
408 auto fragment_content = view_contents(*ui_fshader);
409 state.open_gl.ui_shader_program =
create_program(std::string_view(vertex_content.data, vertex_content.file_size), std::string_view(fragment_content.data, fragment_content.file_size));
411 state.open_gl.ui_shader_texture_sampler_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"texture_sampler");
412 state.open_gl.ui_shader_secondary_texture_sampler_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"secondary_texture_sampler");
413 state.open_gl.ui_shader_screen_width_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"screen_width");
414 state.open_gl.ui_shader_screen_height_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"screen_height");
415 state.open_gl.ui_shader_gamma_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"gamma");
417 state.open_gl.ui_shader_d_rect_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"d_rect");
418 state.open_gl.ui_shader_subroutines_index_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"subroutines_index");
419 state.open_gl.ui_shader_inner_color_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"inner_color");
420 state.open_gl.ui_shader_subrect_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"subrect");
421 state.open_gl.ui_shader_border_size_uniform = glGetUniformLocation(state.open_gl.ui_shader_program,
"border_size");
429 glGenBuffers(1, &state.open_gl.global_square_buffer);
430 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_square_buffer);
431 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_square_data, GL_STATIC_DRAW);
433 glGenBuffers(1, &state.open_gl.global_rtl_square_buffer);
434 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_rtl_square_buffer);
435 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_rtl_square_data, GL_STATIC_DRAW);
437 glGenVertexArrays(1, &state.open_gl.global_square_vao);
438 glBindVertexArray(state.open_gl.global_square_vao);
439 glEnableVertexAttribArray(0);
440 glEnableVertexAttribArray(1);
442 glBindVertexBuffer(0, state.open_gl.global_square_buffer, 0,
sizeof(GLfloat) * 4);
444 glVertexAttribFormat(0, 2, GL_FLOAT, GL_FALSE, 0);
445 glVertexAttribFormat(1, 2, GL_FLOAT, GL_FALSE,
sizeof(GLfloat) * 2);
446 glVertexAttribBinding(0, 0);
447 glVertexAttribBinding(1, 0);
449 glGenBuffers(1, &state.open_gl.global_square_left_buffer);
450 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_square_left_buffer);
451 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_square_left_data, GL_STATIC_DRAW);
453 glGenBuffers(1, &state.open_gl.global_square_right_buffer);
454 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_square_right_buffer);
455 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_square_right_data, GL_STATIC_DRAW);
457 glGenBuffers(1, &state.open_gl.global_square_right_flipped_buffer);
458 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_square_right_flipped_buffer);
459 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_square_right_flipped_data, GL_STATIC_DRAW);
461 glGenBuffers(1, &state.open_gl.global_square_left_flipped_buffer);
462 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_square_left_flipped_buffer);
463 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_square_left_flipped_data, GL_STATIC_DRAW);
465 glGenBuffers(1, &state.open_gl.global_square_flipped_buffer);
466 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_square_flipped_buffer);
467 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_square_flipped_data, GL_STATIC_DRAW);
470 glGenBuffers(1, &state.open_gl.global_rtl_square_left_buffer);
471 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_rtl_square_left_buffer);
472 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_rtl_square_left_data, GL_STATIC_DRAW);
474 glGenBuffers(1, &state.open_gl.global_rtl_square_right_buffer);
475 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_rtl_square_right_buffer);
476 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_rtl_square_right_data, GL_STATIC_DRAW);
478 glGenBuffers(1, &state.open_gl.global_rtl_square_right_flipped_buffer);
479 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_rtl_square_right_flipped_buffer);
480 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_rtl_square_right_flipped_data, GL_STATIC_DRAW);
482 glGenBuffers(1, &state.open_gl.global_rtl_square_left_flipped_buffer);
483 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_rtl_square_left_flipped_buffer);
484 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_rtl_square_left_flipped_data, GL_STATIC_DRAW);
486 glGenBuffers(1, &state.open_gl.global_rtl_square_flipped_buffer);
487 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.global_rtl_square_flipped_buffer);
488 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_rtl_square_flipped_data, GL_STATIC_DRAW);
490 glGenBuffers(64, state.open_gl.sub_square_buffers);
492 glBindBuffer(GL_ARRAY_BUFFER, state.open_gl.sub_square_buffers[i]);
494 float const cell_x =
static_cast<float>(i & 7) / 8.0f;
495 float const cell_y =
static_cast<float>((i >> 3) & 7) / 8.0f;
497 GLfloat global_sub_square_data[] = {0.0f, 0.0f, cell_x, cell_y, 0.0f, 1.0f, cell_x, cell_y + 1.0f / 8.0f, 1.0f, 1.0f,
498 cell_x + 1.0f / 8.0f, cell_y + 1.0f / 8.0f, 1.0f, 0.0f, cell_x + 1.0f / 8.0f, cell_y};
500 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) * 16, global_sub_square_data, GL_STATIC_DRAW);
522 glBindVertexBuffer(0, rtl ? state.open_gl.global_rtl_square_buffer : state.open_gl.global_square_buffer, 0,
sizeof(GLfloat) * 4);
524 glBindVertexBuffer(0, rtl ? state.open_gl.global_rtl_square_flipped_buffer : state.open_gl.global_square_flipped_buffer, 0,
sizeof(GLfloat) * 4);
528 glBindVertexBuffer(0, rtl ? state.open_gl.global_rtl_square_left_buffer: state.open_gl.global_square_left_buffer, 0,
sizeof(GLfloat) * 4);
530 glBindVertexBuffer(0, rtl ? state.open_gl.global_rtl_square_left_flipped_buffer : state.open_gl.global_square_left_flipped_buffer, 0,
sizeof(GLfloat) * 4);
534 glBindVertexBuffer(0, rtl ? state.open_gl.global_rtl_square_right_buffer : state.open_gl.global_square_right_buffer, 0,
sizeof(GLfloat) * 4);
536 glBindVertexBuffer(0, rtl ? state.open_gl.global_rtl_square_right_flipped_buffer : state.open_gl.global_square_right_flipped_buffer, 0,
sizeof(GLfloat) * 4);
542 glBindVertexArray(state.open_gl.global_square_vao);
544 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
546 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
549 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 1.f, 0.f, 0.f);
550 glDrawArrays(GL_LINE_STRIP, 0, 4);
554 GLuint texture_handle,
ui::rotation r,
bool flipped,
bool rtl) {
555 glBindVertexArray(state.open_gl.global_square_vao);
559 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
562 glActiveTexture(GL_TEXTURE0);
563 glBindTexture(GL_TEXTURE_2D, texture_handle);
566 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
569 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
573 glBindVertexArray(state.open_gl.global_square_vao);
575 glBindVertexBuffer(0, state.open_gl.global_square_buffer, 0,
sizeof(GLfloat) * 4);
577 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
579 glActiveTexture(GL_TEXTURE0);
580 glBindTexture(GL_TEXTURE_2D, handle);
583 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
586 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
591 glBindVertexArray(state.open_gl.global_square_vao);
595 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
597 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
603 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 0.f, 0.f, 0.f);
604 glDrawArrays(GL_LINE_STRIP, 0,
static_cast<GLsizei
>(l.
count));
608 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 0.f, 0.f, 0.f);
610 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 1.f, 1.f, 0.f);
612 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 1.f, 1.f, 1.f);
614 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 1.f, 1.f, 0.f);
616 glDrawArrays(GL_LINE_STRIP, 0,
static_cast<GLsizei
>(l.
count));
621 glBindVertexArray(state.open_gl.global_square_vao);
625 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
627 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
633 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, 0.f, 0.f, 0.f);
634 glDrawArrays(GL_LINE_STRIP, 0,
static_cast<GLsizei
>(l.
count));
637 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, r, g, b);
638 glDrawArrays(GL_LINE_STRIP, 0,
static_cast<GLsizei
>(l.
count));
643 glBindVertexArray(state.open_gl.global_square_vao);
647 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
649 glActiveTexture(GL_TEXTURE0);
650 glBindTexture(GL_TEXTURE_2D, t.
handle());
653 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
656 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
660 glBindVertexArray(state.open_gl.global_square_vao);
662 glBindVertexBuffer(0, state.open_gl.global_square_buffer, 0,
sizeof(GLfloat) * 4);
664 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, size, size);
666 glActiveTexture(GL_TEXTURE0);
667 glBindTexture(GL_TEXTURE_2D, t.
handle());
670 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
673 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
677 float height, GLuint texture_handle,
ui::rotation r,
bool flipped,
bool rtl) {
678 glBindVertexArray(state.open_gl.global_square_vao);
682 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
683 glUniform1f(state.open_gl.ui_shader_border_size_uniform, border_size);
685 glActiveTexture(GL_TEXTURE0);
686 glBindTexture(GL_TEXTURE_2D, texture_handle);
689 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
692 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
696 GLuint texture_handle, GLuint mask_texture_handle,
ui::rotation r,
bool flipped,
bool rtl) {
697 glBindVertexArray(state.open_gl.global_square_vao);
701 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
703 glActiveTexture(GL_TEXTURE0);
704 glBindTexture(GL_TEXTURE_2D, texture_handle);
705 glActiveTexture(GL_TEXTURE1);
706 glBindTexture(GL_TEXTURE_2D, mask_texture_handle);
709 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
712 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
716 float height, GLuint left_texture_handle, GLuint right_texture_handle,
ui::rotation r,
bool flipped,
bool rtl) {
717 glBindVertexArray(state.open_gl.global_square_vao);
721 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
722 glUniform1f(state.open_gl.ui_shader_border_size_uniform, progress);
724 glActiveTexture(GL_TEXTURE0);
725 glBindTexture(GL_TEXTURE_2D, left_texture_handle);
726 glActiveTexture(GL_TEXTURE1);
727 glBindTexture(GL_TEXTURE_2D, right_texture_handle);
730 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
733 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
737 GLuint texture_handle,
ui::rotation rot,
bool flipped,
bool rtl) {
738 glBindVertexArray(state.open_gl.global_square_vao);
742 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, r, g, b);
743 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
745 glActiveTexture(GL_TEXTURE0);
746 glBindTexture(GL_TEXTURE_2D, texture_handle);
749 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
752 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
757 float x,
float y,
float width,
float height,
758 float r,
float g,
float b,
761 glBindVertexArray(state.open_gl.global_square_vao);
763 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, r, g, b);
764 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
766 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
767 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
771 float width,
float height,
float r,
float g,
float b, GLuint texture_handle,
ui::rotation rot,
bool flipped,
773 glBindVertexArray(state.open_gl.global_square_vao);
777 auto const scale = 1.0f /
static_cast<float>(total_frames);
778 glUniform3f(state.open_gl.ui_shader_inner_color_uniform,
static_cast<float>(frame) * scale, scale, 0.0f);
779 glUniform4f(state.open_gl.ui_shader_subrect_uniform, r, g, b, 0);
780 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
782 glActiveTexture(GL_TEXTURE0);
783 glBindTexture(GL_TEXTURE_2D, texture_handle);
786 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
789 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
793 float width,
float height, GLuint texture_handle,
ui::rotation r,
bool flipped,
bool rtl) {
794 glBindVertexArray(state.open_gl.global_square_vao);
798 auto const scale = 1.0f /
static_cast<float>(total_frames);
799 glUniform3f(state.open_gl.ui_shader_inner_color_uniform,
static_cast<float>(frame) * scale, scale, 0.0f);
800 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, y, width, height);
802 glActiveTexture(GL_TEXTURE0);
803 glBindTexture(GL_TEXTURE_2D, texture_handle);
806 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
809 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
815 ltag[0] = char(toupper(tag[0]));
816 ltag[1] = char(toupper(tag[1]));
817 ltag[2] = char(toupper(tag[2]));
818 dcon::national_identity_id
ident{};
819 state.world.for_each_national_identity([&](dcon::national_identity_id
id) {
821 if(curr[0] == ltag[0] && curr[1] == ltag[1] && curr[2] == ltag[2]) {
830 auto nation = fat_id.get_nation_from_identity_holder();
832 if(
bool(nation.id) && nation.get_owned_province_count() != 0) {
841 tag[0] = char(toupper(tag[0]));
842 tag[1] = char(toupper(tag[1]));
843 tag[2] = char(toupper(tag[2]));
844 dcon::national_identity_id
ident{};
845 state.world.for_each_national_identity([&](dcon::national_identity_id
id) {
847 if(curr[0] == tag[0] && curr[1] == tag[1] && curr[2] == tag[2])
855 float icon_baseline = baseline_y + (f.
internal_ascender / 64.f * font_size) - font_size;
858 glActiveTexture(GL_TEXTURE0);
863 glBindTexture(GL_TEXTURE_2D, state.open_gl.army_icon_tex );
866 glBindTexture(GL_TEXTURE_2D, state.open_gl.navy_icon_tex);
870 glBindTexture(GL_TEXTURE_2D, state.open_gl.checkmark_icon_tex);
871 icon_baseline += font_size * 0.1f;
876 ? state.open_gl.color_blind_cross_icon_tex
877 : state.open_gl.cross_icon_tex;
878 glBindTexture(GL_TEXTURE_2D, false_icon);
879 icon_baseline += font_size * 0.1f;
885 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, icon_subroutines[0], icon_subroutines[1]);
887 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, icon_baseline, scale * font_size, scale * font_size);
888 glUniform4f(state.open_gl.ui_shader_subrect_uniform, 0.f, 1.f, 0.f, 1.f);
889 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
893 float icon_baseline = baseline_y + (f.
internal_ascender / 64.f * font_size) - font_size;
896 auto nation = fat_id.get_nation_from_identity_holder();
898 if(
bool(nation.id) && nation.get_owned_province_count() != 0) {
906 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, icon_subroutines[0], icon_subroutines[1]);
909 glActiveTexture(GL_TEXTURE0);
910 glBindTexture(GL_TEXTURE_2D, flag_texture_handle);
911 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x, icon_baseline + font_size * 0.15f, 1.5f * font_size * 0.9f, font_size * 0.9f);
912 glUniform4f(state.open_gl.ui_shader_subrect_uniform, 0.f, 1.f, 0.f, 1.f);
913 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
917 float icon_baseline = baseline_y + (f.
internal_ascender / 64.f * font_size) - font_size;
923 state.ui_state.defs_by_name.find(
924 state.lookup_key(
"gfx_storage_unit_types")
926 ].data.image.gfx_object;
928 auto& gfx_def = state.ui_defs.gfx[gfx_id];
930 auto frame = state.military_definitions.unit_base_definitions[
id].icon - 1;
936 gfx_def.number_of_frames,
943 gfx_def.is_vertically_flipped(),
950 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
953 unsigned int glyph_count =
static_cast<unsigned int>(txt.
glyph_info.size());
954 for(
unsigned int i = 0; i < glyph_count; i++) {
955 hb_codepoint_t glyphid = txt.
glyph_info[i].codepoint;
960 glBindVertexBuffer(0, state.open_gl.sub_square_buffers[gso.texture_slot & 63], 0,
sizeof(GLfloat) * 4);
963 glActiveTexture(GL_TEXTURE0);
964 glBindTexture(GL_TEXTURE_2D, f.
textures[gso.texture_slot >> 6]);
965 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, x + x_offset * size / 64.f, baseline_y + y_offset * size / 64.f, size, size);
966 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
967 x += x_advance * size / 64.f;
973 std::string codepoints =
"";
975 codepoints.push_back(
char(txt.
glyph_info[i].codepoint));
979 float adv = 1.0f / font.
width;
982 glUniform2ui(state.open_gl.ui_shader_subroutines_index_uniform, subroutines[0], subroutines[1]);
997 glActiveTexture(GL_TEXTURE0);
998 glBindTexture(GL_TEXTURE_2D, font.
ftexid);
1000 for(
uint32_t i = 0; i < count; ++i) {
1002 if(i != 0 && i < count - 1 && ch == 0xC2 &&
uint8_t(codepoints[i + 1]) == 0xA3) {
1005 }
else if(ch == 0xA4) {
1008 auto const& f = font.
chars[ch];
1009 float CurX = x + f.x_offset;
1010 float CurY = y + f.y_offset;
1011 glUniform4f(state.open_gl.ui_shader_d_rect_uniform, CurX, CurY,
float(f.width),
float(f.height));
1012 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, c.
r, c.
g, c.
b);
1013 glUniform4f(state.open_gl.ui_shader_subrect_uniform,
float(f.x) /
float(font.
width) ,
1014 float(f.width) /
float(font.
width) ,
float(f.y) /
float(font.
width) ,
1015 float(f.height) /
float(font.
width)
1017 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
1024 glUniform3f(state.open_gl.ui_shader_inner_color_uniform, c.
r, c.
g, c.
b);
1025 glUniform1f(state.open_gl.ui_shader_border_size_uniform, 0.08f * 16.0f / size);
1031 if(state.user_settings.use_classic_fonts) {
1039 for(int32_t i = 0; i < static_cast<int32_t>(
count); ++i) {
1040 buffer[i * 4] =
static_cast<float>(i) /
static_cast<float>(
count - 1);
1041 buffer[i * 4 + 1] = 1.0f - v[i];
1042 buffer[i * 4 + 2] = 0.5f;
1043 buffer[i * 4 + 3] = v[i];
1045 pending_data_update =
true;
1049 for(int32_t i = 0; i < static_cast<int32_t>(
count); ++i) {
1050 buffer[i * 4] =
static_cast<float>(i) /
static_cast<float>(
count - 1);
1051 buffer[i * 4 + 1] = 0.5f;
1052 buffer[i * 4 + 2] = 0.5f;
1053 buffer[i * 4 + 3] = 0.5f;
1055 pending_data_update =
true;
1059 if(buffer_handle == 0) {
1060 glGenBuffers(1, &buffer_handle);
1062 glBindBuffer(GL_ARRAY_BUFFER, buffer_handle);
1063 glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat) *
count * 4,
nullptr, GL_DYNAMIC_DRAW);
1065 if(buffer && pending_data_update) {
1066 glBindBuffer(GL_ARRAY_BUFFER, buffer_handle);
1067 glBufferSubData(GL_ARRAY_BUFFER, 0,
sizeof(GLfloat) *
count * 4, buffer);
1068 pending_data_update =
false;
1071 glBindVertexBuffer(0, buffer_handle, 0,
sizeof(GLfloat) * 4);
1075 return state.open_gl.msaa_enabled;
1079 int32_t file_channels = 4;
1083 auto data = stbi_load_from_memory(
reinterpret_cast<uint8_t const*
>(content.data), int32_t(content.file_size), &size_x, &size_y, &file_channels, 4);
1088 GLuint texture_handle;
1089 glGenTextures(1, &texture_handle);
1090 const GLuint internalformats[] = { GL_R8, GL_RG8, GL_RGB8, GL_RGBA8 };
1091 const GLuint formats[] = { GL_RED, GL_RG, GL_RGB, GL_RGBA };
1092 if(texture_handle) {
1093 glBindTexture(GL_TEXTURE_2D, texture_handle);
1094 glTexStorage2D(GL_TEXTURE_2D, 1, internalformats[channels - 1], size_x, size_y);
1095 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size_x, size_y, formats[channels - 1], GL_UNSIGNED_BYTE,
data);
1096 glBindTexture(GL_TEXTURE_2D, 0);
1099 return texture_handle;
1102 auto file = open_file(dir, file_name);
1110 glBindTexture(texture_type, texture_handle);
1111 if(filter == GL_LINEAR_MIPMAP_NEAREST || filter == GL_LINEAR_MIPMAP_LINEAR) {
1112 glTexParameteri(texture_type, GL_TEXTURE_MIN_FILTER, filter);
1113 glTexParameteri(texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1114 glGenerateMipmap(texture_type);
1116 glTexParameteri(texture_type, GL_TEXTURE_MAG_FILTER, filter);
1117 glTexParameteri(texture_type, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1119 glTexParameteri(texture_type, GL_TEXTURE_WRAP_S, wrap);
1120 glTexParameteri(texture_type, GL_TEXTURE_WRAP_T, wrap);
1121 glBindTexture(texture_type, 0);
1127 GLuint texture_handle = 0;
1128 glGenTextures(1, &texture_handle);
1129 if(texture_handle) {
1130 glBindTexture(GL_TEXTURE_2D_ARRAY, texture_handle);
1134 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, GLsizei(p_dx), GLsizei(p_dy), GLsizei(tiles_x * tiles_y), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1135 glPixelStorei(GL_UNPACK_ROW_LENGTH,
image.
size_x);
1136 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,
image.
size_y);
1138 for(int32_t x = 0; x < tiles_x; x++)
1139 for(int32_t y = 0; y < tiles_y; y++)
1140 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, GLint(x * tiles_x + y), GLsizei(p_dx), GLsizei(p_dy), 1, GL_RGBA, GL_UNSIGNED_BYTE, ((
uint32_t const*)
image.
data) + (x * p_dy *
image.
size_x + y * p_dx));
1142 set_gltex_parameters(texture_handle, GL_TEXTURE_2D_ARRAY, GL_LINEAR_MIPMAP_NEAREST, GL_REPEAT);
1143 glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
1144 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
1145 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
1147 return texture_handle;
std::array< char_descriptor, 256 > chars
ankerl::unordered_dense::map< char32_t, glyph_sub_offset > glyph_positions
std::vector< uint32_t > textures
#define assert(condition)
flag_type get_current_flag_type(sys::state const &state, dcon::nation_id target_nation)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
std::string int_to_tag(uint32_t v)
constexpr GLuint piechart
constexpr GLuint interactable
constexpr GLuint frame_stretch
constexpr GLuint no_filter
constexpr GLuint transparent_color
constexpr GLuint progress_bar
constexpr GLuint use_mask
constexpr GLuint subsprite_b
constexpr GLuint barchart
constexpr GLuint disabled
constexpr GLuint linegraph
constexpr GLuint alternate_tint
constexpr GLuint interactable_disabled
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)
std::string_view opengl_get_error_name(GLenum t)
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)
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 internal_text_render(sys::state &state, text::stored_glyphs const &txt, float x, float baseline_y, float size, text::font &f)
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)
auto map_color_modification_to_index(color_modification e)
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 bind_vertices_by_rotation(sys::state const &state, ui::rotation r, bool flipped, bool rtl)
void render_simple_rect(sys::state const &state, float x, float y, float width, float height, ui::rotation r, bool flipped, bool rtl)
void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint filter, GLuint wrap)
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)
GLuint SOIL_direct_load_DDS_from_memory(unsigned char const *const buffer, uint32_t buffer_length, uint32_t &width, uint32_t &height, int soil_flags)
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 load_special_icons(sys::state &state)
void render_classic_text(sys::state &state, text::stored_glyphs const &txt, float x, float y, float size, color_modification enabled, color3f const &c, text::bm_font const &font, text::font &base_font)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
std::string_view framebuffer_error(GLenum e)
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)
@ SOIL_FLAG_TEXTURE_REPEATS
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)
GLuint get_flag_texture_handle_from_tag(sys::state &state, const char tag[3])
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)
GLuint get_flag_handle(sys::state &state, dcon::national_identity_id nat_id, culture::flag_type type)
directory open_directory(directory const &dir, native_string_view directory_name)
std::optional< file > open_file(directory const &dir, native_string_view file_name)
file_contents view_contents(file const &f)
constexpr int magnification_factor
int32_t size_from_font_id(uint16_t id)
bm_font const & get_bm_font(sys::state &state, uint16_t font_handle)
font_selection font_index_from_font_id(sys::state &state, uint16_t id)
void emit_error_message(std::string const &content, bool fatal)
std::string_view native_string_view
dcon::national_identity_id tag
dcon::unit_type_id unit_type
std::vector< stored_glyph > glyph_info