View Full Version : Cg Profile on Macs/OpenGL

08 August 2005, 07:28 PM
i've got Problems (I think) with Cg on my Macs. I've just begun working on "The Cg Tutorial" Book. I'm still at the beginning, but i played around a bit with the settings and it seems that my Macs only support the FP20 and (even worse) the ARBVP1 Profiles.
I got an error Profile not supported when using a higher one than the ARBVP1 on vertices, so i made a little if passage to see which profiles are supported and the highest i got are the ones mentioned above.

My Computers are
PM G5 2x2Ghz, Geforce 6800, OSX.4 and Xcode 2.1
PB G4 1.33Ghz, Geforce FX5200, OSX.4 and Xcode 2.0

both showed the same results, normally i should get the xP40 profiles to work with the 6800 and the xP30 with the FX, shouldn't I? I don't need them right now (as im at the beginning of the tutorial) but its quite disappointing, because I only ordered the 6800 because of Shadermodel3 capabilities.

Oh, around the Cg part I use OpenGL with GLUT for the windowmanaging.
It seems that the command line compiler works with the -profile VP40 argument as it prints this output on my little shaderprogramm:

localhost:/ Thomas$ cgc -profile vp40 -entry C2E1v_green
14 lines, 0 errors.
OPTION NV_vertex_program3;
# cgc version 1.4.0000, build date Jun 9 2005 12:25:56
# command line args: -profile vp40
# source file:
#vendor NVIDIA Corporation
#version 1.0.02
#profile vp40
#program C2E1v_green
#var float2 position : $vin.POSITION : POSITION : 0 : 1
#var float4 C2E1v_green.position : $vout.POSITION : HPOS : -1 : 1
#var float4 C2E1v_green.color : $vout.COLOR : COL0 : -1 : 1
#const c[0] = 0 1
PARAM c[1] = { { 0, 1 } };
MOV result.color, c[0].xyxy;
MOV result.position.xy, vertex.position;
MOV, c[0].xyxy;
# 3 instructions, 0 R-regs

So are there any Problems with Cg on Macs, do I have to make special instructions for OpenGL or does OpenGL on Mac not support CG the way it should?

Thanks for your Help, Thomas

08 August 2005, 09:22 PM
Hi DerThomas.

Short answer: ARBVP1 and ARBFP1 work and work well. If you want anything more you're probably gonna have to use the Cg run-time.

GLSL support is coming very soon. If you can't wait, you might wantto take a look at what you can do with Quartz and Core Image libraries.

Hope this helps,

08 August 2005, 11:09 PM
Thanks for your fast answer.
I searched around a bit last night and I think i see a bit clearer now...
GLSL has nothing to do with Cg, right? Its an OpenGL extension for Shader programming and a different language than Cg, so my Cg tutorial wouldn't help me much with that.
The problem with OpenGL is that it doesn't let me acces my graphics hardware via Cg on the mac for some reason, right? So if i want to go deeper in Shader programming is now the right time to stop learning Cg and go for something else (e.g. GLSL)? Or do you see any chances for a better Cg support in the not so far future?

Back to something practical,
I can test if my programs compile with the command line compiler and a message like the one above tells me that it would work fine?
Im a bit concerned about the line
It doesnt mean that a fallback to ARBvp1 was used, does it?

Ok, i now found out, that with -profile vp30 i get !!VP2.0 and with -profile vp20 !!VP1.1 so indeed it seems like some fallback compile with the vp40 option :( but my GF 6800 should support VP40, right?

What do you mean with if I want more i have to use the Cg run-time? If I understood the tutorial right so far, Cg code is always compiled dynamically, so i can't make a binary and use it somehow in my OpenGL project?!

Thanks again for your help.

08 August 2005, 09:47 AM
Well I worked a bit with Cg on my Mac, but as I have an ATI card I didn't get further than those ARB profiles (which are veeery limited e.g. in terms of texture-access).
What you could try is the following:
Use the command line tool to generate the shader code for e.g. fp40. Now store that code in a file/string and load this into the nVidia extension for fp40 programs in OpenGl. That's not as "smooth" as doing this at runtime, but could work.

For GLSL - I do would prefer GLSL as it should run on all OpenGL >=1.5 comaptible cards but haven't come to test the extensions.
BTW - the GLSL extensions do exist in mac os - except "GL_ARB_shading_language_100".

CGTalk Moderation
08 August 2005, 09:47 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.