Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: win10 trouble

  1. #11
    Junior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101
    hi dp,
    I'll scrutinize the points you've pointed out.
    I've hoped to get a transportable pc/low power-consumption (to power with a solar cell in the field) to be able to leave home and work elsewhere. The first laptop was a rather expensive one, but second hand, the second one the cheapest you can get. There doesn't seem to be any difference between the errors they throw on the program - the cheap one does not fault on the solar recharging though, but this is off topic. Due to my goal, the setup has already provoked a cascade of doobious investments that has made me touchy. Both of the pc's are Lenovo (thinkpad/ideapad) and with 'intel inside' .. it's hard to think of win10 and Intel foul up their corporation, but I'll certainly take a look at it. None of the pc's contains the word opengl, but you know how it is. The net and my pcs are in two different places, but I'll let you know later.
    Thank you for responding.

  2. #12
    Junior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101
    hi dp,
    I've copy-pasted some usable samplecode for erecting initiation to test the shader that does not work. In the process I happened to notice GLEW_EXPERIMENTAL=true … This could be an obvious error in the forward-context problem. I'll have to do some running back & forth to check the version of glew I'm using.

    ---- app fouled up trying to bring sample-code
    Last edited by CarstenT; 11-20-2018 at 06:14 AM.

  3. #13
    Junior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101
    hi dp,
    This editor failed my first attempt to add sample-code.
    Here is a copy-paste of the original functions used. The GLFW & GLEW versions used are are still the latest versions released.
    Vertex-shaders passes compilation and even the simplest fragment-shader does not. The pc that compiles the .exe has a 'real' graphics-card (navidia).

    -- ugly code-warning --
    I have classed all the 'program-stuff' into a base and derived classes.
    "glSystem::gui_program* p_gui =new glSystem::gui_program;"
    is such a derivate. The gui_program.mBuffer-struct holds all the id's (program,VAO..), and much more

    Code cpp:
    GLFWwindow *initGlfw(const char* titl){
        if (!glfwInit())
        {
            std::cout << "initting glfw failed\n" << std::endl ;
            exit(EXIT_FAILURE);
            return NULL;
        }
        else{
            std::cout << "glfw is initiating \n" << std::endl ;
        }
        glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
        glfwWindowHint(GLFW_CLIENT_API,GLFW_OPENGL_API ) ;
        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT , GL_TRUE );
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwWindowHint(GLFW_RED_BITS, 8 );
        glfwWindowHint(GLFW_GREEN_BITS, 8 );
        glfwWindowHint(GLFW_BLUE_BITS, 8 );
        glfwWindowHint(GLFW_ALPHA_BITS, 8 );
        glfwWindowHint(GLFW_DEPTH_BITS, 24 );
        glfwWindowHint(GLFW_DOUBLEBUFFER, GL_TRUE );
        GLFWwindow *m_window = glfwCreateWindow((int) sys::s.paneWidth, (int)sys::s.paneHeight, titl , NULL, NULL);
        if (!m_window)
        {
            glfwTerminate();
            std::cout << "init window failed\n" << std::endl ;
            exit(EXIT_FAILURE);
            return NULL;
        }
        else{
            std::cout << "init window should be sucessfull\n" << std::endl ;
        }
        glfwMakeContextCurrent(m_window);
     
        return m_window;
    }
     
     
     
     
     
     
     
     
    glSystem::gui_program* get_GUI(){
        cout << "builds get_GUI()\n";
        glSystem::gui_program* p_gui =new glSystem::gui_program;
        vt.add_type(geometry::eVertexComponent:Position);
        p_gui->setVertexType(vt);
        p_gui->add_uniform_name("color",glSystem::eUnifType::vec4);
     
        p_gui->add_uniform_name("matrix",glSystem::eUnifType::matrix);
        p_gui->add_uniform_name("offset",glSystem::eUnifType::vec4);
        p_gui->add_uniform_name("utility",glSystem::eUnifType::ivec4);
        p_gui->vertex_shader_string=
            "#version 330 core \n"
            "precision highp int;\n"
            "precision highp float;\n"
            "layout(location = 0) in vec4 position; \n"
            "uniform vec4 color; \n"
            "uniform mat4 matrix; \n"
            "uniform vec4 offset; \n"
            "uniform ivec4 utility;\n"
            "vec4 tmp ; \n"
            "vec4 tmp_2 ; \n"
            "flat out vec4 coll;\n"
            "void main()\n"
            "{\n"
            " tmp_2 = position+offset ;\n"
            " tmp = matrix*tmp_2 ;\n"
     
            " tmp.w = 1.0;\n"
            " coll = color ;\n"
            " if(utility.y==1){coll.w=0.5;} ;\n"
            " gl_Position= tmp ;\n"
            "}\n";
     
        p_gui->fragment_shader_string=
            "#version 330 core \n"
            "precision highp int;\n"
            "precision highp float;\n"
            "flat in vec4 coll;\n"
            "flat out vec4 FragColor;\n"//compile-error:not exportable(cannot be interpolated in win10)
            "void main(){ \n"
            "     FragColor = coll ;\n"
            "}\n";
     
        sys::makeSysProgram(p_gui,GL_FALSE);
     
        p_gui->init_locations();
     
        vector<GLuint> e(6*64,0);
        e.at(1)=1;
        e.at(2)=2;
        e.at(4)=2;
        e.at(5)=3;
        for(GLuint i=1;i<64;i++){
            e.at(i*6 + 0) = e.at(0) + 4*i ;
            e.at(i*6 + 1) = e.at(1) + 4*i ;
            e.at(i*6 + 2) = e.at(2) + 4*i ;
            e.at(i*6 + 3) = e.at(3) + 4*i ;
            e.at(i*6 + 4) = e.at(4) + 4*i ;
            e.at(i*6 + 5) = e.at(5) + 4*i ;
        }
        p_gui->allocate_indices(e);
        return p_gui;
    }
     
     
     
     
     
     
    GLuint loadProgram( glSystem:Program_base* sProg, GLboolean bTransfFeed ){
        cout << "enters loadProgram\n";
        sProg->mBuffer.Program=glCreateProgram();
        GLuint vertShader;
        try
        {
            vertShader = loadShader( sProg->vertex_shader_string, eShader::eVertex ) ;
            sys::checkErrors("loadProgram_VerShader err? : ") ;
        }
        catch(std::exception &e){std::cout << "an exception ocurred in vertShader:\n " << e.what() << std::endl ;}
        glAttachShader(sProg->mBuffer.Program, vertShader);
        cout << "loadProgram created vertShader: " << vertShader << "\n";
     
        GLuint fragShader;
     
        try
        {
            fragShader = loadShader( sProg->fragment_shader_string,eShader::eFragment ) ;
            sys::checkErrors("loadProgram_FragShader err? : ") ;
        }
        catch(std::exception &e){ std::cout << "an exception ocurred in eFragment:\n " << e.what() << std::endl ;}
        glAttachShader(sProg->mBuffer.Program, fragShader);
        cout << "loadProgram created fragShader: " << fragShader << "\n";
        if(bTransfFeed){
            glTransformFeedbackVaryings(sProg->mBuffer.Program,1,attribNames,GL_SEPARATE_ATTRIBS);
            sys::checkErrors("loadProgram glTransformFeedbackVaryings err? : ") ;
        }
     
        glLinkProgram(sProg->mBuffer.Program) ;
        sys::checkErrors("loadProgram link err? : ") ;
        GLint status1;
        glGetProgramiv (sProg->mBuffer.Program, GL_LINK_STATUS, &status1);
        if (status1 == GL_FALSE){
            checkErrors("loadProgram after linking ") ;
            std::cout << "Shader status NOT ok\n" << std::endl ;
            char infoLog[1024];
            glGetProgramInfoLog(sProg->mBuffer.Program, 1024, NULL, infoLog) ;
            std::cout << "shader failed with error : \n" << infoLog << std::endl ;
            GLuint err =0;
            std::cerr << stderr << " Error: \n" << glewGetErrorString(err) << std::endl ;
            glDeleteProgram(sProg->mBuffer.Program) ;
            glDeleteShader(vertShader);
            glDeleteShader(fragShader);
            throw std::runtime_error("Shader could not be linked.\n");
            glfwTerminate();
            exit(1);
        }
        else{ }
     
        GLint verif;
        char infoLog[1024];
        glValidateProgram(sProg->mBuffer.Program);
        glGetProgramiv(sProg->mBuffer.Program,GL_VALIDATE_STATUS,&verif);
        if(verif==true){}
        else{ std::cout << "shader.verification NOT ok" << endl ; }
        glGetProgramInfoLog(sProg->mBuffer.Program, 1024, NULL, infoLog) ;
        std::cout << "ValidationLog : \n" << infoLog <<std::endl ;
     
        glDeleteShader(vertShader);
        glDeleteShader(fragShader);
        sys::checkErrors("loadProgram exit err? : ") ;
        return sProg->mBuffer.Program ;
    }
    Last edited by Dark Photon; 11-25-2018 at 02:19 PM.

  4. #14
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    890
    Quote Originally Posted by Carsten
    To recap: I've build a program... that does run flawless, but not on another laptop win10

    It's building the fragmentshader that fails.
    Code :
    flat out vec4 FragColor;\n"
    the error it spawns is at line 5: flat out vec4 FragColor;
    Oddly enough the short error refers to 'FragUserData' (..cannot be interpolated') and not the name of the variable.

    Code :
    "uniform samplerRect aTexture;\n"
    the error here is at line 4, where the errorstring do refer to the variable by it's name 'aTexture'.
    [/CODE]
    So, you've written shaders that compile on an Nvidia driver, but fail on another laptop with Intel graphics.

    And what have you done to debug this?

    Have you tried reading the instructions?
    For example, look at page 27 in the GLSL 3.30 specification, Section 4.3 "Storage Qualifiers", where it says:
    These interpolation qualifiers ... do not apply to inputs into a vertex shader or outputs from a fragment shader.
    Indeed, copy-pasting your shader here on OS X, a "flat" fragment output fails to compile:
    Code :
    ERROR: 0:5: Invalid qualifiers 'flat' in global variable context

    Or, for another easy second-opinion verification, you could paste your shader into Shader Playground (a godbolt-like website for shader compilers). Khronos's glslang compiler there also errors as expected:
    Code :
    ERROR: ...tmp:5: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output


    Similarly, look for "samplerRect" in the GLSL specification. It doesn't exist, does it? But look at page 14 "Variables and Types", where all the sampler types are listed, including sampler2DRect.

    The expected behavior when you type in a malformed shader is compilation failure. You'll need to fix your shaders to follow the documented syntax if you want them to compile.

    (If they actually are compiling on an Nvidia driver, that driver is broken.)

  5. #15
    Junior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101
    doo, am I releaved..
    I have got error-response that did not repeat and that was not handled by me .. maybe the pc has been 'wise' about what it runs, and has capacity to do something, I don't know. Making all this fuss about a program that fails and where I could error-track on the other pc would be insane .. it works perfectly there. I'll send you a thumbs up when I've error-corrected to a working program.

    I'm very greatful.
    Carsten

  6. #16
    Junior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101
    8oO .. it works ..
    I'm down on my knees in awe and admiration.
    Just changed the three words.
    I've made an algorithm that splits a contour-array (covering an irregular polygon with islands) into an array of geometric fan-data, to be processed in opengl for your choosing, or elsewhere. The test-app, including fonts and text, is of my own doing and all spans +50000 lines. The only good thing to say about it is, that it works. I have still not figured out if it solves a problem of generel interest.

    I deeply appreciate your intervention
    Carsten

    I've tried to attach an image of the app and how far it can go: a screenful of hand-clicked polygon-points:

    Click image for larger version. 

Name:	test_app.jpg 
Views:	44 
Size:	98.0 KB 
ID:	2883

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •