Game Development Community

TGE 1.4.2 with TLK, DRL, and CgWater

by intangir · in Torque Game Engine · 06/13/2006 (11:03 pm) · 6 replies

Well, this has been fun.. i got TGE 1.4.2 for linux cause.. thats all that is released for linux for now

then i got the lighting pack, which is only for 1.4 and 1.3.5 and stuff

so i merged the 1.4 TLK into my 1.4.2 TGE, and built, ran it it worked!!
(damn i wish i had make a copy there)

so then i wanted to try out this CgWater and DRL
(http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10591)

so i got the zip there, i merged it all into my 1.4.2 (alot of this is questionable which is an important fix in 1.4.2, and what should instead come from the resource.. cause alot of differences werent labeled)

i got the CG toolkit also, ive tried 2 versions

i even got it to BUILD! AND RUN!!!
(i edited the make file to link with the CG libs
and added these lines to GLCoreFunc.h:
GL_FUNCTION(void*, glXGetProcAddressARB, (const GLubyte *procName), return NULL; )
GL_FUNCTION(void*, glXGetCurrentDisplay, (void), return NULL; )
GL_FUNCTION(void*, glXQueryExtensionsString, (void *dpy, int screen), return NULL; )
)

but it crashes from somewhere in the libCgGL libraries, in random places. once i saw it crashed on glGetTexEnvfv (being used by libCG) and once i saw it crash messing with sgShadowDetailLevel
or something like that, which i think was an array? i dont recall.. the debug info it gave me on this was near worthless..

i think the problem is TONS of merges into the 1.4.2 codebase that dont quite match up how they wouldve in 1.4 or something?

thats my guess.. just all those merges from 1.4 dont quite work because of something different in 1.4.2...



anyone had any luck with this?
care to shed some light? or have any ideas?

#1
08/04/2006 (9:46 pm)
I had same problem. I think linker mutes real libGL, and libCgGL uses torque's internal function pointers (seems it not fully compatible with GL :\ ).
Solution is ugly - i was rename ALL gl-calls in torque to 'tgl' prefix (not by hands :), search-and-replace), and rewrite GL_FUNTION macro to use this prefix.
#2
08/05/2006 (12:19 pm)
So did you get it working?
#3
08/06/2006 (11:58 am)
Yes, Cg shaders works good.
Disadvantage of my solution - updating to new versions of TGE may be not so easy that it can be. But at this moment i dont know better way to solve this problem (not only with CgWater, with any Cg shaders).
#4
08/06/2006 (8:59 pm)
Im not sure i understand how your saying you did it

is it different than how i did it?

can you explain it in more detail?
#5
08/10/2006 (12:38 pm)
I renamed all gl-calls in TGE by adding 't' to it - glEnable -> tglEnable, glDepthMask -> tglDepthMask, etc.., and modify some functions in in platformX86UNIX/x86UNIXGL.cc:
static bool bindGLFunction( void *&fnAddress, const char *name )
{
	name++;
   void* addr = (void*)SDL_GL_GetProcAddress(name);
   bool ok = (bool)addr;
   if( !ok )
   {
      if (!isFnOk(name))
         Con::errorf(ConsoleLogEntry::General, " Missing OpenGL function '%s'", name);
      else
         ok = true;
   }
   else
      fnAddress = addr;
   return ok;
}

static bool bindEXTFunction( void *&fnAddress, const char *name )
{
	name++;
   void* addr = (void*)SDL_GL_GetProcAddress(name);
   if( !addr )
      Con::errorf(ConsoleLogEntry::General, " Missing OpenGL extension '%s'", name);
   else
      fnAddress = addr;
   return (addr != NULL);
}
#6
10/29/2006 (2:35 pm)
Why does it have to be done like this? i dont get whats happening
i keep getting segfaults, i havent tried it your way yet cause i still dont quite understand why this is nessisary

what exactly is happening?