Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

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

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
CMakeCache.txt
CMakeLists.txt.user
CMakeFiles
cmake_install.cmake
Makefile
/core/gen_converterregistration.h
/modules/gen_pipelineregistration.h
FailedShader.vert
FailedShader.geom
FailedShader.frag
FailedShader.comp
# Files generated by Qt's moc and uic
moc_*.cxx
......@@ -53,3 +58,7 @@ ext/tbb
build*/
.vs/
.vscode/
# Mac specific
.DS_Store
......@@ -184,7 +184,7 @@ ELSEIF(UNIX)
# dangerous!
LIST(APPEND CampvisGlobalDefinitions "-Wno-deprecated-declarations")
LIST(APPEND CampvisGlobalExternalLibs "-pthread")
LIST(APPEND CampvisGlobalExternalLibs "pthread")
ELSE()
ENDIF(WIN32)
......@@ -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:
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5OpenGL REQUIRED)
FIND_PACKAGE(Qt5 COMPONENTS Widgets OpenGL REQUIRED)
RESOLVE_QT5_DLL_LOCATIONS("Core;Gui;OpenGL;Widgets")
......
......@@ -24,8 +24,8 @@
in vec4 ex_Color; ///< incoming color
out vec4 out_Color;
out vec4 FragData0;
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
vec3 t2 = max(tMin, tMax);
float tNear = max(max(t1.x, t1.y), t1.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.
......
......@@ -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.");
}
ShdrMgr.setDefaultGlslVersion("430");
ShdrMgr.setDefaultGlslVersion("410");
for (auto it = searchPaths.cbegin(); it != searchPaths.cend(); ++it) {
ShdrMgr.addPath(*it);
ShdrMgr.addPath(*it + "/core/glsl");
......
......@@ -273,7 +273,7 @@ QGLFormat QtCanvas::getQGLFormat()
QGLFormat format = QGLFormat(QGL::NoDeprecatedFunctions);
format = QGLFormat(QGL::NoDeprecatedFunctions);
format.setProfile(QGLFormat::CoreProfile);
//format.setVersion(3, 3);
format.setVersion(4, 1);
return format;
}
......
......@@ -99,7 +99,7 @@ namespace cgt {
#ifdef WIN32
SetThreadName(HANDLE(_thread->native_handle()), _threadName.c_str());
#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
}
}
......
......@@ -631,7 +631,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
if (!vert->compileShader()) {
LERROR("Failed to compile vertex shader " << vert_filename);
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;
throw Exception("Failed to compile vertex shader: " + vert_filename);
}
......@@ -661,7 +663,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
if (!geom->compileShader()) {
LERROR("Failed to compile geometry shader " << geom_filename);
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 geom;
throw Exception("Failed to compile geometry shader: " + geom_filename);
......@@ -697,7 +701,9 @@ void Shader::loadSeparate(const string& vert_filename, const string& geom_filena
if (!frag->compileShader()) {
LERROR("Failed to compile fragment shader " << frag_filename);
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 geom;
delete frag;
......@@ -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)
throw (Exception)
{
ShaderObject *comp;
ShaderObject *comp = nullptr;
if (!compFilename.empty()) {
comp = new ShaderObject(compFilename, ShaderObject::COMPUTE_SHADER);
......@@ -792,7 +798,9 @@ void Shader::loadCompute(const string& compFilename, const string& customHeader,
if (!comp->compileShader()) {
LERROR("Failed to compile Compute shader " << compFilename);
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;
throw Exception("Failed to compile vertex shader: " + compFilename);
}
......@@ -808,7 +816,9 @@ void Shader::loadCompute(const string& compFilename, const string& customHeader,
detachObject(comp);
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 + ")");
}
......
......@@ -24,7 +24,7 @@
in vec3 ex_TexCoord;
layout(location = 0) out vec4 out_Color;
layout(location = 0) out vec4 FragData0;
layout(location = 1) out vec4 out_Picking;
uniform sampler2D _fontTexture;
......@@ -32,6 +32,6 @@ uniform vec4 _color = vec4(1.0, 1.0, 1.0, 1.0);
uniform vec4 _pickingColor = vec4(0.0);
void main() {
out_Color = vec4(texture2D(_fontTexture, ex_TexCoord.xy).r) * _color;
FragData0 = vec4(texture(_fontTexture, ex_TexCoord.xy).r) * _color;
out_Picking = _pickingColor;
}
......@@ -34,7 +34,7 @@ in vec4 geom_Picking;
noperspective in vec3 geom_EdgeDistance;
// output fragment color
out vec4 out_Color;
out vec4 FragData0;
out vec4 out_Picking;
// additional uniforms
......@@ -52,20 +52,20 @@ uniform TextureParameters2D _textureParams;
#endif
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
out_Color = texture(_texture, geom_TexCoord.xy);
FragData0 = texture(_texture, geom_TexCoord.xy);
#else
if (_coloringMode == 0)
out_Color = geom_Color;
FragData0 = geom_Color;
else if (_coloringMode == 1)
out_Color = _solidColor;
FragData0 = _solidColor;
#endif
#ifdef ENABLE_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
#ifdef WIREFRAME_RENDERING
......@@ -76,7 +76,7 @@ void main() {
float mixVal = smoothstep(_lineWidth - 1.0, _lineWidth + 1.0, d);
// Mix the surface color with the line color
out_Color = mix(_wireframeColor, out_Color, mixVal);
FragData0 = mix(_wireframeColor, FragData0, mixVal);
#endif
out_Picking = geom_Picking;
......
......@@ -80,13 +80,13 @@ void main() {
if (intensity >= _tfDomain.x && intensity <= _tfDomain.y) {
//result[e] |= (1 << d);
if (e == 0)
result.r |= (1 << d);
result.r |= uint(1 << d);
else if (e == 1)
result.g |= (1 << d);
result.g |= uint(1 << d);
else if (e == 2)
result.b |= (1 << d);
result.b |= uint(1 << d);
else if (e == 3)
result.a |= (1 << d);
result.a |= uint(1 << d);
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