Posted by
JanBenes on
URL: https://forum.jogamp.org/TextRenderer-and-VAOs-tp4029530.html
Hi,
I've been trying to integrate the curve texture renderer into my code. While I was successful with an application that only draws text, it kept breaking my application as a whole. I finally tracked it down to the
attached MWE TestTextRendering.java. Here's the offending piece of code:
GL3 gl = new DebugGL3(drawable.getGL().getGL3());
drawable.setGL(gl);
gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
gl.glEnable(GL3.GL_DEPTH_TEST);
gl.glEnable(GL3.GL_MULTISAMPLE);
try {
font = FontFactory.get(FontFactory.UBUNTU).getDefault();
textRenderState = RenderState.createRenderState(new ShaderState(), SVertex.factory());
textRenderer = TextRenderer.create(textRenderState, 0);
textRenderer.init(gl);
textRenderer.setAlpha(gl, 1.0f);
textRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f);
} catch(Exception e) {
throw new RuntimeException(e);
}
// here, I would create a VA, IB, VB, set them up, etc, only to finally break the bind
// on the vertex array as part of the cleanup
// UNCOMMENT BELOW TO MAKE APPLICATION THROW AN EXCEPTION
//gl.glBindVertexArray(0);
If the
last line gets uncommented, I get an
exception thrown from within the text rendering code (full strack trace attached
jogl_exception.txt) when I actually try to render some text in the main loop.
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error codes after a call to glEnableVertexAttribArray(<int> 0x0): GL_INVALID_OPERATION ( 1282 0x502),
at javax.media.opengl.DebugGL3.checkGLGetError(DebugGL3.java:9753)
at javax.media.opengl.DebugGL3.glEnableVertexAttribArray(DebugGL3.java:3927)
at com.jogamp.opengl.util.glsl.ShaderState.enableVertexAttribArray(ShaderState.java:492)
at com.jogamp.opengl.util.glsl.ShaderState.enableVertexAttribArray(ShaderState.java:547)
at jogamp.opengl.util.glsl.GLSLArrayHandler.enableShaderState(GLSLArrayHandler.java:112)
at jogamp.opengl.util.glsl.GLSLArrayHandler.enableState(GLSLArrayHandler.java:64)
at com.jogamp.opengl.util.GLArrayDataClient.enableBuffer(GLArrayDataClient.java:207)
at com.jogamp.opengl.util.GLArrayDataClient.seal(GLArrayDataClient.java:196)
at jogamp.graph.curve.opengl.VBORegionSPES2.update(VBORegionSPES2.java:120)
at com.jogamp.graph.curve.opengl.GLRegion.draw(GLRegion.java:124)
at jogamp.graph.curve.text.GlyphString.renderString3D(GlyphString.java:187)
Even though I tried mimicking the unit test for font rendering, I might have gotten something wrong. Also, I only went as far as creating the buffers and the VA in the MWE, but I never actually called the vertex array
gl.glEnableVertexAttribArray
, or bound shaders.
Am I doing something wrong? Or could it be a problem with the text rendering code?
Thanks!
I'm running a Mac OS 10.8.2 with
Renderer: NVIDIA GeForce GTX 680MX OpenGL Engine
OpenGL version: 3.2 NVIDIA-8.6.22
GLSL version: 1.50
INFO: GL_ARB_ES2_compatibility: false
INFO: GL_ARB_ES3_compatibility: false
and am using the following revisions (will try the latest tomorrow if required)
415f5c29ffae7cf5a26737da38e31cb84b652539 Jun 24, 2013 for jogl
0cce9a0eb5ab3ca25531c8fb8a9ef8be5c758487 Jun 24, 2013 for gluegen