mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
rename, configurable gamma mode
This commit is contained in:
@@ -741,7 +741,12 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
else if (token == "gfx.usegles")
|
else if (token == "gfx.usegles")
|
||||||
{
|
{
|
||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
Parser >> use_gles;
|
Parser >> gfx_usegles;
|
||||||
|
}
|
||||||
|
else if (token == "gfx.shadergamma")
|
||||||
|
{
|
||||||
|
Parser.getTokens(1);
|
||||||
|
Parser >> gfx_shadergamma;
|
||||||
}
|
}
|
||||||
else if (token == "map.enabled")
|
else if (token == "map.enabled")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,9 +186,10 @@ struct global_settings {
|
|||||||
GLenum gfx_format_color = GL_RGB16F;
|
GLenum gfx_format_color = GL_RGB16F;
|
||||||
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
|
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
|
||||||
bool gfx_skippipeline = false;
|
bool gfx_skippipeline = false;
|
||||||
|
bool gfx_shadergamma = false;
|
||||||
|
|
||||||
bool map_enabled = true;
|
bool map_enabled = true;
|
||||||
bool use_gles = false;
|
bool gfx_usegles = false;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void LoadIniFile( std::string asFileName );
|
void LoadIniFile( std::string asFileName );
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void render_task::run() {
|
|||||||
const unsigned char *image = reinterpret_cast<const unsigned char *>( PyString_AsString( output ) );
|
const unsigned char *image = reinterpret_cast<const unsigned char *>( PyString_AsString( output ) );
|
||||||
|
|
||||||
// build texture
|
// build texture
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
glTexImage2D(
|
glTexImage2D(
|
||||||
GL_TEXTURE_2D, 0,
|
GL_TEXTURE_2D, 0,
|
||||||
|
|||||||
@@ -865,7 +865,7 @@ opengl_texture::create() {
|
|||||||
glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, borderColor);
|
glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, borderColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.use_gles)
|
if (Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if (target == GL_TEXTURE_2D || !glTexStorage2DMultisample)
|
if (target == GL_TEXTURE_2D || !glTexStorage2DMultisample)
|
||||||
glTexStorage2D(target, count_trailing_zeros(std::max(data_width, data_height)) + 1, data_format, data_width, data_height);
|
glTexStorage2D(target, count_trailing_zeros(std::max(data_width, data_height)) + 1, data_format, data_width, data_height);
|
||||||
@@ -902,7 +902,7 @@ opengl_texture::create() {
|
|||||||
|
|
||||||
GLint internal_format = mapping[components][components_hint];
|
GLint internal_format = mapping[components][components_hint];
|
||||||
|
|
||||||
if (Global.use_gles)
|
if (Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
// GLES cannot generate mipmaps on SRGB8
|
// GLES cannot generate mipmaps on SRGB8
|
||||||
if (internal_format == GL_SRGB8)
|
if (internal_format == GL_SRGB8)
|
||||||
|
|||||||
@@ -428,12 +428,13 @@ eu07_application::init_glfw() {
|
|||||||
glfwWindowHint( GLFW_BLUE_BITS, vmode->blueBits );
|
glfwWindowHint( GLFW_BLUE_BITS, vmode->blueBits );
|
||||||
glfwWindowHint( GLFW_REFRESH_RATE, vmode->refreshRate );
|
glfwWindowHint( GLFW_REFRESH_RATE, vmode->refreshRate );
|
||||||
|
|
||||||
if (!Global.use_gles)
|
glfwWindowHint(GLFW_SRGB_CAPABLE, !Global.gfx_shadergamma);
|
||||||
|
|
||||||
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -441,7 +442,6 @@ eu07_application::init_glfw() {
|
|||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwWindowHint( GLFW_AUTO_ICONIFY, GLFW_FALSE );
|
glfwWindowHint( GLFW_AUTO_ICONIFY, GLFW_FALSE );
|
||||||
@@ -509,7 +509,7 @@ eu07_application::init_callbacks() {
|
|||||||
int
|
int
|
||||||
eu07_application::init_gfx() {
|
eu07_application::init_gfx() {
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
|
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ void gl::glsl_common_setup()
|
|||||||
"#define ENVMAP_ENABLED " + std::to_string((int)Global.gfx_envmap_enabled) + "\n" +
|
"#define ENVMAP_ENABLED " + std::to_string((int)Global.gfx_envmap_enabled) + "\n" +
|
||||||
"#define MOTIONBLUR_ENABLED " + std::to_string((int)Global.gfx_postfx_motionblur_enabled) + "\n" +
|
"#define MOTIONBLUR_ENABLED " + std::to_string((int)Global.gfx_postfx_motionblur_enabled) + "\n" +
|
||||||
"#define POSTFX_ENABLED " + std::to_string((int)!Global.gfx_skippipeline) + "\n" +
|
"#define POSTFX_ENABLED " + std::to_string((int)!Global.gfx_skippipeline) + "\n" +
|
||||||
"#define USE_GLES " + std::to_string((int)Global.use_gles) + "\n" +
|
"#define USE_GLES " + std::to_string((int)Global.gfx_usegles) + "\n" +
|
||||||
"const uint MAX_LIGHTS = " + std::to_string(MAX_LIGHTS) + "U;\n" +
|
"const uint MAX_LIGHTS = " + std::to_string(MAX_LIGHTS) + "U;\n" +
|
||||||
"const uint MAX_PARAMS = " + std::to_string(MAX_PARAMS) + "U;\n" +
|
"const uint MAX_PARAMS = " + std::to_string(MAX_PARAMS) + "U;\n" +
|
||||||
R"STRING(
|
R"STRING(
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ gl::shader::shader(const std::string &filename)
|
|||||||
{
|
{
|
||||||
name = filename;
|
name = filename;
|
||||||
std::string str;
|
std::string str;
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
str += "#version 330 core\n";
|
str += "#version 330 core\n";
|
||||||
}
|
}
|
||||||
@@ -213,6 +213,8 @@ gl::shader::shader(const std::string &filename)
|
|||||||
str += "precision highp float;\n";
|
str += "precision highp float;\n";
|
||||||
str += "precision highp sampler2DShadow;\n";
|
str += "precision highp sampler2DShadow;\n";
|
||||||
}
|
}
|
||||||
|
str += "vec4 FBOUT(vec4 x) { return " + (Global.gfx_shadergamma ? std::string("vec4(pow(x.rgb, vec3(1.0 / 2.2)), x.a)") : std::string("x")) + "; }\n";
|
||||||
|
|
||||||
str += read_file(filename);
|
str += read_file(filename);
|
||||||
process_source(str);
|
process_source(str);
|
||||||
|
|
||||||
@@ -239,7 +241,6 @@ gl::shader::shader(const std::string &filename)
|
|||||||
{
|
{
|
||||||
GLchar info[512];
|
GLchar info[512];
|
||||||
glGetShaderInfoLog(*this, 512, 0, info);
|
glGetShaderInfoLog(*this, 512, 0, info);
|
||||||
ErrorLog(std::string(info));
|
|
||||||
std::cerr << std::string(info) << std::endl;
|
std::cerr << std::string(info) << std::endl;
|
||||||
throw shader_exception("failed to compile " + filename + ": " + std::string(info));
|
throw shader_exception("failed to compile " + filename + ": " + std::string(info));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,10 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
@@ -101,12 +103,16 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
|
|
||||||
GLint last_polygon_mode[2];
|
GLint last_polygon_mode[2];
|
||||||
GLboolean last_enable_srgb;
|
GLboolean last_enable_srgb;
|
||||||
if (GLAD_GL_VERSION_3_3)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||||
last_enable_srgb = glIsEnabled(GL_FRAMEBUFFER_SRGB);
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
|
||||||
|
if (!Global.gfx_shadergamma)
|
||||||
|
{
|
||||||
|
last_enable_srgb = glIsEnabled(GL_FRAMEBUFFER_SRGB);
|
||||||
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
||||||
@@ -204,10 +210,16 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
|
|
||||||
if (GLAD_GL_VERSION_3_3)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if (last_enable_srgb) glEnable(GL_FRAMEBUFFER_SRGB); else glDisable(GL_FRAMEBUFFER_SRGB);
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
||||||
|
if (!Global.gfx_shadergamma)
|
||||||
|
{
|
||||||
|
if (last_enable_srgb)
|
||||||
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
else
|
||||||
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,17 +291,20 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
"out vec4 Out_Color;\n"
|
"out vec4 Out_Color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n"
|
" Out_Color = FBOUT(Frag_Color * texture( Texture, Frag_UV.st));\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fbout_copy = "vec4 FBOUT(vec4 x) { return x; }";
|
||||||
|
const GLchar* fbout_gamma = "vec4 FBOUT(vec4 x) { return vec4(pow(x.rgb, vec3(1.0 / 2.2)), x.a); }";
|
||||||
|
|
||||||
const GLchar* vertex_shader_with_version[2] = { g_GlslVersion, vertex_shader };
|
const GLchar* vertex_shader_with_version[2] = { g_GlslVersion, vertex_shader };
|
||||||
const GLchar* fragment_shader_with_version[2] = { g_GlslVersion, fragment_shader };
|
const GLchar* fragment_shader_with_version[3] = { g_GlslVersion, Global.gfx_shadergamma ? fbout_gamma : fbout_copy, fragment_shader };
|
||||||
|
|
||||||
g_ShaderHandle = glCreateProgram();
|
g_ShaderHandle = glCreateProgram();
|
||||||
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
||||||
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
|
glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
|
||||||
glShaderSource(g_FragHandle, 2, fragment_shader_with_version, NULL);
|
glShaderSource(g_FragHandle, 3, fragment_shader_with_version, NULL);
|
||||||
glCompileShader(g_VertHandle);
|
glCompileShader(g_VertHandle);
|
||||||
glCompileShader(g_FragHandle);
|
glCompileShader(g_FragHandle);
|
||||||
glAttachShader(g_ShaderHandle, g_VertHandle);
|
glAttachShader(g_ShaderHandle, g_VertHandle);
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ void opengl_vbogeometrybank::draw_(const std::vector<gfx::geometry_handle>::iter
|
|||||||
m_vao->bind();
|
m_vao->bind();
|
||||||
if (m_offsets.size() == 1)
|
if (m_offsets.size() == 1)
|
||||||
glDrawArrays(type, m_offsets.front(), m_counts.front());
|
glDrawArrays(type, m_offsets.front(), m_counts.front());
|
||||||
else if (!Global.use_gles)
|
else if (!Global.gfx_usegles)
|
||||||
glMultiDrawArrays(type, m_offsets.data(), m_counts.data(), m_offsets.size());
|
glMultiDrawArrays(type, m_offsets.data(), m_counts.data(), m_offsets.size());
|
||||||
else
|
else
|
||||||
for (size_t i = 0; i < m_offsets.size(); i++)
|
for (size_t i = 0; i < m_offsets.size(); i++)
|
||||||
|
|||||||
22
renderer.cpp
22
renderer.cpp
@@ -94,7 +94,7 @@ bool opengl_renderer::Init(GLFWwindow *Window)
|
|||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
glClearDepth(0.0f);
|
glClearDepth(0.0f);
|
||||||
else
|
else
|
||||||
glClearDepthf(0.0f);
|
glClearDepthf(0.0f);
|
||||||
@@ -106,7 +106,7 @@ bool opengl_renderer::Init(GLFWwindow *Window)
|
|||||||
else if (GLAD_GL_EXT_clip_control)
|
else if (GLAD_GL_EXT_clip_control)
|
||||||
glClipControlEXT(GL_LOWER_LEFT_EXT, GL_ZERO_TO_ONE_EXT);
|
glClipControlEXT(GL_LOWER_LEFT_EXT, GL_ZERO_TO_ONE_EXT);
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||||
|
|
||||||
gl::glsl_common_setup();
|
gl::glsl_common_setup();
|
||||||
@@ -182,7 +182,7 @@ bool opengl_renderer::Init(GLFWwindow *Window)
|
|||||||
scene_ubo->update(scene_ubs);
|
scene_ubo->update(scene_ubs);
|
||||||
|
|
||||||
int samples = 1 << Global.iMultisampling;
|
int samples = 1 << Global.iMultisampling;
|
||||||
if (!Global.use_gles && samples > 1)
|
if (!Global.gfx_usegles && samples > 1)
|
||||||
glEnable(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
|
|
||||||
if (!Global.gfx_skippipeline)
|
if (!Global.gfx_skippipeline)
|
||||||
@@ -312,7 +312,7 @@ bool opengl_renderer::Render()
|
|||||||
Timer::subsystem.gfx_color.start();
|
Timer::subsystem.gfx_color.start();
|
||||||
|
|
||||||
GLuint gl_time_ready;
|
GLuint gl_time_ready;
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
gl_time_ready = 0;
|
gl_time_ready = 0;
|
||||||
if (m_gltimequery)
|
if (m_gltimequery)
|
||||||
@@ -352,7 +352,7 @@ bool opengl_renderer::Render()
|
|||||||
"cpu swap: " + to_string(Timer::subsystem.gfx_swap.average(), 2) + " ms\n" += "uilayer: " + to_string(Timer::subsystem.gfx_gui.average(), 2) + "ms\n" +=
|
"cpu swap: " + to_string(Timer::subsystem.gfx_swap.average(), 2) + " ms\n" += "uilayer: " + to_string(Timer::subsystem.gfx_gui.average(), 2) + "ms\n" +=
|
||||||
"mainloop total: " + to_string(Timer::subsystem.mainloop_total.average(), 2) + "ms\n";
|
"mainloop total: " + to_string(Timer::subsystem.mainloop_total.average(), 2) + "ms\n";
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if (gl_time_ready)
|
if (gl_time_ready)
|
||||||
glEndQuery(GL_TIME_ELAPSED);
|
glEndQuery(GL_TIME_ELAPSED);
|
||||||
@@ -410,7 +410,7 @@ void opengl_renderer::Render_pass(rendermode const Mode)
|
|||||||
|
|
||||||
m_colorpass = m_renderpass;
|
m_colorpass = m_renderpass;
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if (Global.bWireFrame)
|
if (Global.bWireFrame)
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
@@ -460,7 +460,7 @@ void opengl_renderer::Render_pass(rendermode const Mode)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles && !Global.gfx_shadergamma)
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glViewport(0, 0, Global.iWindowWidth, Global.iWindowHeight);
|
glViewport(0, 0, Global.iWindowWidth, Global.iWindowHeight);
|
||||||
@@ -542,7 +542,7 @@ void opengl_renderer::Render_pass(rendermode const Mode)
|
|||||||
setup_shadow_map(nullptr, m_renderpass);
|
setup_shadow_map(nullptr, m_renderpass);
|
||||||
setup_env_map(nullptr);
|
setup_env_map(nullptr);
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
if (!Global.gfx_skippipeline)
|
if (!Global.gfx_skippipeline)
|
||||||
@@ -563,14 +563,14 @@ void opengl_renderer::Render_pass(rendermode const Mode)
|
|||||||
m_msaa_fb->blit_to(*m_main2_fb.get(), Global.gfx_framebuffer_width, Global.gfx_framebuffer_height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0);
|
m_msaa_fb->blit_to(*m_main2_fb.get(), Global.gfx_framebuffer_width, Global.gfx_framebuffer_height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles && !Global.gfx_shadergamma)
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
glViewport(0, 0, Global.iWindowWidth, Global.iWindowHeight);
|
glViewport(0, 0, Global.iWindowWidth, Global.iWindowHeight);
|
||||||
m_pfx_tonemapping->apply(*m_main2_tex, nullptr);
|
m_pfx_tonemapping->apply(*m_main2_tex, nullptr);
|
||||||
opengl_texture::reset_unit_cache();
|
opengl_texture::reset_unit_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles && !Global.gfx_shadergamma)
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
|
||||||
glDebug("uilayer render");
|
glDebug("uilayer render");
|
||||||
@@ -3561,7 +3561,7 @@ bool opengl_renderer::Init_caps()
|
|||||||
}
|
}
|
||||||
WriteLog("--------");
|
WriteLog("--------");
|
||||||
|
|
||||||
if (!Global.use_gles)
|
if (!Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if (!GLAD_GL_VERSION_3_3)
|
if (!GLAD_GL_VERSION_3_3)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void screenshot_manager::screenshot_save_thread( char *img, int w, int h )
|
|||||||
png.height = h;
|
png.height = h;
|
||||||
|
|
||||||
int stride;
|
int stride;
|
||||||
if (Global.use_gles)
|
if (Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
png.format = PNG_FORMAT_RGBA;
|
png.format = PNG_FORMAT_RGBA;
|
||||||
stride = -w * 4;
|
stride = -w * 4;
|
||||||
@@ -58,7 +58,7 @@ void screenshot_manager::screenshot_save_thread( char *img, int w, int h )
|
|||||||
void screenshot_manager::make_screenshot()
|
void screenshot_manager::make_screenshot()
|
||||||
{
|
{
|
||||||
char *img = new char[Global.iWindowWidth * Global.iWindowHeight * 4];
|
char *img = new char[Global.iWindowWidth * Global.iWindowHeight * 4];
|
||||||
glReadPixels(0, 0, Global.iWindowWidth, Global.iWindowHeight, Global.use_gles ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)img);
|
glReadPixels(0, 0, Global.iWindowWidth, Global.iWindowHeight, Global.gfx_usegles ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)img);
|
||||||
//m7t: use pbo
|
//m7t: use pbo
|
||||||
|
|
||||||
std::thread t(screenshot_save_thread, img, Global.iWindowWidth, Global.iWindowHeight);
|
std::thread t(screenshot_save_thread, img, Global.iWindowWidth, Global.iWindowHeight);
|
||||||
|
|||||||
@@ -12,6 +12,5 @@ void main()
|
|||||||
vec2 texcoord = f_coords;
|
vec2 texcoord = f_coords;
|
||||||
vec3 hdr_color = texture(tex1, texcoord).xyz;
|
vec3 hdr_color = texture(tex1, texcoord).xyz;
|
||||||
|
|
||||||
vec3 mapped = tonemap(hdr_color);
|
out_color = tonemap(vec4(hdr_color, 1.0));
|
||||||
out_color = vec4(mapped, 1.0);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,7 @@ vec3 filmic(vec3 x)
|
|||||||
return filmicF(x) / filmicF(vec3(11.2f));
|
return filmicF(x) / filmicF(vec3(11.2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 tonemap(vec3 x)
|
|
||||||
{
|
|
||||||
return ACESFilm(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 tonemap(vec4 x)
|
vec4 tonemap(vec4 x)
|
||||||
{
|
{
|
||||||
return vec4(tonemap(x.rgb), x.a);
|
return FBOUT(vec4(ACESFilm(x.rgb), x.a));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ bool ui_layer::init(GLFWwindow *Window)
|
|||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
ImGui_ImplOpenGL2_NewFrame();
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
#else
|
#else
|
||||||
if (Global.use_gles)
|
if (Global.gfx_usegles)
|
||||||
ImGui_ImplOpenGL3_Init("#version 300 es\nprecision highp float;");
|
ImGui_ImplOpenGL3_Init("#version 300 es\nprecision highp float;");
|
||||||
else
|
else
|
||||||
ImGui_ImplOpenGL3_Init("#version 330 core");
|
ImGui_ImplOpenGL3_Init("#version 330 core");
|
||||||
|
|||||||
Reference in New Issue
Block a user