The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 1a7665e4 authored by Jakob Weiss's avatar Jakob Weiss
Browse files

Merge branch 'campvis-nx' of gitlab.lrz.de:weiss/campvis-nx into campvis-nx

parents 466e5bb9 c9440d71
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# win32: GLEW_LIBRARY_DEBUG, GLEW_LIBRARY_RELEASE, GLEW_DLL_DEBUG, GLEW_DLL_RELEASE, GLEW_LICENSE_FILE # win32: GLEW_LIBRARY_DEBUG, GLEW_LIBRARY_RELEASE, GLEW_DLL_DEBUG, GLEW_DLL_RELEASE, GLEW_LICENSE_FILE
IF (WIN32) IF (WIN32)
SET(GLEW_DIR "${CampvisHome}/ext/glew" CACHE PATH "If glew is not found, set this path") SET(GLEW_DIR "${CampvisHome}/ext/glew-2.0.0" CACHE PATH "If glew is not found, set this path")
# SET(GLEW_DEFINITIONS "-DGLEW_STATIC") # SET(GLEW_DEFINITIONS "-DGLEW_STATIC")
...@@ -14,15 +14,15 @@ IF (WIN32) ...@@ -14,15 +14,15 @@ IF (WIN32)
# set debug and release library # set debug and release library
IF(CAMPVIS_WIN32) IF(CAMPVIS_WIN32)
SET(GLEW_LIBRARY_DEBUG "${GLEW_DIR}/lib/win32/glew32.lib") SET(GLEW_LIBRARY_DEBUG "${GLEW_DIR}/lib/Release/Win32/glew32.lib")
SET(GLEW_DLL_DEBUG "${GLEW_DIR}/lib/win32/glew32.dll") SET(GLEW_DLL_DEBUG "${GLEW_DIR}/bin/Release/Win32/glew32.dll")
SET(GLEW_LIBRARY_RELEASE "${GLEW_DIR}/lib/win32/glew32.lib") SET(GLEW_LIBRARY_RELEASE "${GLEW_DIR}/lib/Release/Win32/glew32.lib")
SET(GLEW_DLL_RELEASE "${GLEW_DIR}/lib/win32/glew32.dll") SET(GLEW_DLL_RELEASE "${GLEW_DIR}/bin/Release/Win32/glew32.dll")
ELSEIF(CAMPVIS_WIN64) ELSEIF(CAMPVIS_WIN64)
SET(GLEW_LIBRARY_DEBUG "${GLEW_DIR}/lib/win64/glew32.lib") SET(GLEW_LIBRARY_DEBUG "${GLEW_DIR}/lib/Release/x64/glew32.lib")
SET(GLEW_DLL_DEBUG "${GLEW_DIR}/lib/win64/glew32.dll") SET(GLEW_DLL_DEBUG "${GLEW_DIR}/bin/Release/x64/glew32.dll")
SET(GLEW_LIBRARY_RELEASE "${GLEW_DIR}/lib/win64/glew32.lib") SET(GLEW_LIBRARY_RELEASE "${GLEW_DIR}/lib/Release/x64/glew32.lib")
SET(GLEW_DLL_RELEASE "${GLEW_DIR}/lib/win64/glew32.dll") SET(GLEW_DLL_RELEASE "${GLEW_DIR}/bin/Release/x64/glew32.dll")
ELSE() ELSE()
MESSAGE(FATAL_ERROR "Neither CAMPVIS_WIN32 nor CAMPVIS_WIN64 defined!") MESSAGE(FATAL_ERROR "Neither CAMPVIS_WIN32 nor CAMPVIS_WIN64 defined!")
ENDIF(CAMPVIS_WIN32) ENDIF(CAMPVIS_WIN32)
...@@ -31,7 +31,7 @@ IF (WIN32) ...@@ -31,7 +31,7 @@ IF (WIN32)
SET(GLEW_LIBRARY debug ${GLEW_LIBRARY_DEBUG} optimized ${GLEW_LIBRARY_RELEASE}) SET(GLEW_LIBRARY debug ${GLEW_LIBRARY_DEBUG} optimized ${GLEW_LIBRARY_RELEASE})
ENDIF(GLEW_LIBRARY_DEBUG AND GLEW_LIBRARY_RELEASE) ENDIF(GLEW_LIBRARY_DEBUG AND GLEW_LIBRARY_RELEASE)
SET(GLEW_LICENSE_FILE "${GLEW_DIR}/license.txt") SET(GLEW_LICENSE_FILE "${GLEW_DIR}/LICENSE.txt")
ELSE (WIN32) ELSE (WIN32)
FIND_PATH( FIND_PATH(
......
...@@ -2,8 +2,8 @@ IF(NOT CommonconfProcessed) ...@@ -2,8 +2,8 @@ IF(NOT CommonconfProcessed)
SET(CampvisHome ${CMAKE_CURRENT_SOURCE_DIR}) SET(CampvisHome ${CMAKE_CURRENT_SOURCE_DIR})
SET(CampvisBinaryDir ${CMAKE_BINARY_DIR}) SET(CampvisBinaryDir ${CMAKE_BINARY_DIR})
MESSAGE(STATUS "TUMVis Source Directory: ${CampvisHome}") MESSAGE(STATUS "CAMPVis Source Directory: ${CampvisHome}")
MESSAGE(STATUS "TUMVis Binary Directory: ${CampvisBinaryDir}") MESSAGE(STATUS "CAMPVis Binary Directory: ${CampvisBinaryDir}")
# include macros # include macros
INCLUDE(${CampvisHome}/cmake/macros.cmake) INCLUDE(${CampvisHome}/cmake/macros.cmake)
......
...@@ -291,16 +291,18 @@ MACRO(COPY_EXTERNAL_DLLS DebugDLLs ReleaseDLLs failOnError) ...@@ -291,16 +291,18 @@ MACRO(COPY_EXTERNAL_DLLS DebugDLLs ReleaseDLLs failOnError)
ENDFOREACH() ENDFOREACH()
SET(release_dir "${CMAKE_BINARY_DIR}/bin/Release") SET(release_dir "${CMAKE_BINARY_DIR}/bin/Release")
SET(minsizerel_dir "${CMAKE_BINARY_DIR}/bin/MinSizeRel")
SET(relwithdebinfo_dir "${CMAKE_BINARY_DIR}/bin/RelWithDebInfo")
IF(NOT EXISTS ${release_dir}) IF(NOT EXISTS ${release_dir})
FILE(MAKE_DIRECTORY ${release_dir}) FILE(MAKE_DIRECTORY ${release_dir})
ENDIF() ENDIF()
FOREACH(dllPath ${${ReleaseDLLs}}) FOREACH(dllPath ${${ReleaseDLLs}})
IF(EXISTS ${dllPath}) IF(EXISTS ${dllPath})
GET_FILENAME_COMPONENT(dllName ${dllPath} NAME) GET_FILENAME_COMPONENT(dllName ${dllPath} NAME)
IF(EXISTS ${release_dir}/${dllName})
FILE(REMOVE ${release_dir}/${dllName})
ENDIF()
FILE(COPY ${dllPath} DESTINATION ${release_dir}) FILE(COPY ${dllPath} DESTINATION ${release_dir})
FILE(COPY ${dllPath} DESTINATION ${minsizerel_dir})
FILE(COPY ${dllPath} DESTINATION ${relwithdebinfo_dir})
ELSEIF(${failOnError}) ELSEIF(${failOnError})
MESSAGE(FATAL_ERROR "Release DLL not found: ${dllPath}") MESSAGE(FATAL_ERROR "Release DLL not found: ${dllPath}")
ELSE() ELSE()
......
...@@ -99,37 +99,9 @@ namespace campvis { ...@@ -99,37 +99,9 @@ namespace campvis {
tempUnit.activate(); tempUnit.activate();
_texture->bind(); _texture->bind();
// map signed integer types from [-1.0:1.0] to [0.0:1.0] in order to avoid clamping of negative values
if (wtp.isInteger() && wtp.isSigned()) {
glPixelTransferf(GL_RED_SCALE, 0.5f);
glPixelTransferf(GL_GREEN_SCALE, 0.5f);
glPixelTransferf(GL_BLUE_SCALE, 0.5f);
glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
glPixelTransferf(GL_RED_BIAS, 0.5f);
glPixelTransferf(GL_GREEN_BIAS, 0.5f);
glPixelTransferf(GL_BLUE_BIAS, 0.5f);
glPixelTransferf(GL_ALPHA_BIAS, 0.5f);
//_mappingInformation.setRealWorldMapping(LinearMapping<float>(.5f, .5f));
}
_texture->uploadTexture(reinterpret_cast<GLubyte*>(wtp._pointer), wtp.getGlFormat(), wtp.getGlDataType()); _texture->uploadTexture(reinterpret_cast<GLubyte*>(wtp._pointer), wtp.getGlFormat(), wtp.getGlDataType());
_texture->setWrapping(cgt::Texture::CLAMP_TO_EDGE); _texture->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
if (wtp.isInteger() && wtp.isSigned()) {
// restore default
glPixelTransferf(GL_RED_SCALE, 1.0f);
glPixelTransferf(GL_GREEN_SCALE, 1.0f);
glPixelTransferf(GL_BLUE_SCALE, 1.0f);
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
glPixelTransferf(GL_RED_BIAS, 0.0f);
glPixelTransferf(GL_GREEN_BIAS, 0.0f);
glPixelTransferf(GL_BLUE_BIAS, 0.0f);
glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
}
cgt::TextureUnit::setZeroUnit(); cgt::TextureUnit::setZeroUnit();
LGL_ERROR; LGL_ERROR;
} }
......
...@@ -239,20 +239,7 @@ namespace campvis { ...@@ -239,20 +239,7 @@ namespace campvis {
cgtAssert(cgt::getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false."); cgtAssert(cgt::getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false.");
cgtAssert(cgt::getGlBool(GL_SCISSOR_TEST) == false, "Invalid OpenGL state after processor execution, GL_SCISSOR_TEST != false."); cgtAssert(cgt::getGlBool(GL_SCISSOR_TEST) == false, "Invalid OpenGL state after processor execution, GL_SCISSOR_TEST != false.");
cgtAssert(cgt::getGlInt(GL_CULL_FACE_MODE) == GL_BACK, "Invalid OpenGL state after processor execution, GL_CULL_FACE_MODE != GL_BACk.");
cgtAssert(cgt::getGlInt(GL_DEPTH_FUNC) == GL_LESS, "Invalid OpenGL state after processor execution, GL_DEPTH_FUNC != GL_LESS."); cgtAssert(cgt::getGlInt(GL_DEPTH_FUNC) == GL_LESS, "Invalid OpenGL state after processor execution, GL_DEPTH_FUNC != GL_LESS.");
cgtAssert(cgt::getGlFloat(GL_DEPTH_CLEAR_VALUE) == 1.f, "Invalid OpenGL state after processor execution, GL_DEPTH_CLEAR_VALUE != 1.f.");
cgtAssert(cgt::getGlFloat(GL_RED_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_RED_SCALE != 1.f.");
cgtAssert(cgt::getGlFloat(GL_GREEN_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_GREEN_SCALE != 1.f.");
cgtAssert(cgt::getGlFloat(GL_BLUE_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_BLUE_SCALE != 1.f.");
cgtAssert(cgt::getGlFloat(GL_ALPHA_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_ALPHA_SCALE != 1.f.");
cgtAssert(cgt::getGlFloat(GL_RED_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_RED_BIAS != 0.f.");
cgtAssert(cgt::getGlFloat(GL_GREEN_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_GREEN_BIAS != 0.f.");
cgtAssert(cgt::getGlFloat(GL_BLUE_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_BLUE_BIAS != 0.f.");
cgtAssert(cgt::getGlFloat(GL_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f.");
#endif #endif
} }
......
...@@ -33,14 +33,13 @@ ...@@ -33,14 +33,13 @@
namespace cgt { namespace cgt {
GLenum _lGLError(int line, const char* file) { GLenum _lGLError(int line, const char* file) {
GLenum err = glGetError(); GLenum err;
while ((err = glGetError()) != GL_NO_ERROR) {
if (err != GL_NO_ERROR) { std::string exp = getErrorString(err);
const GLubyte* exp = gluErrorString(err);
std::ostringstream tmp1, tmp2, loggerCat; std::ostringstream tmp1, tmp2, loggerCat;
tmp2 << " File: " << file << "@" << line; tmp2 << " File: " << file << "@" << line;
tmp1 << (exp ? (const char*) exp : "unknown"); tmp1 << exp;
loggerCat << "gl-error:" << file << ':' << line; loggerCat << "gl-error:" << file << ':' << line;
LogMgr.log(loggerCat.str(), cgt::Error, tmp1.str(), tmp2.str()); LogMgr.log(loggerCat.str(), cgt::Error, tmp1.str(), tmp2.str());
...@@ -67,4 +66,28 @@ GLfloat getGlFloat(GLenum param) { ...@@ -67,4 +66,28 @@ GLfloat getGlFloat(GLenum param) {
return toReturn; return toReturn;
} }
CGT_API const char* getErrorString(GLenum err)
{
switch (err) {
case GL_NO_ERROR:
return "GL_NO_ERROR: No error has been recorded.";
case GL_INVALID_ENUM:
return "GL_INVALID_ENUM: An unacceptable value is specified for an enumerated argument.";
case GL_INVALID_VALUE:
return "GL_INVALID_VALUE: A numeric argument is out of range.";
case GL_INVALID_OPERATION:
return "GL_INVALID_OPERATION: The specified operation is not allowed in the current state.";
case GL_INVALID_FRAMEBUFFER_OPERATION:
return "GL_INVALID_FRAMEBUFFER_OPERATION: The framebuffer object is not complete.";
case GL_OUT_OF_MEMORY:
return "GL_OUT_OF_MEMORY: There is not enough memory left to execute the command.";
case GL_STACK_UNDERFLOW:
return "GL_STACK_UNDERFLOW: An attempt has been made to perform an operation that would cause an internal stack to underflow.";
case GL_STACK_OVERFLOW:
return "GL_STACK_OVERFLOW: An attempt has been made to perform an operation that would cause an internal stack to overflow.";
default:
return "UNKNOWN: An unknown error occurred or the enum is not an error code.";
}
}
} // namespace cgt } // namespace cgt
...@@ -45,11 +45,18 @@ ...@@ -45,11 +45,18 @@
namespace cgt { namespace cgt {
CGT_API GLenum _lGLError(int line, const char* file); CGT_API GLenum _lGLError(int line, const char* file);
CGT_API GLboolean getGlBool(GLenum param);; CGT_API GLboolean getGlBool(GLenum param);
CGT_API GLint getGlInt(GLenum param);; CGT_API GLint getGlInt(GLenum param);
CGT_API GLfloat getGlFloat(GLenum param); CGT_API GLfloat getGlFloat(GLenum param);
/**
* Maps an GLenum returned by glGetError() to a humanly readable string.
* Essentially, this is a replacement for gluErrorString()
* \param err see https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glGetError.xml
*/
CGT_API const char* getErrorString(GLenum err);
} // namespace cgt } // namespace cgt
#ifdef CGT_DEBUG #ifdef CGT_DEBUG
......
...@@ -45,7 +45,7 @@ FramebufferObject::FramebufferObject() ...@@ -45,7 +45,7 @@ FramebufferObject::FramebufferObject()
FramebufferObject::~FramebufferObject() FramebufferObject::~FramebufferObject()
{ {
glDeleteFramebuffersEXT(1, &id_); glDeleteFramebuffers(1, &id_);
} }
void FramebufferObject::activate() void FramebufferObject::activate()
...@@ -55,13 +55,13 @@ void FramebufferObject::activate() ...@@ -55,13 +55,13 @@ void FramebufferObject::activate()
LWARNING("Binding a new FBO while another FBO is bound. Do you really want to do this?"); LWARNING("Binding a new FBO while another FBO is bound. Do you really want to do this?");
#endif #endif
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id_); glBindFramebuffer(GL_FRAMEBUFFER, id_);
LGL_ERROR; LGL_ERROR;
} }
void FramebufferObject::deactivate() void FramebufferObject::deactivate()
{ {
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
LGL_ERROR; LGL_ERROR;
} }
...@@ -69,16 +69,16 @@ void FramebufferObject::attachTexture(Texture* texture, GLenum attachment, int m ...@@ -69,16 +69,16 @@ void FramebufferObject::attachTexture(Texture* texture, GLenum attachment, int m
{ {
switch(texture->getType()) { switch(texture->getType()) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
glFramebufferTexture1DEXT( GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_1D, texture->getId(), mipLevel ); glFramebufferTexture1D( GL_FRAMEBUFFER, attachment, GL_TEXTURE_1D, texture->getId(), mipLevel );
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
glFramebufferTexture3DEXT( GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_3D, texture->getId(), mipLevel, zSlice ); glFramebufferTexture3D( GL_FRAMEBUFFER, attachment, GL_TEXTURE_3D, texture->getId(), mipLevel, zSlice );
break; break;
case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_2D_ARRAY:
glFramebufferTextureLayerEXT( GL_FRAMEBUFFER_EXT, attachment, texture->getId(), mipLevel, zSlice ); glFramebufferTextureLayer( GL_FRAMEBUFFER, attachment, texture->getId(), mipLevel, zSlice );
break; break;
default: //GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE default: //GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachment, texture->getType(), texture->getId(), mipLevel ); glFramebufferTexture2D( GL_FRAMEBUFFER, attachment, texture->getType(), texture->getId(), mipLevel );
break; break;
} }
LGL_ERROR; LGL_ERROR;
...@@ -102,16 +102,16 @@ void FramebufferObject::detachTexture(GLenum attachment) { ...@@ -102,16 +102,16 @@ void FramebufferObject::detachTexture(GLenum attachment) {
if (attachments_[index] != 0) { if (attachments_[index] != 0) {
switch (attachments_[index]->getType()) { switch (attachments_[index]->getType()) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_1D, 0, 0); glFramebufferTexture1D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_1D, 0, 0);
break; break;
case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_2D_ARRAY:
glFramebufferTextureLayerEXT(GL_FRAMEBUFFER_EXT, attachment, 0, 0, 0); glFramebufferTextureLayerEXT(GL_FRAMEBUFFER, attachment, 0, 0, 0);
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_3D, 0, 0, 0); glFramebufferTexture3D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_3D, 0, 0, 0);
break; break;
default: // GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE default: // GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, 0, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, 0, 0);
break; break;
} }
attachments_[index] = 0; attachments_[index] = 0;
...@@ -142,31 +142,31 @@ bool FramebufferObject::isComplete() const ...@@ -142,31 +142,31 @@ bool FramebufferObject::isComplete() const
{ {
bool complete = false; bool complete = false;
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
switch(status) { switch(status) {
case GL_FRAMEBUFFER_COMPLETE_EXT: case GL_FRAMEBUFFER_COMPLETE:
complete = true; complete = true;
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
LERROR("GL_FRAMEBUFFER_EXT_INCOMPLETE_ATTACHMENT"); LERROR("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
LERROR("GL_FRAMEBUFFER_EXT_INCOMPLETE_MISSING_ATTACHMENT"); LERROR("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
LERROR("GL_FRAMEBUFFER_EXT_INCOMPLETE_DIMENSIONS"); LERROR("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE");
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: case GL_FRAMEBUFFER_UNDEFINED:
LERROR("GL_FRAMEBUFFER_EXT_INCOMPLETE_FORMATS"); LERROR("GL_FRAMEBUFFER_UNDEFINED ");
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
LERROR("GL_FRAMEBUFFER_EXT_INCOMPLETE_DRAW_BUFFER"); LERROR("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER");
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
LERROR("GL_FRAMEBUFFER_EXT_INCOMPLETE_READ_BUFFER"); LERROR("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER");
break; break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT: case GL_FRAMEBUFFER_UNSUPPORTED:
LERROR("GL_FRAMEBUFFER_EXT_UNSUPPORTED"); LERROR("GL_FRAMEBUFFER_UNSUPPORTED");
break; break;
default: default:
LERROR("Unknown error!"); LERROR("Unknown error!");
...@@ -180,13 +180,13 @@ bool FramebufferObject::isActive() const { ...@@ -180,13 +180,13 @@ bool FramebufferObject::isActive() const {
GLuint FramebufferObject::getActiveObject() { GLuint FramebufferObject::getActiveObject() {
GLint fbo; GLint fbo;
glGetIntegerv (GL_FRAMEBUFFER_BINDING_EXT, &fbo); glGetIntegerv (GL_FRAMEBUFFER_BINDING, &fbo);
return static_cast<GLuint>(fbo); return static_cast<GLuint>(fbo);
} }
GLuint FramebufferObject::generateId() { GLuint FramebufferObject::generateId() {
id_ = 0; id_ = 0;
glGenFramebuffersEXT(1, &id_); glGenFramebuffers(1, &id_);
LGL_ERROR; LGL_ERROR;
return id_; return id_;
} }
......
...@@ -80,7 +80,7 @@ std::string GpuCapabilities::getVendorAsString() { ...@@ -80,7 +80,7 @@ std::string GpuCapabilities::getVendorAsString() {
} }
bool GpuCapabilities::isExtensionSupported(string extension) { bool GpuCapabilities::isExtensionSupported(string extension) {
return (glExtensionsString_.find(extension) != string::npos); return (std::find(glExtensions_.begin(), glExtensions_.end(), extension) != glExtensions_.end());
} }
string GpuCapabilities::getGlVersionString() { string GpuCapabilities::getGlVersionString() {
...@@ -99,8 +99,8 @@ string GpuCapabilities::getShadingLanguageVersionString() { ...@@ -99,8 +99,8 @@ string GpuCapabilities::getShadingLanguageVersionString() {
return glslVersionString_; return glslVersionString_;
} }
string GpuCapabilities::getGlExtensionsString() { const std::vector<string>& GpuCapabilities::getGlExtensions() {
return glExtensionsString_; return glExtensions_;
} }
bool GpuCapabilities::areShadersSupported() { bool GpuCapabilities::areShadersSupported() {
...@@ -190,8 +190,13 @@ void GpuCapabilities::logCapabilities(bool extensionsString, bool osString) { ...@@ -190,8 +190,13 @@ void GpuCapabilities::logCapabilities(bool extensionsString, bool osString) {
} }
LINFO("GPU Vendor: " << glVendorString_ << " (" << getVendorAsString() << ")"); LINFO("GPU Vendor: " << glVendorString_ << " (" << getVendorAsString() << ")");
if (extensionsString) if (extensionsString) {
LINFO("OpenGL Extensions: " << glExtensionsString_); std::stringstream exts;
for (auto& s : glExtensions_) {
exts << "\t" << s << std::endl;
}
LINFO("OpenGL Extensions: " << std::endl << exts.str());
}
stringstream features; stringstream features;
features << "Texturing: " << (isOpenGlVersionSupported(GlVersion::CGT_GL_VERSION_1_1) ? "yes" : "no"); features << "Texturing: " << (isOpenGlVersionSupported(GlVersion::CGT_GL_VERSION_1_1) ? "yes" : "no");
...@@ -271,7 +276,9 @@ void GpuCapabilities::detectCapabilities() { ...@@ -271,7 +276,9 @@ void GpuCapabilities::detectCapabilities() {
glVersionString_ = string(reinterpret_cast<const char*>(glGetString(GL_VERSION))); glVersionString_ = string(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
glVendorString_ = string(reinterpret_cast<const char*>(glGetString(GL_VENDOR))); glVendorString_ = string(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
glRendererString_ = string(reinterpret_cast<const char*>(glGetString(GL_RENDERER))); glRendererString_ = string(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
glExtensionsString_ = string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
queryExtensions();
// Prevent segfault // Prevent segfault
const char* glslVS = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)); const char* glslVS = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
...@@ -338,14 +345,10 @@ void GpuCapabilities::detectCapabilities() { ...@@ -338,14 +345,10 @@ void GpuCapabilities::detectCapabilities() {
max3DTexSize_ = 0; max3DTexSize_ = 0;
} }
// see http://developer.nvidia.com/object/General_FAQ.html#t6
// for information about texture units
numTextureUnits_ = -1;
if (isExtensionSupported("GL_ARB_fragment_program"))
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, (GLint *) &numTextureUnits_);
if (numTextureUnits_ < 0) numTextureUnits_ = -1;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, (GLint *) &numTextureUnits_); if (glVersion_ >= GlVersion::CGT_GL_VERSION_3_0)
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *) &numTextureUnits_);
glGetIntegerv(GL_MAX_IMAGE_UNITS, (GLint*)&numImageUnits_); glGetIntegerv(GL_MAX_IMAGE_UNITS, (GLint*)&numImageUnits_);
...@@ -387,6 +390,21 @@ void GpuCapabilities::detectCapabilities() { ...@@ -387,6 +390,21 @@ void GpuCapabilities::detectCapabilities() {
} }
void GpuCapabilities::queryExtensions()
{
GLint numExtensions;
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;
}
}
void GpuCapabilities::detectOS() { void GpuCapabilities::detectOS() {
osVersion_ = OS_UNKNOWN; osVersion_ = OS_UNKNOWN;
osVersionString_ = "unknown"; osVersionString_ = "unknown";
...@@ -429,6 +447,18 @@ void GpuCapabilities::detectOS() { ...@@ -429,6 +447,18 @@ void GpuCapabilities::detectOS() {
osVersion_ = OS_WIN_7; osVersion_ = OS_WIN_7;
oss << "Windows 7"; oss << "Windows 7";
} }
else if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) {
osVersion_ = OS_WIN_8;
oss << "Windows 8";
}
else if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3) {
osVersion_ = OS_WIN_8_1;
oss << "Windows 8.1";
}
else if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0) {
osVersion_ = OS_WIN_10;
oss << "Windows 10";
}
else { else {
oss << "unknown Windows version " << osvi.dwMajorVersion << "." << osvi.dwMinorVersion; oss << "unknown Windows version " << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define CGT_GPUCAPABILITIES_H #define CGT_GPUCAPABILITIES_H
#include <string> #include <string>
#include <vector>
#include "cgt/singleton.h" #include "cgt/singleton.h"
#include "cgt/cgt_gl.h" #include "cgt/cgt_gl.h"
...@@ -170,6 +171,9 @@ public: ...@@ -170,6 +171,9 @@ public:
OS_WIN_SERVER_2003, OS_WIN_SERVER_2003,
OS_WIN_SERVER_2008, OS_WIN_SERVER_2008,
OS_WIN_7, OS_WIN_7,
OS_WIN_8,
OS_WIN_8_1,
OS_WIN_10,
OS_POSIX ///< For Linux and other POSIX-like OS. Have a look at getOSVersionString for details. OS_POSIX ///< For Linux and other POSIX-like OS. Have a look at getOSVersionString for details.
}; };