Jump to content
  • Advertisement
Sign in to follow this  
soconne

OpenGL wrapper class for CG

This topic is 4899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anybody know of a simple wrapper class for Nvidia's CG to use with openGL ? I had seen one a while ago posted here http://www.gamedev.net/community/forums/topic.asp?topic_id=298110 But its no longer posted.

Share this post


Link to post
Share on other sites
Advertisement
Two files I use:

CGF.bat (for fragment programs):
@echo off
C:\NVIDIA\Cg\bin\cgc.exe -profile arbfp1 -o %1.afp %1
pause

CGV.bat (for vertex programs):
@echo off
C:\NVIDIA\Cg\bin\cgc.exe -profile arbvp1 -o %1.avp %1
pause

Easy to use, and you don't have to bother using the Cg libraries, since you can just generate the ARB programs. ;)

Share this post


Link to post
Share on other sites
the only problme with the above is that you are restricted to that profile: thus the shader has to be shroter (than what vp30 and vp40, fp30 and fp40) offer... in truth the CG library is simple and direct.... the only thig that one may not like is that it is C-style OOP, so wrather than writing stuff->Fuction(paramaters) [or stuff.Fucntion(paramaters)] you write Function(stuff,paramaters)... it is worht the time to take the 2 days to elarn the CG runtime
if you want I can post a silly little class I made to handle CG shaders (and a realted class to handle GLSL shaders)

Best Regards

Share this post


Link to post
Share on other sites
I'd probably have batch files for those profiles too, but as it is, my videocard wouldn't even support fragment programs if not for nVidia's NVemulate, and they run rather miserably as it is, so I cbf even trying the other profiles. ;)

Of course, if you did have support for all of the profiles, you could always modify the batch file to take 2 arguments and fill the batch file with if and else statements for the different profiles, based upon the first/second argument, but why bother if you don't plan on using them? ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!