Commit fd0884e8 authored by Jakob Weiss's avatar Jakob Weiss Committed by jakob
Browse files

Fixed issues to be able to build on MacOS

Tested on MacBook late 13 with NVIDIA GeForce GT 750M on High Sierra
parent f569f8f1
# Files generated by CMake # Files generated by CMake
CMakeCache.txt CMakeCache.txt
CMakeLists.txt.user
CMakeFiles CMakeFiles
cmake_install.cmake cmake_install.cmake
Makefile Makefile
/core/gen_converterregistration.h /core/gen_converterregistration.h
/modules/gen_pipelineregistration.h /modules/gen_pipelineregistration.h
FailedShader.vert
FailedShader.geom
FailedShader.frag
FailedShader.comp
# Files generated by Qt's moc and uic # Files generated by Qt's moc and uic
moc_*.cxx moc_*.cxx
...@@ -53,3 +58,7 @@ ext/tbb ...@@ -53,3 +58,7 @@ ext/tbb
build*/ build*/
.vs/ .vs/
.vscode/ .vscode/
# Mac specific
.DS_Store
...@@ -184,7 +184,7 @@ ELSEIF(UNIX) ...@@ -184,7 +184,7 @@ ELSEIF(UNIX)
# dangerous! # dangerous!
LIST(APPEND CampvisGlobalDefinitions "-Wno-deprecated-declarations") LIST(APPEND CampvisGlobalDefinitions "-Wno-deprecated-declarations")
LIST(APPEND CampvisGlobalExternalLibs "-pthread") LIST(APPEND CampvisGlobalExternalLibs "pthread")
ELSE() ELSE()
ENDIF(WIN32) ENDIF(WIN32)
...@@ -211,8 +211,7 @@ IF(CAMPVIS_BUILD_APPLICATION) ...@@ -211,8 +211,7 @@ IF(CAMPVIS_BUILD_APPLICATION)
# As moc files are generated in the binary dir, tell CMake to always look for includes there: # As moc files are generated in the binary dir, tell CMake to always look for includes there:
SET(CMAKE_INCLUDE_CURRENT_DIR ON) SET(CMAKE_INCLUDE_CURRENT_DIR ON)
FIND_PACKAGE(Qt5Widgets REQUIRED) FIND_PACKAGE(Qt5 COMPONENTS Widgets OpenGL REQUIRED)
FIND_PACKAGE(Qt5OpenGL REQUIRED)
RESOLVE_QT5_DLL_LOCATIONS("Core;Gui;OpenGL;Widgets") RESOLVE_QT5_DLL_LOCATIONS("Core;Gui;OpenGL;Widgets")
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
in vec4 ex_Color; ///< incoming color in vec4 ex_Color; ///< incoming color
out vec4 out_Color; out vec4 FragData0;
void main() { void main() {
out_Color = ex_Color; FragData0 = ex_Color;
} }
...@@ -74,8 +74,9 @@ vec2 intersectAABB(vec3 rayOrigin, vec3 rayDirection, in vec3 boxLlf, in vec3 bo ...@@ -74,8 +74,9 @@ vec2 intersectAABB(vec3 rayOrigin, vec3 rayDirection, in vec3 boxLlf, in vec3 bo
vec3 t2 = max(tMin, tMax); vec3 t2 = max(tMin, tMax);
float tNear = max(max(t1.x, t1.y), t1.z); float tNear = max(max(t1.x, t1.y), t1.z);
float tFar = min(min(t2.x, t2.y), t2.z); float tFar = min(min(t2.x, t2.y), t2.z);
return vec2(tNear, tFar); vec2 r = vec2(tNear, tFar);
}; return r;
}
/** /**
* Converts a depth value in eye space to the corresponding depth value in viewport space. * Converts a depth value in eye space to the corresponding depth value in viewport space.
......
...@@ -61,7 +61,7 @@ namespace campvis { ...@@ -61,7 +61,7 @@ namespace campvis {
LERRORC("CAMPVis.core.init", "Your system does not support GLSL Shader Version 3.30, which is mandatory. CAMPVis will probably not work as intended."); LERRORC("CAMPVis.core.init", "Your system does not support GLSL Shader Version 3.30, which is mandatory. CAMPVis will probably not work as intended.");
} }
ShdrMgr.setDefaultGlslVersion("430"); ShdrMgr.setDefaultGlslVersion("410");
for (auto it = searchPaths.cbegin(); it != searchPaths.cend(); ++it) { for (auto it = searchPaths.cbegin(); it != searchPaths.cend(); ++it) {
ShdrMgr.addPath(*it); ShdrMgr.addPath(*it);
ShdrMgr.addPath(*it + "/core/glsl"); ShdrMgr.addPath(*it + "/core/glsl");
......
...@@ -273,7 +273,7 @@ QGLFormat QtCanvas::getQGLFormat() ...@@ -273,7 +273,7 @@ QGLFormat QtCanvas::getQGLFormat()
QGLFormat format = QGLFormat(QGL::NoDeprecatedFunctions); QGLFormat format = QGLFormat(QGL::NoDeprecatedFunctions);
format = QGLFormat(QGL::NoDeprecatedFunctions); format = QGLFormat(QGL::NoDeprecatedFunctions);
format.setProfile(QGLFormat::CoreProfile); format.setProfile(QGLFormat::CoreProfile);
//format.setVersion(3, 3); format.setVersion(4, 1);
return format; return format;
} }
......
...@@ -99,7 +99,7 @@ namespace cgt { ...@@ -99,7 +99,7 @@ namespace cgt {
#ifdef WIN32 #ifdef WIN32
SetThreadName(HANDLE(_thread->native_handle()), _threadName.c_str()); SetThreadName(HANDLE(_thread->native_handle()), _threadName.c_str());
#else // WIN32 -> must be POSIX #else // WIN32 -> must be POSIX
pthread_setname_np(_thread->native_handle(), _threadName.c_str()); // UNTESTED!! //pthread_setname_np(_thread->native_handle(), _threadName.c_str()); // UNTESTED!!
#endif #endif
} }
} }
......
...@@ -631,7 +631,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena ...@@ -631,7 +631,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
if (!vert->compileShader()) { if (!vert->compileShader()) {
LERROR("Failed to compile vertex shader " << vert_filename); LERROR("Failed to compile vertex shader " << vert_filename);
LERROR("************* Compiler Log *************" << std::endl << vert->getCompilerLog()); LERROR("************* Compiler Log *************" << std::endl << vert->getCompilerLog());
LDEBUG("************* Vertex Shader Code *************" << std::endl << vert->getParsedSource()); LERROR("************* Shader Source dumped to 'FailedShader.vert' \n");
std::ofstream shaderSrcDump("FailedShader.vert");
shaderSrcDump << frag->getParsedSource();
delete vert; delete vert;
throw Exception("Failed to compile vertex shader: " + vert_filename); throw Exception("Failed to compile vertex shader: " + vert_filename);
} }
...@@ -661,7 +663,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena ...@@ -661,7 +663,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
if (!geom->compileShader()) { if (!geom->compileShader()) {
LERROR("Failed to compile geometry shader " << geom_filename); LERROR("Failed to compile geometry shader " << geom_filename);
LERROR("************* Compiler Log *************" << std::endl << geom->getCompilerLog()); LERROR("************* Compiler Log *************" << std::endl << geom->getCompilerLog());
LDEBUG("************* Geometry Shader Code *************" << std::endl << geom->getParsedSource()); LERROR("************* Shader Source dumped to 'FailedShader.geom' \n");
std::ofstream shaderSrcDump("FailedShader.geom");
shaderSrcDump << frag->getParsedSource();
delete vert; delete vert;
delete geom; delete geom;
throw Exception("Failed to compile geometry shader: " + geom_filename); throw Exception("Failed to compile geometry shader: " + geom_filename);
...@@ -697,7 +701,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena ...@@ -697,7 +701,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
if (!frag->compileShader()) { if (!frag->compileShader()) {
LERROR("Failed to compile fragment shader " << frag_filename); LERROR("Failed to compile fragment shader " << frag_filename);
LERROR("************* Compiler Log ************* \n" << frag->getCompilerLog()); LERROR("************* Compiler Log ************* \n" << frag->getCompilerLog());
LDEBUG("************* Fragment Shader Code *************" << std::endl << frag->getParsedSource()); LERROR("************* Shader Source dumped to 'FailedShader.frag' \n");
std::ofstream shaderSrcDump("FailedShader.frag");
shaderSrcDump << frag->getParsedSource();
delete vert; delete vert;
delete geom; delete geom;
delete frag; delete frag;
...@@ -763,7 +769,7 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena ...@@ -763,7 +769,7 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
void Shader::loadCompute(const string& compFilename, const string& customHeader, const string& customGlslVersion) void Shader::loadCompute(const string& compFilename, const string& customHeader, const string& customGlslVersion)
throw (Exception) throw (Exception)
{ {
ShaderObject *comp; ShaderObject *comp = nullptr;
if (!compFilename.empty()) { if (!compFilename.empty()) {
comp = new ShaderObject(compFilename, ShaderObject::COMPUTE_SHADER); comp = new ShaderObject(compFilename, ShaderObject::COMPUTE_SHADER);
...@@ -792,7 +798,9 @@ void Shader::loadCompute(const string& compFilename, const string& customHeader, ...@@ -792,7 +798,9 @@ void Shader::loadCompute(const string& compFilename, const string& customHeader,
if (!comp->compileShader()) { if (!comp->compileShader()) {
LERROR("Failed to compile Compute shader " << compFilename); LERROR("Failed to compile Compute shader " << compFilename);
LERROR("************* Compiler Log *************" << std::endl << comp->getCompilerLog()); LERROR("************* Compiler Log *************" << std::endl << comp->getCompilerLog());
LDEBUG("************* Compute Shader Code *************" << std::endl << comp->getParsedSource()); LERROR("************* Shader Source dumped to 'FailedShader.comp' \n");
std::ofstream shaderSrcDump("FailedShader.comp");
shaderSrcDump << comp->getParsedSource();
delete comp; delete comp;
throw Exception("Failed to compile vertex shader: " + compFilename); throw Exception("Failed to compile vertex shader: " + compFilename);
} }
...@@ -808,7 +816,9 @@ void Shader::loadCompute(const string& compFilename, const string& customHeader, ...@@ -808,7 +816,9 @@ void Shader::loadCompute(const string& compFilename, const string& customHeader,
detachObject(comp); detachObject(comp);
LERROR("************* Linker Log *************\n" << getLinkerLog()); LERROR("************* Linker Log *************\n" << getLinkerLog());
LDEBUG("************* Compute Shader Code *************" << std::endl << comp->getParsedSource()); LERROR("************* Shader Source dumped to 'FailedShader.comp' \n");
std::ofstream shaderSrcDump("FailedShader.comp");
shaderSrcDump << comp->getParsedSource();
throw Exception("Failed to link shader (" + compFilename + ")"); throw Exception("Failed to link shader (" + compFilename + ")");
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
in vec3 ex_TexCoord; in vec3 ex_TexCoord;
layout(location = 0) out vec4 out_Color; layout(location = 0) out vec4 FragData0;
layout(location = 1) out vec4 out_Picking; layout(location = 1) out vec4 out_Picking;
uniform sampler2D _fontTexture; uniform sampler2D _fontTexture;
...@@ -32,6 +32,6 @@ uniform vec4 _color = vec4(1.0, 1.0, 1.0, 1.0); ...@@ -32,6 +32,6 @@ uniform vec4 _color = vec4(1.0, 1.0, 1.0, 1.0);
uniform vec4 _pickingColor = vec4(0.0); uniform vec4 _pickingColor = vec4(0.0);
void main() { void main() {
out_Color = vec4(texture2D(_fontTexture, ex_TexCoord.xy).r) * _color; FragData0 = vec4(texture(_fontTexture, ex_TexCoord.xy).r) * _color;
out_Picking = _pickingColor; out_Picking = _pickingColor;
} }
...@@ -34,7 +34,7 @@ in vec4 geom_Picking; ...@@ -34,7 +34,7 @@ in vec4 geom_Picking;
noperspective in vec3 geom_EdgeDistance; noperspective in vec3 geom_EdgeDistance;
// output fragment color // output fragment color
out vec4 out_Color; out vec4 FragData0;
out vec4 out_Picking; out vec4 out_Picking;
// additional uniforms // additional uniforms
...@@ -52,20 +52,20 @@ uniform TextureParameters2D _textureParams; ...@@ -52,20 +52,20 @@ uniform TextureParameters2D _textureParams;
#endif #endif
void main() { void main() {
out_Color = vec4(1.0, 0.5, 0.0, 1.0); FragData0 = vec4(1.0, 0.5, 0.0, 1.0);
#ifdef ENABLE_TEXTURING #ifdef ENABLE_TEXTURING
out_Color = texture(_texture, geom_TexCoord.xy); FragData0 = texture(_texture, geom_TexCoord.xy);
#else #else
if (_coloringMode == 0) if (_coloringMode == 0)
out_Color = geom_Color; FragData0 = geom_Color;
else if (_coloringMode == 1) else if (_coloringMode == 1)
out_Color = _solidColor; FragData0 = _solidColor;
#endif #endif
#ifdef ENABLE_SHADING #ifdef ENABLE_SHADING
// perform Phong shading // perform Phong shading
out_Color.rgb = calculatePhongShading(geom_Position, _lightSource, _cameraPosition, geom_Normal, out_Color.rgb, out_Color.rgb, vec3(1.0, 1.0, 1.0)); FragData0.rgb = calculatePhongShading(geom_Position, _lightSource, _cameraPosition, geom_Normal, FragData0.rgb, FragData0.rgb, vec3(1.0, 1.0, 1.0));
#endif #endif
#ifdef WIREFRAME_RENDERING #ifdef WIREFRAME_RENDERING
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
float mixVal = smoothstep(_lineWidth - 1.0, _lineWidth + 1.0, d); float mixVal = smoothstep(_lineWidth - 1.0, _lineWidth + 1.0, d);
// Mix the surface color with the line color // Mix the surface color with the line color
out_Color = mix(_wireframeColor, out_Color, mixVal); FragData0 = mix(_wireframeColor, FragData0, mixVal);
#endif #endif
out_Picking = geom_Picking; out_Picking = geom_Picking;
......
...@@ -80,13 +80,13 @@ void main() { ...@@ -80,13 +80,13 @@ void main() {
if (intensity >= _tfDomain.x && intensity <= _tfDomain.y) { if (intensity >= _tfDomain.x && intensity <= _tfDomain.y) {
//result[e] |= (1 << d); //result[e] |= (1 << d);
if (e == 0) if (e == 0)
result.r |= (1 << d); result.r |= uint(1 << d);
else if (e == 1) else if (e == 1)
result.g |= (1 << d); result.g |= uint(1 << d);
else if (e == 2) else if (e == 2)
result.b |= (1 << d); result.b |= uint(1 << d);
else if (e == 3) else if (e == 3)
result.a |= (1 << d); result.a |= uint(1 << d);
break; break;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment