Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / Glui library in Jogl? on: 2007-03-02 22:18:17
Hi,

GLUI is a GLUT-based C++ user interface library.   Is there any existing Jogl components that can handle the GLUI library?

Thank.
2  Java Game APIs & Engines / JOGL Development / Re: 3D texture problem on: 2007-02-08 17:53:17
Ken,

I do have the whole application.  However, I can't give it to public.

I suspect the gl.glActiveTexture() primitive.   In general, do you think my Jogl part setup is correct? 
3  Java Game APIs & Engines / JOGL Development / 3D texture problem on: 2007-02-08 16:49:15
I have a Nvidia GeForce 6800 GS graphics card with 256 MB.   My 3D application uses the following code to set up 3D texture units and uniform variables for use in the Cg fragment shader.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// texture setup in the application
gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
    gl.glGenTextures(1, temp1, 0);
    TextureID = temp1[0];
    gl.glBindTexture(GL.GL_TEXTURE_3D, TextureID);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_R, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);

// Generate normals
    gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
    gl.glGenTextures(1, temp16, 0);
    normal_ID = temp16[0];
    gl.glBindTexture(GL.GL_TEXTURE_3D, normal_ID);
    // gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_R, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
    gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);

   // setup Cg parameters
    Texture_Param = CgGL.cgGetNamedParameter(fProgram, "Texture");
    normal_Param = CgGL.cgGetNamedParameter(fProgram,"normals");
    CgGL.cgGLSetTextureParameter(Texture_Param, TextureID);
    CgGL.cgGLSetTextureParameter(normal_Param, normal_ID);
    CgGL.cgGLEnableTextureParameter(Texture_Param);
    CgGL.cgGLEnableTextureParameter(normal_Param);

--------------------------------------------------------------------------------------------------------------------------------------------------------
   // in Display()
 FloatBuffer volumeBuf = FloatBuffer.wrap(volumeBuffer);
      volumeBuf.rewind();
      gl.glActiveTexture(GL.GL_TEXTURE0);
      gl.glEnable(GL.GL_TEXTURE_3D);
      gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_OBJECT_LINEAR);
      gl.glBindTexture(GL.GL_TEXTURE_3D, TextureID);
      gl.glTexImage3D(GL.GL_TEXTURE_3D, 0, GL.GL_RGBA, iWidth, iHeight, iDepth,
                      0, GL.GL_RGBA, GL.GL_FLOAT, volumeBuf);


     FloatBuffer normal_buf = FloatBuffer.wrap(normals);
     normal_buf.rewind();
     gl.glActiveTexture(GL.GL_TEXTURE1);
     gl.glEnable(GL.GL_TEXTURE_3D);
     gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_OBJECT_LINEAR);
     gl.glBindTexture(GL.GL_TEXTURE_3D, normal_ID);
     gl.glTexImage3D(GL.GL_TEXTURE_3D, 0, GL.GL_RGB, iWidth, iHeight, iDepth,
                     0, GL.GL_RGB, GL.GL_FLOAT, normal_buf);

-------------------------------------------------------------------------------------------------------------------------------------------------

void FragmentProgram(in float4 inTex : TEXCOORD0, out float4 oColor : COLOR0,
                                            uniform sampler3D Texture,
                                  uniform sampler3D normals) {

  //get normal
  float3 normal;
  normal.rgb = tex3Dproj(normals, inTex).rgb;
 
 // Color look up
  float4 result;
  result.rgba =  tex3Dproj(USTexture, inTex).rgba;
             
 ..... ...... // calculate the lighting.

  oColor = result * light;

}

If I switch the order of normal and texture calculation in fragment program, i.e.

oid FragmentProgram(in float4 inTex : TEXCOORD0, out float4 oColor : COLOR0,
                                            uniform sampler3D Texture,
                                  uniform sampler3D normals) {

 // Color look up
  float4 result;
  result.rgba =  tex3Dproj(USTexture, inTex).rgba;
             
  //get normal
  float3 normal;
  normal.rgb = tex3Dproj(normals, inTex).rgb;
 
 ..... ...... // calculate th light.

  oColor = result * light;

}

The final volume image color changed quite a lot.   It turns to be an error.    Does anyone have the slightest clue about what could be the reason for such behavior?       Can Jogl correctly handle 3D texture sampler?   Or this due to my card issue? Or my OpenGL code doesn't setup 3D texture appropriately?

Thanks.   
4  Java Game APIs & Engines / JOGL Development / How to trace values in Cg program on: 2007-02-07 18:44:05
How to trace value in Cg program via jogl?
5  Java Game APIs & Engines / JOGL Development / Re: openGL extension on: 2007-01-09 23:23:48
By OpenGL extension, I mean the following,  glext.h, wglext.h and glui.h.   

If I want to use them in Jogl, should I write a jni wrapper for each extension?

Thanks.
6  Java Game APIs & Engines / JOGL Development / openGL extension on: 2007-01-09 23:05:04

Can Jogl handle openGL extension?

For example,   glTexImage3DEXT and GL_TEXTURE_3D_EXT.

Can I use glTexImage3D instead of glTexImage3DEXT in Jogl?

Thanks,


7  Java Game APIs & Engines / JOGL Development / Re: Jogl demo compilation error on: 2006-12-07 17:41:09
Ken,

I solve the problem now.  It turns out that C:\WINDOWS\system32 hold the old cg.dll and cgGL.dll.    The regular Cg uninstall program can't delete the two files.

Thank your very much,

cat.
8  Java Game APIs & Engines / JOGL Development / Re: Jogl demo compilation error on: 2006-12-07 15:35:55
Ken,

I follow what you suggest specify the -Djava.libarary.path in side JBuilder.   Remove the old Cg.  Install Cg 1.5.  I still get the same error.
I use JSR-231 1.0.0 release. 

Don't know what's happed.

thanks,




Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\jogl\jogl-1_0_0-windows-i586\lib\jogl_cg.dll: The specified procedure could not be found

   at java.lang.ClassLoader$NativeLibrary.load(Native Method)

   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)

   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)

   at java.lang.Runtime.loadLibrary0(Runtime.java:822)

   at java.lang.System.loadLibrary(System.java:992)

   at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

   at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

   at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

   at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

   at java.security.AccessController.doPrivileged(Native Method)

   at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

   at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

   at demos.cg.runtime_ogl_vertex_fragment.runtime_ogl_vertex_fragment.init(runtime_ogl_vertex_fragment.java:107)

   at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

   at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

   at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

   at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

   at sun.awt.RepaintArea.paint(RepaintArea.java:224)

   at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

   at java.awt.Component.dispatchEventImpl(Component.java:4031)

   at java.awt.Component.dispatchEvent(Component.java:3803)

   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Exception in thread "Thread-2" javax.media.opengl.GLException: java.lang.NoClassDefFoundError

   at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)

   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:256)

   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

   at com.sun.opengl.util.Animator.display(Animator.java:144)

   at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)

   at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.NoClassDefFoundError

   at demos.cg.runtime_ogl_vertex_fragment.runtime_ogl_vertex_fragment.display(runtime_ogl_vertex_fragment.java:154)

   at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)

   at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:281)

   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)

   at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)

   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)

   at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)

   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



9  Java Game APIs & Engines / JOGL Development / Re: Jogl demo compilation error on: 2006-12-06 22:12:55
Ken,

I use JBuilder.   I include all the .jar files in the required library.   Compile is fine.  When I run, I get the following error,
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jogl_cg in java.library.path

   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)

   at java.lang.Runtime.loadLibrary0(Runtime.java:822)

   at java.lang.System.loadLibrary(System.java:992)

   at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

   at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

   at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

   at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

   at java.security.AccessController.doPrivileged(Native Method)

   at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

   at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

   at demos.cg.runtime_ogl.cgGL_vertex_example.init(cgGL_vertex_example.java:191)

   at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

   at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

   at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

   at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

   at sun.awt.RepaintArea.paint(RepaintArea.java:224)

   at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

   at java.awt.Component.dispatchEventImpl(Component.java:4031)

   at java.awt.Component.dispatchEvent(Component.java:3803)

   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Then, I copy the jogl.dll, jogl_awt.dll, jogl_cg.dll to C:\jdk1.5.0_06\jre\bin.
During the running, I receive the following error,
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\jdk1.5.0_06\jre\bin\jogl_cg.dll: The specified procedure could not be found

   at java.lang.ClassLoader$NativeLibrary.load(Native Method)

   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)

   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)

   at java.lang.Runtime.loadLibrary0(Runtime.java:822)

   at java.lang.System.loadLibrary(System.java:992)

   at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

   at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

   at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

   at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

   at java.security.AccessController.doPrivileged(Native Method)

   at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

   at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

   at demos.cg.runtime_ogl.cgGL_vertex_example.init(cgGL_vertex_example.java:191)

   at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

   at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

   at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

   at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

   at sun.awt.RepaintArea.paint(RepaintArea.java:224)

   at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

   at java.awt.Component.dispatchEventImpl(Component.java:4031)

   at java.awt.Component.dispatchEvent(Component.java:3803)

   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Any suggestions?  It seems that the JBuilder can't automatically grab the jogl.dll related files.

Thanks,
 
10  Java Game APIs & Engines / JOGL Development / Re: Jogl demo compilation error on: 2006-12-06 16:33:29
Ken,

I follow exactly from the user guide.   Add the CLASSPATH for jogl.jar and PATH for Cg.   I use the Cg 1.5 and Jogl nightly build.   I run into the same problems.

I doubt for the incompatibility issues between Cg 1.5 and new release Jogl.

Could you tell me exactly where you locate the .dll and window-586.jar files? If possible, clarify the classpath setup.

Thanks a lot,




11  Java Game APIs & Engines / JOGL Development / Re: Jogl demo compilation error on: 2006-12-05 15:23:26
Ken,

I reinstall the Cg toolkit.   I still run into the same problem.   I used to run the demo without any problems.    Did you try to run  demos.cg.runtime_ogl.cgGL_vertex_example  on your desktop?

Thanks,

12  Java Game APIs & Engines / JOGL Development / Re: Jogl demo compilation error on: 2006-12-01 18:44:08
Actually, I get the following error.        

       // Create Cg Context
      Context = CgGL.cgCreateContext();
   CheckCgError();
       


 demos.cg.runtime_ogl.cgGL_vertex_example

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\jdk1.5.0_06\jre\bin\jogl_cg.dll: The specified procedure could not be found

   at java.lang.ClassLoader$NativeLibrary.load(Native Method)

   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)

   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)

   at java.lang.Runtime.loadLibrary0(Runtime.java:822)

   at java.lang.System.loadLibrary(System.java:992)

   at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

   at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

   at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

   at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

   at java.security.AccessController.doPrivileged(Native Method)

   at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

   at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

   at demos.cg.runtime_ogl.cgGL_vertex_example.init(cgGL_vertex_example.java:191)

   at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

   at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

   at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

   at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

   at sun.awt.RepaintArea.paint(RepaintArea.java:224)

   at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

   at java.awt.Component.dispatchEventImpl(Component.java:4031)

   at java.awt.Component.dispatchEvent(Component.java:3803)

   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

13  Java Game APIs & Engines / JOGL Development / Jogl demo compilation error on: 2006-12-01 18:13:22
I recently download the latest version of Jogl and demos.  Most of the demos work fine. 
However, I found two demos are out dated.

demos.cg.runtime_ogl   and   demos.cg.runtime_ogl_vertex_fragment

It turn out that following no longer exist,

Context = CgGL.cgCreateContext();
CgGL.cgGLEnableProfile

Any suggestions?

Thanks,

14  Java Game APIs & Engines / JOGL Development / Re: Jogl: fragment program is over native resource limits on: 2006-07-11 22:25:25
Ken,

Following link includes the data.   Sorry for this.     

http://wwwvis.informatik.uni-stuttgart.de/eng/research/fields/current/spvolren/

Under my spvolren/data directory, I put the data files. i.e.   head256.dat.    head256.raw, etc.

.NET 2003,  Project->spvolren properties-> Debugging

Command:            C:\Documents and Settings\yourname\Desktop\spvolren\debug\spvolren.exe
Command Arguments:  data\head256.dat
Working Direcotry:     C:\Documents and Settings\yourname\Desktop\spvolren\debug

Build and Run should be straight forward.

Let me know if you still encounter compiling and running problems.

Thanks,
15  Java Game APIs & Engines / JOGL Development / Re: Jogl: fragment program is over native resource limits on: 2006-07-11 17:27:28
Ken,

I use GeForce 6800 GS, 256 MB.   

Show the following msg
 "WARNING: fragment program is over native resource limits"

hm.....  maybe you update for a new Nvidia card?

For spvolren package, I used the .NET 2003 to build and run the project., everything is fine.

Thanks,
16  Java Game APIs & Engines / JOGL Development / Re: Can jogl handle 3D volume rendering? on: 2006-06-29 18:04:16
hifujava,

Could you post a link for your volume rendering project?  Thanks.
17  Java Game APIs & Engines / JOGL Development / Re: Jogl: fragment program is over native resource limits on: 2006-06-29 17:05:27
Ken,

http://home.gwu.edu/~ruida/temp.rar

I post the link for the jogl testting program.    The program just test the native resource limits.   
Under the loadProgram() method of vRender.java,  switch the following two lines, you will see the error message.

String fileNm = "isosurface_sm3.fp";
fileNm = "VolumeRenderPyramidF.ocg";
   
For the C and OpenGl working version,  see the link below.  isosurface_sm3.fp is just one volume shader fragment program.       
http://www.vis.uni-stuttgart.de/eng/research/fields/current/spvolren/spvolren_src.zip

Let me know, if you need more resource.
18  Java Game APIs & Engines / JOGL Development / Jogl: fragment program is over native resource limits on: 2006-06-28 23:01:20
I use jogl to read the two fragment programs.    It seems the simple fragment program can pass the native resource limit test.   However, the more complicated fragment program can not pass  the native resource limits test.      Can someone give me some suggestions on the error causation and work around?  If I use C and OpenGL, both of the fragment programs work all right.      What  the "native resource limits" means in Jogl?

Hopefully, Ken can give me certain input on this.

Thanks.

I post my jogl testing code and the two fragment programs below,

/**************   Jogl testing code ****************/
// profile = GL.GL_FRAGMENT_PROGRAM_ARB
// FileUtils as given in the jogl.demo.util
private int loadProgram(GL gl, int profile) throws IOException {
      String fileNm = "isosurface_sm3.fp";
      FileInputStream in;
      fileNm = "VolumeRenderPyramidF.ocg";
      in = new FileInputStream(fileNm);
         
      String programBuffer = FileUtils.loadStreamIntoString(in);
      int[] tmpInt = new int[1];
      gl.glGenProgramsARB(1, tmpInt, 0);
      int res = tmpInt[0];
      gl.glBindProgramARB(profile, res);
      gl.glProgramStringARB(profile, GL.GL_PROGRAM_FORMAT_ASCII_ARB,
                            programBuffer.length(), programBuffer);
      int[] errPos = new int[1];
      gl.glGetIntegerv(GL.GL_PROGRAM_ERROR_POSITION_ARB, errPos, 0);
      if (errPos[0] >= 0) {
        String kind = "Program";
        if (profile == GL.GL_VERTEX_PROGRAM_ARB) {
          kind = "Vertex program";
        }
        else if (profile == GL.GL_FRAGMENT_PROGRAM_ARB) {
          kind = "Fragment program";
        }
        System.out.println(kind + " failed to load:");
        String errMsg = gl.glGetString(GL.GL_PROGRAM_ERROR_STRING_ARB);
        if (errMsg == null) {
          System.out.println("[No error message available]");
        }
        else {
          System.out.println("Error message: \"" + errMsg + "\"");
        }
        System.out.println("Error occurred at position " + errPos[0] +
                           " in program:");
        int endPos = errPos[0];
        while (endPos < programBuffer.length() &&
               programBuffer.charAt(endPos) != '\n') {
          ++endPos;
        }
        System.out.println(programBuffer.substring(errPos[0], endPos));
        throw new GLException("Error loading " + kind);
      }
      else {
        if (profile == GL.GL_FRAGMENT_PROGRAM_ARB) {
          int[] isNative = new int[1];
          gl.glGetProgramivARB(GL.GL_FRAGMENT_PROGRAM_ARB,
                               GL.GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB,
                               isNative, 0);
          if (isNative[0] != 1) {
            /*******************************   Native limit test  *******************/
            System.out.println(
                "WARNING: fragment program is over native resource limits");
            Thread.dumpStack();
          }
        }
      }
      return res;
    }

/*****  simple fragment code:  "VolumeRenderPyramidF.ocg"  ****************************/     
!!FP1.0
# NV_fragment_program generated by NVIDIA Cg compiler
# cgc version 1.1.0003, build date Mar  4 2003  12:32:10
# command line args: -q -profile fp30 -entry FragmentProgram
#vendor NVIDIA Corporation
#version 1.0.02
#profile fp30
#program FragmentProgram
#semantic FragmentProgram.USTexture
#semantic FragmentProgram.ColorMap
#var float4 inTex : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1
#var float4 sColor0 : $vout.COLOR0 : COLOR0 : 1 : 1
#var sampler3D USTexture :  : texunit 0 : 2 : 1
#var sampler1D ColorMap :  : texunit 1 : 3 : 1
MOVX H0, f[TEX0];
MULX H0.z, H0.z, H0.w;
TXP  R0, H0, TEX0, 3D;
TEX  o[COLR], R0.x, TEX1, 1D;
#
# If you get artifacts, try this instead:
#
# MOVR R0, f[TEX0];
# MULR R0.z, R0.z, R0.w;
# TXP  R0, R0, TEX0, 3D;
# TEX  o[COLR], R0.x, TEX1, 1D;
#
END
# 4 instructions, 1 R-regs, 1 H-regs.
# End of program


/***   complicated fragment program:  isosurface_sm3.fp *************************/
!!ARBfp1.0
OPTION NV_fragment_program2;

# Filename: volume_sm3.fp

#! VOLUME = 0
#! TRANSFERFUNCTION = 1
#! BACKGROUND = 2

# r = step
# g = gradient scale
# b = gradient offset
# a = z-value of background plane
PARAM params = program.local[0];

# r = texture coordinate scale
# g = number of iterations
# b = isovalue of isosurface
PARAM params2 = program.local[1];
PARAM center = program.local[2];
PARAM texMax = program.local[3];

PARAM scaleFactors = program.local[5];

TEMP geomDir;
TEMP geomPos;
TEMP texblen;
TEMP diffVec;
TEMP scalar;
TEMP camera;
TEMP normal;
TEMP temp1;
TEMP temp2;
TEMP temp;
TEMP pos;
TEMP src;
TEMP dst;
TEMP dir;
TEMP tex;

# Compute the ray's starting point
MOV geomPos, fragment.texcoord[0];
MUL pos, geomPos, scaleFactors;
MOV pos.a, 0.0;

# Compute the camera position by translating the origin to the center of the
# volume
MOV camera, state.matrix.modelview.invtrans.row[3];

# Compute the ray direction
SUB geomDir, geomPos, camera;

# Normalize the direction (done manually instead of with NRM to improve
# accuracy)
DP3 geomDir.w, geomDir, geomDir;
RSQ geomDir.w, geomDir.w;
MUL geomDir, geomDir, geomDir.w;
MOV geomDir.w, 0.0;

MUL dir, geomDir, scaleFactors;

# Initialize scalar value
# RGB = gradient, alpha = scalar value
TXL scalar, pos, texture[0], 3D;
MOV scalar.g, scalar.a;
MOV scalar.a, 0.0;

# Initialize destination color
MOV dst, 0.0;

# Move one step forward
MAD pos, dir, params.r, pos;

REP params2.g;
   REP params2.g;

      # Lookup new scalar value
      TXL tex, pos, texture[0], 3D;
      MOV scalar.r, tex.a;

      # Lookup color in pre-int texture
      TXL src, scalar, texture[1], 2D;

      # TODO Early ray termination (no gain of speed so far)
      #SUBC texblen.r, 1.0, dst.a;
      #BRK (LE.x);

      # Perform blending
      SUB texblen.r, 1.0, dst.a;
      MAD_SAT dst, src, texblen.r, dst;

      # Move one step forward
      MAD pos, dir, params.r, pos;

      # Terminate loop if outside volume
      SGE temp1, pos, 0.0;
      SLE temp2, pos, texMax;
      DP3 temp1.r, temp1, temp2;
      SEQC temp1.r, temp1.r, 3.0;
      BRK (EQ.x);

      # Save current scalar value
      MOV scalar.g, scalar.r;

   ENDREP;

   BRK (LE.x);

ENDREP;

# Compute the normal of the background plane (this is just the negative view
# direction which initially is (0, 0, -1))
MOV normal, state.matrix.modelview.row[2];

# Compute the plane constant (we want the plane to be located in the volume
# center)
DP3 temp1.r, normal, center;

# Move the plane behind the volume: d' = <n,(x - l n)> = <n, x> - l <n, n>;
# l = 0.71 is chosen since it is greater than half the cube diagonal
DP3 temp1.g, normal, normal;
MAD temp1.r, temp1.g, -.71, temp1.r;

# Compute ray parameter
DP3 temp1.g, normal, geomPos;
SUB temp1.g, temp1.r, temp1.g;
DP3 temp1.b, normal, geomDir;
DIV temp.r, temp1.g, temp1.b;

# Compute ray/plane intersection
MAD temp.rgb, temp.r, geomDir, geomPos;

# Compute the difference vector
SUB diffVec, temp, center;

# Compute the texture coordinates
DP3 temp.r, diffVec, state.matrix.modelview.row[0];
DP3 temp.g, diffVec, state.matrix.modelview.row[1];
MUL temp.rg, temp, params2.r;

# Center background image
ADD temp.rg, temp, .5;

# Look up the texel value
TEX temp.rgb, temp, texture[2], 2D;
MOV temp.a, 1.0;

# Blend the background pixel
SUB texblen, 1.0, dst.a;
MAD dst, temp, texblen.x, dst;

# Write the output color
MOV result.color, dst;

END
19  Java Game APIs & Engines / JOGL Development / Re: Can jogl handle 3D volume rendering? on: 2006-02-17 21:47:40

Could you tell me how.   I am a new jogl user.
20  Java Game APIs & Engines / JOGL Development / Re: Can jogl handle 3D volume rendering? on: 2006-02-17 19:42:47
My card ( GeForce 6800 GS ) has 256 MB memory.   How do you expand the heap size?
I think the memory leak is caused by the glTexImage3D.
21  Java Game APIs & Engines / JOGL Development / Can jogl handle 3D volume rendering? on: 2006-02-17 17:23:09

I try to render 256x256x256 3D data set by using jogl.   I got a Java  virtual machine internal memory leak.   I doubt can jogl handle real time volume rendering or not.   I post my jogl project and data set under the following link.    Hopefullly, some experts can help me to find the error( might be in my code). 

http://home.gwu.edu/~ruida/volren.rar

Thanks

--Cat
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (64 views)
2014-04-15 18:08:23

BurntPizza (62 views)
2014-04-15 03:46:01

UprightPath (75 views)
2014-04-14 17:39:50

UprightPath (58 views)
2014-04-14 17:35:47

Porlus (76 views)
2014-04-14 15:48:38

tom_mai78101 (101 views)
2014-04-10 04:04:31

BurntPizza (161 views)
2014-04-08 23:06:04

tom_mai78101 (256 views)
2014-04-05 13:34:39

trollwarrior1 (209 views)
2014-04-04 12:06:45

CJLetsGame (216 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!