New Cg shader inputs

It just doesnt work. There’s a white plane in the middle of the screen. The grey background flashes like a strobe light between brighter and dark grey. I can use the mouse to turn and zoom in etc. but the thing just doesnt work.

In the bash I get these errors:

:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (5) : error C0109: Can't open include file "vtable.cg"
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (24) : error C1307: non constant expression for array size
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (99) : warning C7011: implicit cast from "float4" to "float3"
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (100) : warning C7011: implicit cast from "float4" to "float3"
:gobj(error): Shader encountered an error.
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (5) : error C0109: Can't open include file "vtable.cg"
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (24) : error C1307: non constant expression for array size
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (99) : warning C7011: implicit cast from "float4" to "float3"
:gobj(error): /Users/tiloprobst/Downloads/Advanced_Shader_Inputs_Demo/Advanced_Shader_Inputs_Demo/shader.sha: (100) : warning C7011: implicit cast from "float4" to "float3"

The flocking Ralph demo crashes and gives me this error:

DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "/Users/tiloprobst/Downloads/Advanced-Shader-Inputs/Tut-AdvacedShaderInputs.py", line 175, in <module>
    w = World()
  File "/Users/tiloprobst/Downloads/Advanced-Shader-Inputs/Tut-AdvacedShaderInputs.py", line 37, in __init__
    "Profile gp4vp is not supported by the hardware."
AssertionError: Profile gp4vp is not supported by the hardware.

Graphics card is a 8600M GT in a 2007 MacBookPro.

You are missing a file. Run generate_noise_table.py to get it.

It doesn’t crash this is an assertion error probably because the drivers of your graphics card are not updated.

Already did that. Still gives me that error and others.

How am I supposed to do that on a Mac? Install a new OS? Somehow I doubt this would be gone if I updated to 10.6.

The drivers of your graphics card have nothing to do with your OS.

Try to set to false basic-shaders-only in your Config.prc file. That could fix the problem. Otherwise just go on your graphics card vendor website and download updated drivers for your model.

Oh really? On the Mac it does. Drivers are only provided through Apple’s OS updates. I can not just go on the NVidia website and get new drivers!

I guess I should be more precise. The noise/sphere demo does generally work, but there is a grey flickering. The whole screen just flickers in grey tones. I can’t provide screenshots of that. I could make a video, yeah.

The instancing/flocking Ralph demo crashes with the errors mentioned above.

File "/Users/tiloprobst/Downloads/Advanced-Shader-Inputs/Tut-AdvacedShaderInputs.py", line 175, in <module>
    w = World()
  File "/Users/tiloprobst/Downloads/Advanced-Shader-Inputs/Tut-AdvacedShaderInputs.py", line 37, in __init__
    "Profile gp4vp is not supported by the hardware."
AssertionError: Profile gp4vp is not supported by the hardware.

If on a mac the graphics card drivers can be updated only from the Software Update (software not OS…) it doesn’t mean they are part of the OS. It does not make any sense to update the OS to get updated graphics card drivers.

By the way download the CG toolkit 2.0 it will solve the problem with the profile error.
Moreover download the OpenGL Extensions Viewer and look in the report tab if you have the extension GL_EXT_texture_array.

I deleted vtable.cg and it gave the same error you posted above and for the flickering I have no idea, there is no reason for that. You can delete

base.setBackgroundColor(0.9, 0.9, 0.9)

and see if it solves the problem. We tested it on windows and linux and we never had flickering.

EDIT:

You can still download the drivers from the NVIDIA website:
nvidia.com/object/GeForce_Ma … .2f16.html
but I don’t think the drivers are your problem, the problem is that you don’t have CG 2.0 on your mac.

Well sure it doesnt make sense but thats the way it is. Driver or ROM updates hardly ever appear in Apples Software Update. Major graphics card driver updates are only in OS X releases like 10.5.x or 10.6.x. For example, websites reported that Apple together with Valve is working on the drivers and that the updates will be rolled out propably starting with 10.6.5.

The percentage of Mac users actively updating their graphics card should be in the 0 - per mille range.

Those are the drivers specifically for Mac Pros with the GF GTX 285.

My current CG toolkit version is 2.1 (February 2009). I could download newer versions but I bet you it wont change a thing.

Do you have a link for the Extension Viewer on NVidias website? Dont find it there. Google has links for v3.31, but thats not NVidia.

Updated to the latest CG kit … Error for Instanced Ralph:

Traceback (most recent call last):
  File "/Applications/Panda3D_Mare_Ceti/samples/Advanced-Shader-Inputs/Tut-AdvacedShaderInputs.py", line 175, in <module>
    w = World()
  File "/Applications/Panda3D_Mare_Ceti/samples/Advanced-Shader-Inputs/Tut-AdvacedShaderInputs.py", line 37, in __init__
    "Profile gp4vp is not supported by the hardware."
AssertionError: Profile gp4vp is not supported by the hardware.

I have no idea why the gp4vp is not supported on Mac. I tested it by myself on my Mac and it seems like the only profile supported is arbvp1.

Here is the program to check if a profile is supported:

#include <iostream>
#ifdef __APPLE__
#  include <OpenGL/gl.h>
#  include <OpenGL/glu.h>
#  include <GLUT/glut.h>
#else
#  include <GL/gl.h>
#  include <GL/glu.h>
#  include <GL/glut.h>
#endif

#include <Cg/cgGL.h>

int main(int argc, char** argv) {
  glutInit(&argc, argv);
  glutCreateWindow(argv[0]);
  CGprofile profile = cgGetProfile(argv[1]);

  std::cout << "Cg profile \"" << argv[1] << "\" is " << 
    ((cgGLIsProfileSupported(profile))? "" : "NOT ") << "supported." << std::endl;
}

And here is the makefile:


entry:
	make main

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
	GL_LIBS	= -framework Carbon -framework OpenGL -framework GLUT
	CG_LIBS = -framework Cg
else
	GL_LIBS = -lGL -lGLU -lglut
	CG_LIBS = -lCg -lCgGL -lpthread
endif


LFLAGS  = $(GL_LIBS) $(CG_LIBS)

main: cgIsProfileSupported.cpp
	g++ $(LFLAGS) -o cgIsProfileSupported cgIsProfileSupported.cpp
	
### CLEAN ###
clean:
	rm -fv cgIsProfileSupported

you can do something like: make && ./cgIsProfileSupported gp4vp

By the way try to remove the assert at line 36 in Tut-Advanced-Shader-Inputs.py

Whatever I try, the old way doesn’t work for me. I didn’t get around to trying a CVS version, so I’m stuck with the 1.7.0 release of panda3d. The manual is very explicit how it should work:

but this:

test = Vec4(0.5,0.0,0.0,0.0)
self.tom.actor.setShaderInput("dt",test)
self.tom.actor.setShader(Shader.load("cgshader.sha"))

doesn’t work with the shader:

//Cg
/* lesson2.sha */
 

void vshader(float4 vtx_position : POSITION, 
             float2 vtx_texcoord0 : TEXCOORD0,
             uniform float4x4 mat_modelproj,
	     out float4 l_position : POSITION,
	     out float2 l_texcoord0 : TEXCOORD0)
{
	l_position= mul(mat_modelproj, vtx_position);
	l_texcoord0=vtx_texcoord0;
}

void fshader(float2 l_texcoord0 : TEXCOORD0,
       	     uniform sampler2D tex_0 : TEXUNIT0,
       	     uniform float4 dt,
	     out float4 o_color : COLOR)
{
	float4 texColor=tex2D(tex_0, l_texcoord0);
	o_color= float4(texColor.r,texColor.g,texColor.b,0.0);
}

The shader is a modified snippet from the glow sample.

this is what I get when trying to run it:

:gobj(error): cgshader.sha: invalid parameter name (uniform in float4 dt)
:gobj(error): Shader encountered an error.

It would be very nice if the manual was a bit more verbose on that topic.

Thanks if anyone can point me to where I went wrong with my code…

darn… just a minute after I posted the above, I found out that adding k_ to the parameter in the shader definition does the trick. Too bad that is not mentioned in the manual…

Also it pisses me off that GLSL is unusable atm, because that’s the way I wanted to go. The mentioning of a possible DirectX route struck the same chord with me…

Thanks for pointing this out. I had the models in my working directory, and I forgot to change it.levitra online

it’s the same for me