mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
adjust version numbers on shaders for core profiles
This commit is contained in:
parent
c333ff832a
commit
8f8fd74e3b
@ -37,7 +37,7 @@ BOOL oglu_load_dll();
|
|||||||
void oglu_init();
|
void oglu_init();
|
||||||
BOOL oglu_ext_exists(char *ext, HDC hdc);
|
BOOL oglu_ext_exists(char *ext, HDC hdc);
|
||||||
GLuint oglu_build_program(const GLchar *vert_source, const GLchar *frag_source);
|
GLuint oglu_build_program(const GLchar *vert_source, const GLchar *frag_source);
|
||||||
GLuint oglu_build_program_from_file(const char *file_path);
|
GLuint oglu_build_program_from_file(const char *file_path, BOOL core_profile);
|
||||||
|
|
||||||
extern PFNGLVIEWPORTPROC glViewport;
|
extern PFNGLVIEWPORTPROC glViewport;
|
||||||
extern PFNGLBINDTEXTUREPROC glBindTexture;
|
extern PFNGLBINDTEXTUREPROC glBindTexture;
|
||||||
|
@ -317,7 +317,7 @@ GLuint oglu_build_program(const GLchar *vert_source, const GLchar *frag_source)
|
|||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint oglu_build_program_from_file(const char *file_path)
|
GLuint oglu_build_program_from_file(const char *file_path, BOOL core_profile)
|
||||||
{
|
{
|
||||||
GLuint program = 0;
|
GLuint program = 0;
|
||||||
|
|
||||||
@ -344,6 +344,15 @@ GLuint oglu_build_program_from_file(const char *file_path)
|
|||||||
|
|
||||||
if (version_start)
|
if (version_start)
|
||||||
{
|
{
|
||||||
|
if (core_profile)
|
||||||
|
{
|
||||||
|
if (strnicmp(version_start, "#version 130", 12) == 0 ||
|
||||||
|
strnicmp(version_start, "#version 140", 12) == 0)
|
||||||
|
{
|
||||||
|
memcpy(version_start, "#version 150", 12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char deli[2] = "\n";
|
const char deli[2] = "\n";
|
||||||
char *version = strtok(version_start, deli);
|
char *version = strtok(version_start, deli);
|
||||||
|
|
||||||
@ -358,8 +367,10 @@ GLuint oglu_build_program_from_file(const char *file_path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(vert_source, "#define VERTEX\n");
|
strcpy(vert_source, core_profile ? "#version 150\n" : "#version 130\n");
|
||||||
strcpy(frag_source, "#define FRAGMENT\n");
|
strcpy(frag_source, core_profile ? "#version 150\n" : "#version 130\n");
|
||||||
|
strcat(vert_source, "#define VERTEX\n");
|
||||||
|
strcat(frag_source, "#define FRAGMENT\n");
|
||||||
strcat(vert_source, source);
|
strcat(vert_source, source);
|
||||||
strcat(frag_source, source);
|
strcat(frag_source, source);
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ static void ogl_build_programs()
|
|||||||
|
|
||||||
if (g_ogl.main_program)
|
if (g_ogl.main_program)
|
||||||
{
|
{
|
||||||
g_ogl.scale_program = oglu_build_program_from_file(g_ddraw->shader);
|
g_ogl.scale_program = oglu_build_program_from_file(g_ddraw->shader, wglCreateContextAttribsARB != NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user