Jump to content
  • Advertisement
Sign in to follow this  
joanusdmentia

OpenGL GLSL compilation [solved]

This topic is 5384 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

I'm currently having some trouble compiling separate shader objects in to a compile shader program. I have the following vertex shader objects:
uniform float blend;
attribute vec3 vertex1;
attribute vec3 vertex2;

void VertexTweening()
{
    gl_Position = gl_ModelViewProjectionMatrix * vec4(mix(vertex1,vertex2,blend),1);
}


and
attribute vec2 skinTexCoord;
void VertexTweening();

void main()
{
    VertexTweening();
    gl_TexCoord[0] = vec4(skinTexCoord,0,1);
    gl_FrontColor = vec4(1,1,1,1);
}


If I concat them into a single string it compiles fine. However if I try and compile them separately I get the following compilation errors. For the first shader object:
(6) : error C3002: call to undefined function "VertexTweening"
And for the second:
(0) : error C3001: no program defined
As far as I can gather from reading the GLSL 1.10 specs this should work fine. Any ideas? I have a GeForce FX5200 with the 61.76 drivers (which are OpenGL 1.5 compliant) and I'm using the ARB_shader_objects extension. [Edited by - joanusdmentia on September 29, 2004 6:27:14 PM]

Share this post


Link to post
Share on other sites
Advertisement
I can't be sure, but I think the problem is with the way you do the compilation. These errors seem to be linker errors, especially the "no program defined". It seems that you compile the first shader,attach it to the program,link the program, and then proceed with the second. Am I right?

The correct procedure is to compile the two shaders, then attach them to the program, and then finally link the program just once.

Share this post


Link to post
Share on other sites
*sigh* I wish it was that easy. I'm currently doing the following:

Create program
Compile then attach shader 1
Compile then attach shader 2
Link program

I've also updated to the 61.77 drivers, but that didn't help. If anyone has the 1.00 specs (apparently you can't get them on opengl.org now that 1.10 is out) would they be able to check if this paragraph is different?

Quote:
Section 6.1 Function Definitions (near the end)
The function main is used as the entry point to a shader. A shader need not contain a function named
main, but one shader in a set of shaders linked together to form a single program must.

Share this post


Link to post
Share on other sites
This is weird. You say that you get compilation errors, but these are linking errors. Can you post the code where you do the compilation/linking?

Share this post


Link to post
Share on other sites
For those interested I've solve the problem. Turns out it was the NVIDIA drivers. After installing the unofficial 66.70 drivers from Guru3D.com all worked as it should.

Thanks for your help!

Share this post


Link to post
Share on other sites
I had this exact same problem today. I was unable to compile subroutines.

I downloaded the last pre-release 66.81 driver and now my system crashes when I run my program.

Are others having problems with 66.81? Is there a way to fix it?

Would an older version be more likely to work, while still fixing the compile problem?

Share this post


Link to post
Share on other sites
The 66.70 drivers haven't given me any troubles. IIRC I did a quick test with conditionals and the compiler crashed, but since my card doesn't support conditionals I don't really care [smile]

Keep in mind that these are pre-releases for a reason..... use at your own risk.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!