Commit e835e6f7 authored by Jakob Weiss's avatar Jakob Weiss
Browse files

Revert "First steps replacing QGLWidget with QOpenGLWidget - currently crashes and burns horribly"

This reverts commit e7e55015.

# Conflicts:
#	core/glsl/tools/shading.frag
parent c662c17e
Loading
Loading
Loading
Loading
+1 −18
Original line number Diff line number Diff line
@@ -172,20 +172,3 @@ float getPhongShadingIntensity(in vec3 position, in LightSource light, in vec3 c
    #endif
    return (toReturn.x + toReturn.y + toReturn.z) / 3.0;
}
 No newline at end of file

vec3 calculateContourShading(in vec3 position, in vec3 camera, in vec3 normal, in vec3 materialColor, in vec3 outlineColor, in float contourExponent) {
    float outlineStrength = 1. - pow(clamp(-dot(normalize(normal), normalize(position - camera)), 0, 1), contourExponent);
    return mix(materialColor, outlineColor, outlineStrength);
}

vec4 calculateContourShading2(in vec3 position, in vec3 camera, in vec3 normal, in vec4 materialColor, in vec4 outlineColor, in float contourExponent) {
    float outlineStrength = 1. - pow(clamp(dot(normal, normalize(camera - position)), 0, 1), contourExponent);

    return outlineStrength * outlineColor;
}

void blendUnder(inout vec4 colorAbove, in vec4 colorBelow)
{
    colorAbove.rgb = colorAbove.rgb + colorBelow.rgb * colorBelow.a  * (1.0 - colorAbove.a);
    colorAbove.a = colorAbove.a + (1.0 -colorAbove.a) * colorBelow.a;
}
+2 −2
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ namespace campvis {
    CAMPVIS_CORE_API void startOpenGlThreadAndMoveQtThreadAffinity(cgt::Runnable* runnable, cgt::GLCanvas* canvas) {
        // welcome to a complex signalling ping-pong to move the OpenGL context thread affinity
        // we will use targetThread as signalling variable and initialize it with nullptr:
        volatile void* targetThread = nullptr;
        void* targetThread = nullptr;

        // start the new thread with special init function
        runnable->start([&]() {
@@ -120,7 +120,7 @@ namespace campvis {
            std::this_thread::yield();

        // set the QGLContext's thread affinity
        canvas->moveThreadAffinity(const_cast<void*>(targetThread));
        canvas->moveThreadAffinity(targetThread);

        // reset the signal variable so that the new thread can continue.
        targetThread = nullptr;
+0 −11
Original line number Diff line number Diff line
@@ -40,12 +40,6 @@
namespace campvis {
    const std::string AbstractPipeline::loggerCat_ = "CAMPVis.core.datastructures.AbstractPipeline";

    void AbstractPipeline::debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, const void * userParam)
    {
        std::cerr << "**** GL Debug Message Error: " << type << " " << id << " " << severity << " " << std::endl << message << std::endl;
    }


    AbstractPipeline::AbstractPipeline(DataContainer& dc) 
        : HasPropertyCollection()
        , cgt::EventHandler()
@@ -80,11 +74,6 @@ namespace campvis {
        _painter->init();
        initAllProperties();

        glDebugMessageCallback(&debugMessageCallback, this);
        LGL_ERROR;
        glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, true);
        LGL_ERROR;

        // initialize all processors:
        for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
            try {
+0 −4
Original line number Diff line number Diff line
@@ -230,10 +230,6 @@ namespace campvis {
        sigslot::signal0 s_deinit;

    protected:
        /// debug message callback registered to glDebugMessageCallback to catch OpenGL Errors
        static void debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);


        /**
         * Forces the execution of the given processor regardless of its invalidation or enabled state.
         * \param   processor   Processor to execute.
+2 −17
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
 **********************************************************************/

#include "cgt/init.h"
#include "cgt/cgt_gl.h"

#include "cgt/assert.h"
#include "cgt/glcanvas.h"
@@ -101,20 +102,11 @@ void initGL(GLCanvas* backgroundGlContext, InitFeature::Features featureset) {

    TextureManager::init();

    if (featureset & InitFeature::GPU_PROPERTIES) {
    if (featureset & InitFeature::GPU_PROPERTIES )
        GpuCapabilities::init();
#ifdef _MSC_VER
        GpuCapabilitiesWindows::init();
#endif
    }

    // setup debug callback
    if (featureset & InitFeature::GL_DEBUG_CALLBACK) {
        glDebugMessageCallback(&debugMessageCallback, nullptr);
        LGL_ERROR;
        glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, true);
        LGL_ERROR;
    }

    // starting shadermanager
    ShaderManager::init();
@@ -140,11 +132,4 @@ void deinitGL() {

}

void debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, const void * userParam)
{
    std::cerr << "**** GL Debug Message Error: " << type << " " << id << " " << severity << " " << std::endl << message << std::endl;
}

} // namespace

Loading