PDA

View Full Version : What do I link with to get glslang?



dvm
07-08-2005, 03:58 PM
Hi people. I've finally gotten around to start writing some glslang code. I think my code compiles correctly but I get linker errors. My makefile looks like this:

glslang: main.cpp
g++ -o glslang main.cpp -lglutI get errors like:

g++ -o glslang main.cpp -lglut
/tmp/ccXPf0aL.o(.text+0x19b): In function `InitGL()':
main.cpp: undefined reference to `glCreateProgramObjectARB'
/tmp/ccXPf0aL.o(.text+0x1c3):main.cpp: undefined reference to `glCreateShaderObjectARB'
/tmp/ccXPf0aL.o(.text+0x1e1):main.cpp: undefined reference to `glShaderSourceARB'
/tmp/ccXPf0aL.o(.text+0x1f2):main.cpp: undefined reference to `glCompileShaderARB'
/tmp/ccXPf0aL.o(.text+0x20f):main.cpp: undefined reference to `glGetObjectParameterivARB'
/tmp/ccXPf0aL.o(.text+0x258):main.cpp: undefined reference to `glGetInfoLogARB'
/tmp/ccXPf0aL.o(.text+0x2b2):main.cpp: undefined reference to `glAttachObjectARB'What library do I need to add to gcc to link proper? Thanks for your time.

T101
07-08-2005, 09:53 PM
Try adding -lGL

That should be enough - since glsl is part of GL2.0 core, and implemented in the driver.
But it has to be a 2.0 lib. Be sure you also have the 2.0 libs in your library link path.

powerpad
07-08-2005, 10:28 PM
make sure that the necessary extensions are defined

dvm
07-09-2005, 11:48 AM
Found it! I had to use the glXGetProcAddress. Then I came to some other problems but finally I've been able to resolve the situation :) and start writing some of the shaders that are in the OpenGL Shading Language book.
But I'd like to take this opportunity and point out that the aforementioned book should provide a basic example of how one sets up a program to use shaders. It does provide snippets of settinp things up, but I couldn't find a complete example, thus had to resort to an example from the internet.
Anyway, I've much to learn now that I know how to write shaders.

PS It's a shame that ATI still don't provide OpenGL 2.0 functionality in their driver yet. The version supported in the latest release is 1.3 in Linux.

powerpad
07-09-2005, 12:43 PM
there is the example with the basic pair of shaders and it is exactly this path you have to follow in order to set up your app for shaders ...

like loading the source for a shader, compile it, provide it to the shader, attach it, create a program object, link the source and use the program object

dvm
07-09-2005, 03:08 PM
Yes, I hadn't read chapter 7 at the time I last posted. I just started reading it and things are becoming a lot clearer. My bad. I just expected to see an example including some glut initialization code. This is why I got lost.

T101
07-10-2005, 10:59 PM
dvm - sorry for going a bit off-topic here, but you mention ATi on Linux. I take it it's working fine for you (other than GL version)?

There's a very frustrated "ZigZag" lurking on the Linux forum. Maybe you can help him out?