Shader can not work

Hello there,
I have some problems with the shader example programs (jogl demos). :frowning: In fact they do compile and run as far as I can see but there is not “refresh” on the current window. In the other hand, every other OpenGL demo work just fine. I wonder if I do anything wrong or there is actually a glitch…

Some info about my system:
[] Windows XP SP2
[] JDK + JRE = version 1.6.0_02, IDE = Netbeans 5.5.1 (all downloaded just today :wink: )
[] JOGL Version = nightly build ( jogl-1.1.1-pre-20070816-windows-i586 )
[] JOGL Setup (only Netbeans library customization, no system variables or file copying)
[] Graphics Card ATI 9800PRO (drivers catalyst 6.14)

Example of window:

http://img74.imageshack.us/my.php?image=netbeansjoglglitchau9.png

Console output:

Any ideas?

Thank you for any response.

Hi,
With the IOException I would try to see if the data associated to the demo are available into your netbeans project…

OK, thanks turquoise3232 for the support. I am very aware that the error actually originates from a “bad” setup up I made. As far as I understand, the project is all fine and it can be compiled without errors. The virtual machine though is unsatisfied that’s why it can not display a thing.
Example…

I went through a lot of reading the last hours and here is my current setup status:

  • I have added the file path of the jogl lib folder, at my system’s Path environment variable. This is needed for jogl’s native DLL files.
  • I have set the same path as a VM Option on Netbeans (Project Options>Run>VM Options: -Djava.library.path=“the_path_to_jogl_lib”).
  • The library on Netbeans (for jogl) contains the essential jar files. The library is included in the project.

By this moment, this the result of the Output when I tried to run the file “runtime_ogl_vertex_fragment”. Just a short one, just to avoid flooding the forums ;).

java.lang.UnsatisfiedLinkError:

You don’t need to set the path environment variable when you set the java.library.path system property. Are you sure you are pointing to the directory where the jogl and gluegen .dll-files reside?

Yes, in case it wasn’t clearly obvious in cylab’s statement, you must have the gluegen dll’s as well as the jogl.dll somewhere in your path. That tripped me up when I switched to a newer version that did require that.

Thank you for your answers. I tried to be as much careful as I could and made the corrections as you sujested. I even took advice from the setup of other libraries on Netbeans.

Here’s an example…

  • I run today the JRefract demo (demos.jrefract), I added the “Gears” and the “Text” window and all worked fine.
  • When I added the “Warp” demo, the window display froze and displayed some crazy graphics.
  • When I tried to add the “High Dynamic Range” window, the application crashed.

Here is some pieces from the Output:

[quote]…
INIT GL IS: com.sun.opengl.impl.GLImpl
Chosen GLCapabilities: GLCapabilities [DoubleBuffered: false, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red: 8, Green: 8, Blue: 8, Alpha: 8, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false ]
GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: RADEON 9800 PRO x86/SSE2
GL_VERSION: 2.0.6590 WinXP Release

Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at java.io.Reader.(Reader.java:61)
at java.io.InputStreamReader.(InputStreamReader.java:55)
at demos.util.Triceratops.drawObject(Unknown Source)
at demos.vertexProgWarp.VertexProgWarp.drawObject(Unknown Source)
at demos.vertexProgWarp.VertexProgWarp.init(Unknown Source)
at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)
at javax.media.opengl.GLJPanel$Updater.init(GLJPanel.java:1045)
at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)
at com.sun.opengl.impl.GLPbufferImpl$InitAction.run(GLPbufferImpl.java:215)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)
at com.sun.opengl.impl.GLPbufferImpl.maybeDoSingleThreadedWorkaround(GLPbufferImpl.java:208)
at com.sun.opengl.impl.GLPbufferImpl.display(GLPbufferImpl.java:88)
at javax.media.opengl.GLJPanel.paintComponent(GLJPanel.java:659)
at javax.swing.JComponent.paint(JComponent.java:1027)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
[/quote]
I can say for sure that there is something going on with a part of CG implementation, otherwise JOGL is great and very stable ;). As far as I can see, this line might do the trick Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException.

Now I will leave aside this issue and start working with GLSL shaders, though I am curious to hear from other ATI owners. :slight_smile:

Hi,

I may not understand your problem the right way but what seems strange for me is that the exception you get is raised again from an io stream.
if I remember well you have a .jar with all the data files for the demo… You may have to unjar it and make sure that your Netbeans project search data in the right place…
But I may be wrong.

The problem is something about the file paths… I tried the Nehe java demos and I realized that not a single texture could be loaded (IOExceptions again).

Or I setup projects in a wrong way, or there is special configuration in Netbeans that need to be taken care of. I would appreciate whoever have Netbeans to take a try setting up a project.

About nehe Java Demos: http://pepijn.fab4.be/?page_id=34
All sources download: http://pepijn.fab4.be/nehe/nehe-source.zip

Hi,
You have a WorkingDirectory field in Netbeans property, put your data files here.
But you have to check that the resources are loaded from the disk and not from the jar file in the source code.

OK, it worked finally. ;D Thanks Mr. turqoise for the help. I believe that was a tough one.

I actually did some tests and is true that the source of the application (while executed inside Netbeans) is the same as the place where Netbeans Project is located. Problem solved by adding this .\nehe-source\resources in the the working directory.