Bug 711

Summary: Graph's Curve shader code version is not aligned against GLSL version
Product: [JogAmp] Newt Reporter: JanBenes <jbenes>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: normal CC: jbenes, laykunowns
Priority: ---    
Version: 1   
Hardware: pc_x86_64   
OS: all   
URL: http://forum.jogamp.org/curve-TextRenderer-GL3-couldn-t-link-program-td4028852.html
Type: DEFECT SCM Refs:
b2802021acf8aa9b363ebef383c8dc8c8079ffa4 f650e6b37407aaa3ef6c16e7daf6423103b94ddf
Workaround: ---
Attachments: gluegen build errors
test run results, log, test.sh log

Description JanBenes 2013-03-31 04:16:20 CEST
When using the "new" TextRenderer in a GL3 forward compatible context, the following error message is given:

Exception in thread "AWT-EventQueue-0-AWTAnimator-1" java.lang.RuntimeException: javax.media.opengl.GLException: TextRendererImpl01: Couldn't link program: ShaderProgram[id=2, linked=false, inUse=false, program: 42,
   ShaderCode[id=3, type=VERTEX_SHADER, valid=false, shader:  43, source]
   ShaderCode[id=4, type=FRAGMENT_SHADER, valid=false, shader:  0, source]]

The probable cause is that the shader code used cannot be compiled under GLSL version 1.50.

The following info (especially notice the version) has been gathered from glGetString:
 
INFO: OpenGL information from vendor "NVIDIA Corporation":
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

The setup code, failing at the last shown line, is

rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
renderer = TextRenderer.create(rs,  0);
renderer.init(gl);

The code was run on a Mac OS X 10.8.2 desktop computer.
Comment 1 Sven Gothel 2013-05-17 08:05:20 CEST
Align Graphs's Curve Shader programmatically to used GL/GLSL version, following all other internal GLSL usage utilizing ShaderCode.
Comment 2 JanBenes 2013-05-17 08:09:15 CEST
Thanks, I'll try it out next week.
Comment 3 Sven Gothel 2013-05-18 05:46:11 CEST
Fix regression of commit b2802021acf8aa9b363ebef383c8dc8c8079ffa4 (Bug 711): 
varying in/out mapping is different in vertex/fragment shader!
    
  Vertex shader:   varying -> out
  Fragemnt shader: varying -> in
    
  NV GLSL compiler ignored in/out direction,
  where ATI GLSL compiler failed (could not find gcu_Weight, due to dead code).
Comment 4 JanBenes 2013-06-01 00:23:01 CEST
Hi Sven,
I finally had a chance to try out the text rendering code. Same computer as before. After calling 

renderer.init(gl);

in the code given in the forum post, what I get is 

createAndCompileShader: Pre GL Error: 0x501

the execution then continues only to crash with the following call-stack

Caused by: java.lang.NullPointerException
	at com.jogamp.graph.curve.opengl.TextRenderer.getKey(TextRenderer.java:183)
	at com.jogamp.graph.curve.opengl.TextRenderer.getCachedGlyphString(TextRenderer.java:149)
	at jogamp.graph.curve.opengl.TextRendererImpl01.drawString3D(TextRendererImpl01.java:99)

I will note that I might have made a mistake in "installing" the new JOGL version; I'm not an Java expert. What I did was clone the latest jogl (cbd7bf1) & gluegen (959d6d8) versions, successfully built (https://jogamp.org/jogl/doc/HowToBuild.html) it and copied the contents of the build/jar folders into the directory where my these jars were previously.

I cannot tell whether this is an issue on my side or on yours.
Comment 5 Sven Gothel 2013-06-04 19:34:37 CEST
Reopened due to comment 4.

@Jan: Please re-open immediately,  so it is listed in the query result of things which needs attention :)

Can you remind me which test case you did run ?

Can you please follow Wiki Bugreport & testing and post the whole procedure
inclusive all JOGL debug flags enabled ?
  -Djogl.debug=all

Can you also please run same test w/ just 
    -Djogl.debug.GLSLCode -Djogl.debug.DebugGL -Djogl.debug.TraceGL
enabled ?

your .. know redir, i.e. > java test 2>&1 | tee test_01.log 
.. etc

then pls xz or 7z it .. and attach here ..

thank you
Comment 6 JanBenes 2013-06-04 19:39:48 CEST
Hi Sven,

I'll try running the tests (and perhaps doing a MWE/follow the bugreport wiki) later today or tomorrow and report back. Seems like the issue has already been reopened.
Comment 7 Sven Gothel 2013-06-13 21:30:25 CEST
(In reply to comment #6)
> Hi Sven,
> 
> I'll try running the tests (and perhaps doing a MWE/follow the bugreport
> wiki) later today or tomorrow and report back. Seems like the issue has
> already been reopened.

Whats the state of this bug ?

Pls note that our unit tests all pass ..

If the bug still persists, please re-open this bug and send proper information
(debug logs .. etc).

Thank you.
Comment 8 JanBenes 2013-06-21 23:41:21 CEST
Created attachment 484 [details]
gluegen build errors
Comment 9 Sven Gothel 2013-06-22 07:24:25 CEST
(In reply to comment #8)
> Created attachment 484 [details]
> gluegen build errors

Sorry, missed to add 2 files,
fixed w/ http://jogamp.org/git/?p=gluegen.git;a=commit;h=a7545f4fda73c215cff0da7256417bc1d1bd450b
Comment 10 JanBenes 2013-06-25 03:10:54 CEST
Hi Sven,
find attached the results of the test run and the log. It seems the results of the test run are correct (ie /jogamp/jogl/build/test/results/TestTextRendererNEWT00-snap0-800x400-T0000.png) shows correct results. I'll take a look at the test's source code and see where I went wrong in my code, but for now, I consider this done. 

However, the whole test finished with a couple errors I didn't investigate further. Also, some of the capital M letters output using the Lucida font are drawn incorrectly, see attachment (e.g. /jogamp/jogl/build/test/results/text-vbaa0-msaa1-800x400-Z0380-T0000-Lucida_Bright-Regular.png)
Comment 11 JanBenes 2013-06-25 03:18:21 CEST
Created attachment 485 [details]
test run results, log, test.sh log

Thanks for looking into the original bug. I'm available for further assistance if needed. Should I report the Lucida bug issue as a new bug?

Also, the revisions I used were current as of a about an hour ago, eg

415f5c29ffae7cf5a26737da38e31cb84b652539 Jun 24, 2013 for jogl
0cce9a0eb5ab3ca25531c8fb8a9ef8be5c758487 Jun 24, 2013 for gluegen
Comment 12 JanBenes 2013-07-05 19:35:45 CEST
Hi Sven,
I was finally (using the revision mentioned in comment 10) able to display some text in my own code (as opposed to the unit tests), a further confirmation that the bug is gone. Thanks for the effort you put towards making this work!

Best, Jan
Comment 13 leigh beattie 2013-07-08 05:13:24 CEST
I can also confirm this is fixed for me too. Mac OSX, Intel HD 3000, OSX 10.7, Opengl 3.2 .

Thanks a bunch!