1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-11 07:34:33 +02:00

fix GLSL version for OpenGL 3.2

This commit is contained in:
XProger
2021-01-17 07:34:54 +03:00
parent 21f0b07f1b
commit f19ff9813e
2 changed files with 30 additions and 8 deletions

View File

@@ -496,6 +496,8 @@ namespace GAPI {
char GLSL_HEADER_VERT[512];
char GLSL_HEADER_FRAG[512];
bool GL_VER_3 = false;
// Shader
#ifndef FFP
const char SHADER_COMPOSE[] =
@@ -1424,14 +1426,32 @@ namespace GAPI {
strcat(GLSL_HEADER_FRAG, "#define sampler2DShadow lowp sampler2DShadow\n");
}
#else
// vertex
strcat(GLSL_HEADER_VERT, "#version 110\n"
"#define VERTEX\n");
// fragment
strcat(GLSL_HEADER_FRAG, "#version 110\n");
strcat(GLSL_HEADER_FRAG, extHeader);
strcat(GLSL_HEADER_FRAG, "#define FRAGMENT\n"
"#define fragColor gl_FragColor\n");
if (GL_VER_3) {
strcat(GLSL_HEADER_VERT, "#version 150\n"
"#define VERTEX\n"
"#define varying out\n"
"#define attribute in\n"
"#define texture2D texture\n");
// fragment
strcat(GLSL_HEADER_FRAG, "#version 150\n");
strcat(GLSL_HEADER_FRAG, extHeader);
strcat(GLSL_HEADER_FRAG, "#define FRAGMENT\n"
"#define varying in\n"
"#define texture2D texture\n"
"#define texture3D texture\n"
"#define textureCube texture\n"
"#define shadow2DEXT texture\n"
"out vec4 fragColor;\n");
} else {
// vertex
strcat(GLSL_HEADER_VERT, "#version 110\n"
"#define VERTEX\n");
// fragment
strcat(GLSL_HEADER_FRAG, "#version 110\n");
strcat(GLSL_HEADER_FRAG, extHeader);
strcat(GLSL_HEADER_FRAG, "#define FRAGMENT\n"
"#define fragColor gl_FragColor\n");
}
#endif
ASSERT(strlen(GLSL_HEADER_VERT) < COUNT(GLSL_HEADER_VERT));
ASSERT(strlen(GLSL_HEADER_FRAG) < COUNT(GLSL_HEADER_FRAG));

View File

@@ -475,6 +475,8 @@ HWND hWnd;
};
hRC = wglCreateContextAttribsARB(hDC, 0, contextAttribs);
GAPI::GL_VER_3 = true;
} else {
int format = ChoosePixelFormat(hDC, &pfd);
SetPixelFormat(hDC, format, &pfd);