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:
@@ -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));
|
||||||
|
@@ -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);
|
||||||
|
Reference in New Issue
Block a user