Login  Register

Re: Shader & texture - weird display

Posted by greatdonking on Apr 21, 2020; 8:56pm
URL: https://forum.jogamp.org/Shader-texture-weird-display-tp4040540p4040547.html

Thanks for your answer.
Sorry for the misunderstood, I'm not requesting assistance related to the unofficial tutorials, but just some help/suggestions in order to learn and fix my issue.

So followings your suggestions, I have removed the reference to the GL2 and now retrieve it thanks to the GLContext created in my main Window. In addition, IndirectBuffres switch to DirectBuffer.

Finally, I raised the Following Excpetion :
com.jogamp.opengl.GLException: Thread[main,5,main] glGetError() returned the following error codes after a call to glVertexAttribPointer(<int> 0x1, <int> 0x2, <int> 0x1406, <boolean> false, <int> 0x641E, <long> 15378): GL_INVALID_VALUE ( 1281 0x501), 
	at com.jogamp.opengl.DebugGL4bc.writeGLError(DebugGL4bc.java:31803) ~[jogl-all.jar:2.3.2]
	at com.jogamp.opengl.DebugGL4bc.glVertexAttribPointer(DebugGL4bc.java:30516) ~[jogl-all.jar:2.3.2]

Related Code is call in init()
// texCoordLocation
            int texCoordLocation = shader.GetAttribLocation(gl, "aTexCoord");
            logger.info(String.format("texCoordLocation [%s]", texCoordLocation));
            gl.glEnableVertexAttribArray(texCoordLocation);
            gl.glVertexAttribPointer(texCoordLocation, 2, GL2.GL_FLOAT, false, 5 * GL2.GL_FLOAT, 3 * GL2.GL_FLOAT);
            
 The vertexShader define a var layout(location = 1) in vec2 aTexCoord.

Any ideas where I'm wrong ?