1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-11 15:45:05 +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_VERT[512];
char GLSL_HEADER_FRAG[512]; char GLSL_HEADER_FRAG[512];
bool GL_VER_3 = false;
// Shader // Shader
#ifndef FFP #ifndef FFP
const char SHADER_COMPOSE[] = const char SHADER_COMPOSE[] =
@@ -1424,6 +1426,23 @@ namespace GAPI {
strcat(GLSL_HEADER_FRAG, "#define sampler2DShadow lowp sampler2DShadow\n"); strcat(GLSL_HEADER_FRAG, "#define sampler2DShadow lowp sampler2DShadow\n");
} }
#else #else
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 // vertex
strcat(GLSL_HEADER_VERT, "#version 110\n" strcat(GLSL_HEADER_VERT, "#version 110\n"
"#define VERTEX\n"); "#define VERTEX\n");
@@ -1432,6 +1451,7 @@ namespace GAPI {
strcat(GLSL_HEADER_FRAG, extHeader); strcat(GLSL_HEADER_FRAG, extHeader);
strcat(GLSL_HEADER_FRAG, "#define FRAGMENT\n" strcat(GLSL_HEADER_FRAG, "#define FRAGMENT\n"
"#define fragColor gl_FragColor\n"); "#define fragColor gl_FragColor\n");
}
#endif #endif
ASSERT(strlen(GLSL_HEADER_VERT) < COUNT(GLSL_HEADER_VERT)); ASSERT(strlen(GLSL_HEADER_VERT) < COUNT(GLSL_HEADER_VERT));
ASSERT(strlen(GLSL_HEADER_FRAG) < COUNT(GLSL_HEADER_FRAG)); ASSERT(strlen(GLSL_HEADER_FRAG) < COUNT(GLSL_HEADER_FRAG));

View File

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