JOGL2 + GLCapabilities + Windows

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL2 + GLCapabilities + Windows

Marc@56K
Hi,

i updated my application from jogl 2.0 beta 10 to jogl-b18 (Windows x86). Now i got this exception:

javax.media.opengl.GLException: array offset argument "infoLog_offset" (0) equals or exceeds array length (0)
        at com.jogamp.opengl.impl.gl4.GL4bcImpl.glGetShaderInfoLog(GL4bcImpl.java:10178)

The problem has something todo with my GLCapabilities:

GLProfile glp = GLProfile.get("GL2GL3");        
GLCapabilities caps = new GLCapabilities(glp);
caps.setStencilBits(8);

If i remove the stencil settings: caps.setStencilBits(8) there is no exception and the application runs without stencil support.
Another solution is to activate the Stencil-Buffer and FSAA like this:

GLProfile glp = GLProfile.get("GL2GL3");        
GLCapabilities caps = new GLCapabilities(glp);
caps.setStencilBits(8);
caps.setSampleBuffers(true);

I'm pretty sure this is a bug in the windows implementation of jogl. Under macos everything works fine.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + GLCapabilities + Windows

Wade Walker
Administrator
Could you attach your code that shows this error? I need to see what windowing toolkit you're using (NEWT, AWT, SWT) and exactly what you're doing so I can try to duplicate this. Also, are you on 32-bit or 64-bit windows?
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + GLCapabilities + Windows

Marc@56K
I use a 32-bit jdk on a Win64 machine. I got the error with NEWT and AWT.
Without setSampleBuffers(true) the Shader doesn't compile and the variable logLength[0] returns zero.

public class GLCapabilitiesBug implements GLEventListener
{
    /**
     * @param args
     */
    public static void main(String[] args)
    {
        new GLCapabilitiesBug();
    }
   
    private GLWindow window;
   
    public GLCapabilitiesBug()
    {
        this.window = GLWindow.create(this.getGLCapabilities());
        this.window.addGLEventListener(this);    
        this.window.setVisible(true);
       
        while(true)
        {
            window.display();
        }
    }
   
    protected GLCapabilities getGLCapabilities()
    {
        GLProfile glp = GLProfile.get("GL2GL3");        
        GLCapabilities caps = new GLCapabilities(glp);  
        caps.setStencilBits(8);
        //caps.setSampleBuffers(true);
        return caps;
    }

    @Override
    public void display(GLAutoDrawable drawable)
    {
       
    }

    @Override
    public void dispose(GLAutoDrawable arg0)
    {
    }

    @Override
    public void init(GLAutoDrawable drawable)
    {      
        String code = "void main(void){gl_Position = vec4(0,0,0,1);}";        
       
        GL2GL3 gl = drawable.getGL().getGL2GL3();        

        int id = gl.glCreateShader(GL2GL3.GL_VERTEX_SHADER);
       
        gl.glShaderSource(id, 1, new String[] { code }, (int[])null, 0);
        gl.glCompileShader(id);

        int[] compiled = new int[1];
        gl.glGetShaderiv(id, GL2GL3.GL_COMPILE_STATUS, compiled, 0);
        if (compiled[0] == GL2GL3.GL_FALSE)
        {
            int[] logLength = new int[1];
            gl.glGetShaderiv(id, GL2GL3.GL_INFO_LOG_LENGTH, logLength, 0);
           
            byte[] log = new byte[logLength[0]];
            gl.glGetShaderInfoLog(id, logLength[0], (int[])null, 0, log, 0);
           
            System.err.println("Error compiling the shader: " + new String(log));
               
            gl.glDeleteShader(id);
        }
        else
        {
            System.out.println("Shader compiled: id=" + id);
        }
    }

    @Override
    public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
    {
    }
}
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + GLCapabilities + Windows

Wade Walker
Administrator
I've created a JUnit test from this, and confirmed that it works OK on Linux. If I can duplicate the failure on Windows tomorrow, I'll enter this as an official bug and submit the JUnit test to be added to our suite.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + GLCapabilities + Windows

Wade Walker
Administrator
In reply to this post by Marc@56K
I've verified that this fails on Windows 7 64-bit, and I've created a bug report at https://jogamp.org/bugzilla/show_bug.cgi?id=459. You should CC yourself on the report to be notified when it's fixed.

I'm debugging the unit test now to see if it's something easy, or if it's a "Sven problem"
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + GLCapabilities + Windows

Wade Walker
Administrator
I've submitted the JUnit test that duplicates this bug at https://github.com/sgothel/jogl/pull/19. I looked into the cause, and it seems to be in the same GLCapabilities chooser code that Sven is currently working on, so I'm going to wait and see what his new code looks like before trying to fully diagnose this.

Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + GLCapabilities + Windows

Marc@56K
Ok, thanks for your help.