Sign in to follow this  
soconne

GLSL error

Recommended Posts

soconne    105
I can't figure out why I'm getting the following error and having my app crashing: Shader Linking Error: Vertex info ----------- (8) : warning C7011: implicit cast from "int" to "float" (28) : warning C7011: implicit cast from "int" to "float" (28) : warning C7011: implicit cast from "int" to "float" (18) : warning C7011: implicit cast from "float" to "int" (18) : error C5025: lvalue in assignment too complex Here's the part of the shader
mat4 newMatrix = mat4(vec4(gl_MultiTexCoord1.xyz, 0.0),
			      0.0, 1.0, 0.0, 0.0,
                              0.0, 0.0, 1.0, 0.0,
                              0.0, 0.0, 0.0, 1.0);

If I replace the vec4(gl_MultiTexCoord1.xyz, 0.0) with simply 1.0, 0.0, 0.0, 0.0 the app runs just fine.

Share this post


Link to post
Share on other sites
dbzprogrammer    100
I got a fealing maybe putting "f" on the end might solve some problems, I don't know though. GLSL is very odd...

EDIT:

Hmmm, actually...


vec4 temp = vec4(gl_MultiTexCoord1.xyz,0.0f);
mat4 newMatrix = mat4(temp.x,temp.y,temp.z,temp.a,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);



Simple because if the conversion is too much for the compiler to do, you should do it yourself.

Share this post


Link to post
Share on other sites
soconne    105
Well I got it to work by putting each component of the texture coord in the matrix, but does this cause it to be slower? I just thought that perhaps the gpu can assign a vector into the row of the matrix faster than individual values, or does it not matter?

Share this post


Link to post
Share on other sites
deavik    570
I'm not sure but possibly you can't construct from a vector as well as scalars. For example: I think this might be allowed:

mat4 newmat = mat4(vec4, vec4, vec4, vec4);
or
mat4 newmat = mat4(float, float, ...(16 floats));

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this