Mac OpenGL fixes
This commit is contained in:
parent
c4cc4b8657
commit
acd925ffaa
|
@ -10,6 +10,8 @@ include(cmake/generate_product_version.cmake)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_options(/WX /wd4267 /wd4100 /wd4101 /wd4189)
|
add_compile_options(/WX /wd4267 /wd4100 /wd4101 /wd4189)
|
||||||
|
elseif(APPLE)
|
||||||
|
add_compile_definitions(GL_SILENCE_DEPRECATION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set where the binary files will be built. The program will not execute from
|
# Set where the binary files will be built. The program will not execute from
|
||||||
|
|
|
@ -16,4 +16,4 @@ void main()
|
||||||
{
|
{
|
||||||
mat4 MVP = ModelMtx * ViewMtx * ProjMtx;
|
mat4 MVP = ModelMtx * ViewMtx * ProjMtx;
|
||||||
gl_Position = vec4(Position, 1) * MVP;
|
gl_Position = vec4(Position, 1) * MVP;
|
||||||
};
|
}
|
||||||
|
|
|
@ -66,4 +66,4 @@ void main()
|
||||||
Illum += (Atten * DiffuseAtten * Lights[iLight].Color);
|
Illum += (Atten * DiffuseAtten * Lights[iLight].Color);
|
||||||
}
|
}
|
||||||
COLOR0A0 = COLOR0_Mat * (Illum + COLOR0_Amb);
|
COLOR0A0 = COLOR0_Mat * (Illum + COLOR0_Amb);
|
||||||
};
|
}
|
||||||
|
|
|
@ -21,4 +21,4 @@ void main()
|
||||||
mat4 MVP = ModelMtx * ViewMtx * ProjMtx;
|
mat4 MVP = ModelMtx * ViewMtx * ProjMtx;
|
||||||
gl_Position = vec4(Position, 1) * MVP;
|
gl_Position = vec4(Position, 1) * MVP;
|
||||||
TexCoord = Tex0;
|
TexCoord = Tex0;
|
||||||
};
|
}
|
||||||
|
|
|
@ -187,6 +187,12 @@ GLuint CShader::GetUniformBlockIndex(const char* pkUniformBlock)
|
||||||
return glGetUniformBlockIndex(mProgram, pkUniformBlock);
|
return glGetUniformBlockIndex(mProgram, pkUniformBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CShader::UniformBlockBinding(GLuint BlockIndex, GLuint BlockBinding)
|
||||||
|
{
|
||||||
|
if (BlockIndex != GL_INVALID_INDEX)
|
||||||
|
glUniformBlockBinding(mProgram, BlockIndex, BlockBinding);
|
||||||
|
}
|
||||||
|
|
||||||
void CShader::SetTextureUniforms(uint32 NumTextures)
|
void CShader::SetTextureUniforms(uint32 NumTextures)
|
||||||
{
|
{
|
||||||
for (uint32 iTex = 0; iTex < NumTextures; iTex++)
|
for (uint32 iTex = 0; iTex < NumTextures; iTex++)
|
||||||
|
@ -205,11 +211,11 @@ void CShader::SetCurrent()
|
||||||
glUseProgram(mProgram);
|
glUseProgram(mProgram);
|
||||||
spCurrentShader = this;
|
spCurrentShader = this;
|
||||||
|
|
||||||
glUniformBlockBinding(mProgram, mMVPBlockIndex, CGraphics::MVPBlockBindingPoint());
|
UniformBlockBinding(mMVPBlockIndex, CGraphics::MVPBlockBindingPoint());
|
||||||
glUniformBlockBinding(mProgram, mVertexBlockIndex, CGraphics::VertexBlockBindingPoint());
|
UniformBlockBinding(mVertexBlockIndex, CGraphics::VertexBlockBindingPoint());
|
||||||
glUniformBlockBinding(mProgram, mPixelBlockIndex, CGraphics::PixelBlockBindingPoint());
|
UniformBlockBinding(mPixelBlockIndex, CGraphics::PixelBlockBindingPoint());
|
||||||
glUniformBlockBinding(mProgram, mLightBlockIndex, CGraphics::LightBlockBindingPoint());
|
UniformBlockBinding(mLightBlockIndex, CGraphics::LightBlockBindingPoint());
|
||||||
glUniformBlockBinding(mProgram, mBoneTransformBlockIndex, CGraphics::BoneTransformBlockBindingPoint());
|
UniformBlockBinding(mBoneTransformBlockIndex, CGraphics::BoneTransformBlockBindingPoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
GLuint GetProgramID();
|
GLuint GetProgramID();
|
||||||
GLuint GetUniformLocation(const char* pkUniform);
|
GLuint GetUniformLocation(const char* pkUniform);
|
||||||
GLuint GetUniformBlockIndex(const char* pkUniformBlock);
|
GLuint GetUniformBlockIndex(const char* pkUniformBlock);
|
||||||
|
void UniformBlockBinding(GLuint BlockIndex, GLuint BlockBinding);
|
||||||
void SetTextureUniforms(uint32 NumTextures);
|
void SetTextureUniforms(uint32 NumTextures);
|
||||||
void SetNumLights(uint32 NumLights);
|
void SetNumLights(uint32 NumLights);
|
||||||
void SetCurrent();
|
void SetCurrent();
|
||||||
|
|
|
@ -107,6 +107,12 @@ public:
|
||||||
MacOSSetDarkAppearance();
|
MacOSSetDarkAppearance();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Default OpenGL format
|
||||||
|
QSurfaceFormat glFormat;
|
||||||
|
glFormat.setVersion(3, 3);
|
||||||
|
glFormat.setProfile(QSurfaceFormat::CoreProfile);
|
||||||
|
QSurfaceFormat::setDefaultFormat(glFormat);
|
||||||
|
|
||||||
// Init log
|
// Init log
|
||||||
bool Initialized = NLog::InitLog(LocateLogPath());
|
bool Initialized = NLog::InitLog(LocateLogPath());
|
||||||
if (!Initialized) UICommon::ErrorMsg(0, "Couldn't open log file. Logging will not work for this session.");
|
if (!Initialized) UICommon::ErrorMsg(0, "Couldn't open log file. Logging will not work for this session.");
|
||||||
|
|
Loading…
Reference in New Issue