Testing new build

trying this new build and getting the following problems…



os : mac os 10.5.7

arch : 64 bit Intel Core 2 Duo

graphics card : ATI RadeonHD2400

glsl version : 1.20

java version : 1.5.0_19 32 bit





1. TestYCoCgDds, TestHdrLoading, TestDdsLoading, TestThreadedLoading, TestRenderToTexture, TestBox, TestObjLoading, TestNormalMapping, TestBumpModel, TestTerrainLighting

first i get a console error



WARNING LwjglRenderer 10:51:08 AM Fragment compile error: ERROR: 0:18: '' : syntax error incorrect preprocessor directive

WARNING: 0:18: unexpected tokens following the preprocessor directive - expected a newline



then an exception in LWJGLRenderer.setVertexAttrib



throw new IllegalStateException("Cannot render mesh without shader bound");

i found the shader error for TestBox in



texture.glsllib



when i changed Texture_GetNormal to



vec3 Texture_GetNormal(in sampler2D normalMap, vec2 texCoord){
    #ifdef NORMAL_SIGNED_RG
        return Common_UnpackNormalRG( texture2D(normalMap, texCoord).rg );
    #endif
        
    #ifdef NORMAL_DXT5nm
        return Common_UnpackNormal( texture2D(normalMap, texCoord).rga );
    #endif

    return Common_UnpackNormal( texture2D(normalMap, texCoord).rgb );
}



ie removing the #elif directive alot of these now compile and run fine....

2. TestCubeMap
i get a crash with an out of memory error, stack is;

Thread [LWJGL Renderer Thread] (Suspended (exception OutOfMemoryError))
Bits.reserveMemory(long) line: 635
DirectByteBuffer.<init>(int) line: 95
ByteBuffer.allocateDirect(int) line: 288
BufferUtils.createByteBuffer(int) line: 749
HDRLoader.load(ContentManager, InputStream, String, ContentKey) line: 274
ContentManager.loadContent(ContentKey, boolean) line: 159
ContentManager.loadContent(ContentKey) line: 188
ContentManager.loadImage(String) line: 250
TestCubeMap.loadEnvMap(Image$Format) line: 40
TestCubeMap.simpleInitApp() line: 75
TestCubeMap(SimpleApplication).initialize() line: 109
LwjglDisplay.initInThread() line: 156
LwjglDisplay.run() line: 221
Thread.run() line: 613

3. TestHDR, TestShadow, TestSimpleLighting
- bugs out with the following exception stack trace

Thread [LWJGL Renderer Thread] (Suspended (exception IllegalStateException))
LwjglRenderer.checkFrameBufferError() line: 923
LwjglRenderer.setFrameBuffer(FrameBuffer) line: 1103
HDRRenderer.update(float, Application, Spatial) line: 245
TestHDR.simpleRender(Renderer) line: 76
TestHDR(SimpleApplication).update() line: 133
LwjglDisplay.runLoop() line: 163
LwjglDisplay.run() line: 226
Thread.run() line: 613

4. TestApplication
- bugs out with the following stack trace, looks like a JOGL issue

Thread [main] (Suspended (exception UnsatisfiedLinkError))
ClassLoader.loadLibrary(Class, String, boolean) line: 1753
Runtime.loadLibrary0(Class, String) line: 822
System.loadLibrary(String) line: 993
NativeLibLoader.loadLibraryInternal(String) line: 189
NativeLibLoader.access$000(String) line: 49
NativeLibLoader$DefaultAction.loadLibrary(String, String[], boolean, boolean) line: 80
NativeLibLoader.loadLibrary(String, String[], boolean, boolean) line: 103
NativeLibLoader.access$200(String, String[], boolean, boolean) line: 49
NativeLibLoader$1.run() line: 111
AccessController.doPrivileged(PrivilegedAction<T>) line: not available [native method]
NativeLibLoader.loadCore() line: 109
MacOSXGLDrawableFactory.<clinit>() line: 53
Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method]
Class<T>.forName(String) line: 164
GLDrawableFactory.getFactory() line: 108
GLCanvas.chooseGraphicsConfiguration(GLCapabilities, GLCapabilitiesChooser, GraphicsDevice) line: 520
GLCanvas.<init>(GLCapabilities, GLCapabilitiesChooser, GLContext, GraphicsDevice) line: 131
GLCanvas.<init>(GLCapabilities) line: 90
JoglDisplay.create() line: 132
Application.start() line: 222
TestApplication.main(String[]) line: 35


however the screen goes to full screen and appears rendered then goes to windowed mode and just appears grey then exits...
is this the desired functionality?

Are you running TestApplication? Yes that's how its supposed to work. It basically tests various display modes (fullscreen/window) and renderers (LWJGL/JOGL).


I have ran the shaders through 3DLabs GLSL validate tool: http://mew.cx/glsl/glslvalidate/
I fixed what didn't require large changes.
The main problem was with #elif, apparently this:


#elif SOME_DEFINE


is illegal, while this:


#elif defined SOME_DEFINE


is correct.

I tried looking up what extensions your video card supports. Are you running on a laptop or desktop?
If you are using a laptop (e.g Mobility Radeon HD 2400) then the HDR tests (TestHDR, TestCubeMap) won't work :(
These require GL_ARB_color_buffer_float, ARB_half_float_pixel, EXT_texture_shared_exponent and EXT_packed_float. The desktop variant of this video card supports all these extensions, while the mobile variant only supports ARB_texture_float.
I might try to implement a simpler HDR method which writes to the main framebuffer and tone mapping it after copying pixels to a float texture (which the mobile supports).

As for the shadow issue, I think I know the problem, it's probably because glReadBuffer is still set to GL_COLOR_ATTACHMENT0 which is undefined when only a depth attachment is used.

I fixed these problems locally and will commit soon.

Thank you very much for testing!


i get a crash with an out of memory error, stack is;

The HDR image takes 17 MB in memory. So you probably would need to increase the amount of memory available to Java.
Try passing -Xms256m -Xmx256m as VM options.

ie removing the #elif directive alot of these now compile and run fine....

Are you sure it's the elif?
It's defined in the spec: http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.08.pdf

unexpected tokens following the preprocessor directive - expected a newline

Searching this error online, I found this:
http://msdn.microsoft.com/en-us/library/fzk5a1hy.aspx

It shows an example of code the doesn't work:


#else
#endif v   // C4067
int main()


So if there are any characters after "else" or "endif" it will flag a warning.
However I don't think this is the error, because MSDN says it should be a warning. Maybe there's another error that you missed there?


Thread [LWJGL Renderer Thread] (Suspended (exception IllegalStateException)) 
LwjglRenderer.checkFrameBufferError() line: 923

Can you please post the exact error? It should be something like "Incomplete framebuffer attachment", etc. Most likely your video card doesn't support one of the HDR formats that are used there. Once the caps system is added:
http://code.google.com/p/jmonkeyengine/issues/detail?id=52
This will be better handled.

4. TestApplication
- bugs out with the following stack trace, looks like a JOGL issue

Thread [main] (Suspended (exception UnsatisfiedLinkError)) 
  ClassLoader.loadLibrary(Class, String, boolean) line: 1753 

Yeah, the Natives class doesn't work yet for JOGL, you have to include it in java.library.path like for jME2.
See the JOGL section in this page for a short tutorial:
http://code.google.com/p/jmonkeyengine/wiki/jME3Depends
Momoko_Fan said:

The HDR image takes 17 MB in memory. So you probably would need to increase the amount of memory available to Java.
Try passing -Xms256m -Xmx256m as VM options.


tried that with the memory arguements and now get the following error

throw new IllegalStateException("Framebuffer has erronous attachment.");
stack

Thread [LWJGL Renderer Thread] (Suspended (exception IllegalStateException))
LwjglRenderer.checkFrameBufferError() line: 923
LwjglRenderer.setFrameBuffer(FrameBuffer) line: 1103
HDRRenderer.update(float, Application, Spatial) line: 245
TestCubeMap.simpleRender(Renderer) line: 100
TestCubeMap(SimpleApplication).update() line: 133
LwjglDisplay.runLoop() line: 163
LwjglDisplay.run() line: 226
Thread.run() line: 613



Are you sure it's the elif?
It's defined in the spec: http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.08.pdf

unexpected tokens following the preprocessor directive - expected a newline
Searching this error online, I found this:
http://msdn.microsoft.com/en-us/library/fzk5a1hy.aspx

It shows an example of code the doesn't work:


#else
#endif v   // C4067
int main()


So if there are any characters after "else" or "endif" it will flag a warning.
However I don't think this is the error, because MSDN says it should be a warning. Maybe there's another error that you missed there?


yeah it's weird since elif is part of 1.20 spec...
i edited these shaders quite a bit to get them working and removing the elif was the only fix that got them to compile..


Thread [LWJGL Renderer Thread] (Suspended (exception IllegalStateException))   
LwjglRenderer.checkFrameBufferError() line: 923


ok for TestShadow i'm bugging out with

case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
                throw new IllegalStateException("Incomplete read buffer.");

and for TestHDR i'm bugging out with

case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
                throw new IllegalStateException("Framebuffer has erronous attachment.");


Yeah, the Natives class doesn't work yet for JOGL, you have to include it in java.library.path like for jME2.
See the JOGL section in this page for a short tutorial:
http://code.google.com/p/jmonkeyengine/wiki/jME3Depends


that doesn't crash now when i add the jogl natives to the library path..
however the screen goes to full screen and appears rendered then goes to windowed mode and just appears grey then exits...
is this the desired functionality?

new problems....

TestTerrainLighting bugs out with

WARNING LwjglRenderer 1:54:17 PM shader link failure: WARNING: vertex shader writes varying 'texCoord' which is not active.
ERROR: fragment shader reads varying 'wvPosition' which is not written.

TestBumpModel bugs out with

WARNING LwjglRenderer 1:55:38 PM shader link failure: ERROR: fragment shader reads varying 'wvPosition' which is not written.

TestObjModel bugs out with

WARNING LwjglRenderer 2:02:47 PM Fragment compile error: ERROR: 0:1: 'in' : syntax error syntax error
ERROR: Parser found no code to compile in source strings.

just checked the opengl extensions on my machine and the only extension supported is ARB_half_float_pixe so obviously that's the problem there…

let me know when you commit and i'll retest…