Card supports OpenGL 4.1 but no GL4 implementation on thread?

前端 未结 2 1446
旧时难觅i
旧时难觅i 2021-01-22 11:53

When I run my test JOGL app, it says that I only have GL2 available on the thread when my system supports up to OpenGL 4.1 according to the OpenGl Extensions Vi

相关标签:
2条回答
  • 2021-01-22 12:39

    For running the book's examples on a Mac, I have placed instructions on this website: http://athena.ecs.csus.edu/~gordonvs/errataMac.html

    In summary, you need to:

    • make sure you've installed the latest Java SE
    • place the relevant JOGL libraries into System/Library/Java/Extensions (the particular ones required are listed in the above website)
    • add the code described above by Julien (thanks!)
    • change the version numbers on the shaders to 410 (or whatever your Mac supports)
    • in the examples that use textures, replace the binding layout qualifiers in the shaders to appropriate calls to glUniform1i() in the Java application (for compatibility with version 4.1)

    If more idiosyncrasies are identified, I'll add them to the instructions in the website.

    0 讨论(0)
  • 2021-01-22 12:42

    It turns out that OSX falls back to OpenGL 2.1 so you need to set the core profile yourself.

    $ glxinfo | grep OpenGL
    OpenGL vendor string: ATI Technologies Inc.
    OpenGL renderer string: AMD Radeon R9 M370X OpenGL Engine
    OpenGL version string: 2.1 ATI-1.42.15
    OpenGL shading language version string: 1.20
    

    I was able to set the core version (OpenGL 4.1) by passing GLCapabilities into the GLCanvas constructor.

    Here is the new, fixed constructor:

    public Code() {
        setTitle("Chapter 2 - program1");
        setSize(600, 400);
        setLocation(200, 200);
    
        // This was the fix
        GLProfile glp = GLProfile.getMaxProgrammableCore(true);
        GLCapabilities caps = new GLCapabilities(glp);
        myCanvas = new GLCanvas(caps);
    
        myCanvas.addGLEventListener(this);
        this.add(myCanvas);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }
    
    0 讨论(0)
提交回复
热议问题