我正在尝试按照本指南以及如何在默认帧缓冲区上启用SRGB支持的SDL2文档中以正确的伽马方式呈现典型的OpenGL颜色三角形.
这是我编写的代码,它绘制了三角形:
#include <SDL.h>
// Header file generated with glLoadGen
#include "gl_core_3_3.h"
#include <cstdlib>
void sdl_loop(SDL_Window* window);
static const char* const vertexSource = R"(
#version 330
in vec2 position;
in vec3 color;
out vec3 vs_color;
void main()
{
gl_Position = vec4(position, 0.0, 1.0);
vs_color = color;
}
)";
static const char* const fragmentSource = R"(
#version 330
in vec3 vs_color;
out vec4 fragColor;
void main()
{
fragColor = vec4(vs_color, 1.0);
}
)";
static const float vertices[] = { …Run Code Online (Sandbox Code Playgroud)