Commit 3d7df867 authored by Jakob Weiss's avatar Jakob Weiss

Multiple bugfixes concerning platform compat

* FindTBB now reports errors slightly more robustly
* fixed compiler option specification for campvis-application
* fixed minor warning in multiindexedgeometry
* On systems with too low OpenGL support, application reports supported GL version BEFORE crashing if GL version is too low
parent c2259fe8
......@@ -274,15 +274,15 @@ if(NOT TBB_FOUND)
if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
add_library(tbb SHARED IMPORTED)
set_target_properties(tbb PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}
IMPORTED_LOCATION ${TBB_LIBRARIES})
INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}"
IMPORTED_LOCATION "${TBB_LIBRARIES}")
if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
set_target_properties(tbb PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG}
IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE}
IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE}
IMPORTED_LOCATION_DEBUG "${TBB_LIBRARIES_DEBUG}"
IMPORTED_LOCATION_RELWITHDEBINFO "${TBB_LIBRARIES_DEBUG}"
IMPORTED_LOCATION_RELEASE "${TBB_LIBRARIES_RELEASE}"
IMPORTED_LOCATION_MINSIZEREL "${TBB_LIBRARIES_RELEASE}"
)
elseif(TBB_LIBRARIES_RELEASE)
set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
......
......@@ -178,7 +178,7 @@ IF(WIN32)
ELSEIF(UNIX)
LIST(APPEND CampvisGlobalDefinitions "-DUNIX")
LIST(APPEND CampvisGlobalDefinitions "-Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas -Wno-overloaded-virtual")
LIST(APPEND CampvisGlobalDefinitions -Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas -Wno-overloaded-virtual)
LIST(APPEND CampvisGlobalDefinitions "-D__STDC_CONSTANT_MACROS")
# dangerous!
......
......@@ -221,7 +221,7 @@ namespace campvis {
}
// normalize the accumulated normal
for (int i = 0; i < _normals.size(); i++) {
for (size_t i = 0; i < _normals.size(); i++) {
_normals[i] = cgt::normalize(_normals[i]);
}
......
......@@ -120,7 +120,7 @@ namespace campvis {
std::this_thread::yield();
// set the QGLContext's thread affinity
canvas->moveThreadAffinity(targetThread);
canvas->moveThreadAffinity(const_cast<void*>(targetThread));
// reset the signal variable so that the new thread can continue.
targetThread = nullptr;
......
......@@ -56,7 +56,7 @@ namespace cgt {
// Init GLEW for this context
context->acquireAsCurrentContext();
glewExperimental=true; // required in case an old glew version is used
glewExperimental = GL_TRUE; // required in case an old glew version is used
GLenum err = glewInit();
if (err != GLEW_OK) {
// Problem: glewInit failed, something is seriously wrong.
......
......@@ -278,9 +278,6 @@ void GpuCapabilities::detectCapabilities() {
glVendorString_ = string(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
glRendererString_ = string(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
queryExtensions();
// Prevent segfault
const char* glslVS = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
if (glslVS)
......@@ -305,6 +302,8 @@ void GpuCapabilities::detectCapabilities() {
vendor_ = GPU_VENDOR_UNKNOWN;
}
queryExtensions();
// Shaders
shaderSupport_ = (glVersion_ >= GlVersion::CGT_GL_VERSION_2_0);
shaderSupportARB_ = (isExtensionSupported("GL_ARB_vertex_program") &&
......@@ -397,12 +396,14 @@ void GpuCapabilities::queryExtensions()
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
glExtensions_.resize(numExtensions);
for(int i = 0; i < numExtensions; ++i) {
const char* strPtr = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i));
if (strPtr && strPtr[0] != '\0')
glExtensions_[i] = string(strPtr);
else
break;
if(glGetStringi) {
for(int i = 0; i < numExtensions; ++i) {
const char* strPtr = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i));
if (strPtr && strPtr[0] != '\0')
glExtensions_[i] = string(strPtr);
else
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