Cg does not work
by Alexander Gabele · in Torque Game Engine · 08/14/2003 (5:00 am) · 7 replies
Last week i have downloaded the newest version from nvidias CG SDK and tryed to use this in the torque engine. I have done following things:
- created a new header and cc file
- wrote my cg stuff insite this
- and added the needed lib datas and include files
- the include file was cgGL.h
Now my problem:
If I add my header file into an other file (example: fluidRender.cc)
like this:
#include "CG/CGShader.h"
after that the compiler says to me that any functions and vars had been redefinied
The reason of this is that the cgGL.h binds the gl.h again
But why ?? The gl.h is already binded.
Please help me, without this I cant work witch shaders.
Thank you.
- created a new header and cc file
- wrote my cg stuff insite this
- and added the needed lib datas and include files
- the include file was cgGL.h
Now my problem:
If I add my header file into an other file (example: fluidRender.cc)
like this:
#include "CG/CGShader.h"
after that the compiler says to me that any functions and vars had been redefinied
The reason of this is that the cgGL.h binds the gl.h again
But why ?? The gl.h is already binded.
Please help me, without this I cant work witch shaders.
Thank you.
About the author
#2
If you cannot get this to work, shaders are not your biggest problem.
08/14/2003 (9:41 am)
Torque does not include "gl/gl.h" you should put a copy of the Cg include/lib directories in the torque/lib directory, then comment out the lines that include gl.h.If you cannot get this to work, shaders are not your biggest problem.
#3
That's a little rough...
Alex,
Checkout this thread:
www.garagegames.com/mg/forums/result.thread.php?qt=4519
It'll help you grasp the way opengl is initialized in Torque and where to add your stuff.
John.
Edit: sp...
08/14/2003 (9:56 am)
Pat,That's a little rough...
Alex,
Checkout this thread:
www.garagegames.com/mg/forums/result.thread.php?qt=4519
It'll help you grasp the way opengl is initialized in Torque and where to add your stuff.
John.
Edit: sp...
#4
And I think Torque includes the gl.h, its inside the file platformGL.h.
But I think I should do the stuff Pat says.
THX
08/14/2003 (11:10 am)
I tried the #ifndef stuff but it does not work. Only errors.And I think Torque includes the gl.h, its inside the file platformGL.h.
But I think I should do the stuff Pat says.
THX
#5
08/14/2003 (12:28 pm)
Torque dynamically links GL under Windows. This is so the executable isn't tied to one specific version of GL, it also makes the executable size smaller, but it also messes up stuff like Cg. Just comment out the lines and you should be golden.
#6
Torque dont link the gl.h, its linking the files gl_func.h and so on.
But yet I have a new problem:
Everytime I compile the stuff I got messages who tell me there is an linker error in a project I dont work with ("map2dif", and sometimes other dirs).
I have done followings to the fluidRender.cc:
I included my file with this:
#include "CG/CGShader.h"
And added a function ("IsInit()")for a test:
void fluid::Render( bool& EyeSubmerged )
{
ShaderManager::IsInit();
Why do this changes work on other things ???
08/15/2003 (4:00 am)
Now it works, the problem was this:Torque dont link the gl.h, its linking the files gl_func.h and so on.
But yet I have a new problem:
Everytime I compile the stuff I got messages who tell me there is an linker error in a project I dont work with ("map2dif", and sometimes other dirs).
I have done followings to the fluidRender.cc:
I included my file with this:
#include "CG/CGShader.h"
And added a function ("IsInit()")for a test:
void fluid::Render( bool& EyeSubmerged )
{
ShaderManager::IsInit();
Why do this changes work on other things ???
#7
When you post, make sure that you state what compiler you are using. I was also putting in propriatary NVida register combiners in with Cg, but I know there was alot of .libs that I had to include, and those .libs had to be for VC++ .NET.
Make sure you build just about every .lib in the NVidia SDK related to Cg and add it to your project. Also make sure you copy cg.dll and cgGL.dll to your example directory where your Torque executable is.
Pie.
08/18/2003 (7:49 pm)
Look, I just shoehorned Cg into the Torque, and here's what I can tell you.When you post, make sure that you state what compiler you are using. I was also putting in propriatary NVida register combiners in with Cg, but I know there was alot of .libs that I had to include, and those .libs had to be for VC++ .NET.
Make sure you build just about every .lib in the NVidia SDK related to Cg and add it to your project. Also make sure you copy cg.dll and cgGL.dll to your example directory where your Torque executable is.
Pie.
Associate Stefan Beffy Moises
like e.g.