diff --git a/CMakeLists.txt b/CMakeLists.txt index a0f7ecdd..60aa8d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ include(cmake/generate_product_version.cmake) if(MSVC) add_compile_options(/WX /wd4267 /wd4100 /wd4101 /wd4189) +elseif(APPLE) + add_compile_definitions(GL_SILENCE_DEPRECATION) endif() # Set where the binary files will be built. The program will not execute from diff --git a/resources/shaders/ColorShader.vs b/resources/shaders/ColorShader.vs index 2eca3f6f..a5e645d8 100644 --- a/resources/shaders/ColorShader.vs +++ b/resources/shaders/ColorShader.vs @@ -16,4 +16,4 @@ void main() { mat4 MVP = ModelMtx * ViewMtx * ProjMtx; gl_Position = vec4(Position, 1) * MVP; -}; +} diff --git a/resources/shaders/ColorShaderLighting.vs b/resources/shaders/ColorShaderLighting.vs index c0871e69..116bb205 100644 --- a/resources/shaders/ColorShaderLighting.vs +++ b/resources/shaders/ColorShaderLighting.vs @@ -66,4 +66,4 @@ void main() Illum += (Atten * DiffuseAtten * Lights[iLight].Color); } COLOR0A0 = COLOR0_Mat * (Illum + COLOR0_Amb); -}; +} diff --git a/resources/shaders/TextureShader.vs b/resources/shaders/TextureShader.vs index c5705443..447aaf6f 100644 --- a/resources/shaders/TextureShader.vs +++ b/resources/shaders/TextureShader.vs @@ -21,4 +21,4 @@ void main() mat4 MVP = ModelMtx * ViewMtx * ProjMtx; gl_Position = vec4(Position, 1) * MVP; TexCoord = Tex0; -}; +} diff --git a/src/Core/OpenGL/CShader.cpp b/src/Core/OpenGL/CShader.cpp index 96e4c992..0aca62cf 100644 --- a/src/Core/OpenGL/CShader.cpp +++ b/src/Core/OpenGL/CShader.cpp @@ -187,6 +187,12 @@ GLuint CShader::GetUniformBlockIndex(const char* 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) { for (uint32 iTex = 0; iTex < NumTextures; iTex++) @@ -205,11 +211,11 @@ void CShader::SetCurrent() glUseProgram(mProgram); spCurrentShader = this; - glUniformBlockBinding(mProgram, mMVPBlockIndex, CGraphics::MVPBlockBindingPoint()); - glUniformBlockBinding(mProgram, mVertexBlockIndex, CGraphics::VertexBlockBindingPoint()); - glUniformBlockBinding(mProgram, mPixelBlockIndex, CGraphics::PixelBlockBindingPoint()); - glUniformBlockBinding(mProgram, mLightBlockIndex, CGraphics::LightBlockBindingPoint()); - glUniformBlockBinding(mProgram, mBoneTransformBlockIndex, CGraphics::BoneTransformBlockBindingPoint()); + UniformBlockBinding(mMVPBlockIndex, CGraphics::MVPBlockBindingPoint()); + UniformBlockBinding(mVertexBlockIndex, CGraphics::VertexBlockBindingPoint()); + UniformBlockBinding(mPixelBlockIndex, CGraphics::PixelBlockBindingPoint()); + UniformBlockBinding(mLightBlockIndex, CGraphics::LightBlockBindingPoint()); + UniformBlockBinding(mBoneTransformBlockIndex, CGraphics::BoneTransformBlockBindingPoint()); } } diff --git a/src/Core/OpenGL/CShader.h b/src/Core/OpenGL/CShader.h index eed9e7b6..7165f865 100644 --- a/src/Core/OpenGL/CShader.h +++ b/src/Core/OpenGL/CShader.h @@ -37,6 +37,7 @@ public: GLuint GetProgramID(); GLuint GetUniformLocation(const char* pkUniform); GLuint GetUniformBlockIndex(const char* pkUniformBlock); + void UniformBlockBinding(GLuint BlockIndex, GLuint BlockBinding); void SetTextureUniforms(uint32 NumTextures); void SetNumLights(uint32 NumLights); void SetCurrent(); diff --git a/src/Editor/main.cpp b/src/Editor/main.cpp index be32f2c8..01d1ccfb 100644 --- a/src/Editor/main.cpp +++ b/src/Editor/main.cpp @@ -107,6 +107,12 @@ public: MacOSSetDarkAppearance(); #endif + // Default OpenGL format + QSurfaceFormat glFormat; + glFormat.setVersion(3, 3); + glFormat.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(glFormat); + // Init log bool Initialized = NLog::InitLog(LocateLogPath()); if (!Initialized) UICommon::ErrorMsg(0, "Couldn't open log file. Logging will not work for this session.");