Skip to main content
gamedev.net
🔒 Locked

GLSL error

Started by soconne 3 replies 5.3k views
Original Post
soconne
soconne
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.
Author Freeworld3Dhttp://www.freeworld3d.org
dbzprogrammer
dbzprogrammer
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.
We should do this the Microsoft way: "WAHOOOO!!! IT COMPILES! SHIP IT!"
soconne
soconne
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?
Author Freeworld3Dhttp://www.freeworld3d.org
dbzprogrammer
dbzprogrammer
Don't sweat it, there's probably more overhaul when you try to cast to a vec4 and then re-assign. Probably another reason it didn't want to compile. =D
We should do this the Microsoft way: "WAHOOOO!!! IT COMPILES! SHIP IT!"
deavik
deavik
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));

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.