CgGL.cgGLIsProfileSupported() always return false.

Hey guys,

I’ve been trying, now for 3 days, to have a Cg program compiled and binded with JOGL.

My problem is quite simple, but yet frustrating. When I call CgGL.cgGLIsProfileSupported(), whatever the profile I give it, it returns false.
I have a Geforce 4 TI 4400, at least, but the very least, CG_PROFILE_VP20 should work.

I have:

  • installed my vid card latest drivers (from nvidia)
  • make sure I have only a single copy of cg.dll, cgGL.dll, jogl.dll, jogl_cg.dll and jogl.jar on my entire machine (no confusion possible)
  • I downloaded the latest version of jogl from the current july 2005 folder
  • I downloaded the Cg SDK 1.3 from jogl dev site, since the latest jogl has been linked to it.

Also, when I run the Cg\examples\runtime_ogl\Release\cgGL_vertex_example.exe from the SDK, it actually work.
The console shows:

#version 1.0.02
#profile vp20
#program main

and I see the rendered cube with correct vertex shading applied.

Any help would be much appreciated.

Peace.

Do the demos in the demos/cg directory in the jogl-demos source tree work, in particular the runtime_ogl demo?

Hey Ken,

Sorry for this long delay without reply your post.

It works with this demo. In fact I didn’t answer because I had so much fun playing with shaders since it started to work. The problem was exactly as commented in the file, Cg must be initialized after the GL context has been created, in the listener init method.

Now I’m using xith3d to add my shaders. I precompile my Cg files to .asm and pass them to xith3d. I have problem setting parameters but I’ll look in the xith3d forum now.

Before you gave me the link, I read that Cg had to be initialized after the gl context creation, however, I was still doing my initiallization at the wrong place.

Thanks again, I now have alot of fun creating effets with shaders.

Frank

Watch out for the generated assembly produced by cgc. When porting the HDR demo from Cg to ARB_fragment_program I found that the Cg compiler was relying on undocumented aliasing of certain parameters that was true on NVidia drivers but not on ATI drivers. I think the Cg 1.4 release may have changed / fixed this but the current JOGL doesn’t support Cg 1.4. However if you check out and build the “JSR-231” branch of the JOGL source tree (cvs co -r JSR-231 jogl) that branch has Cg 1.4 support. The APIs differ somewhat from the current JOGL but won’t be changing too drastically from their current form.