Skip to main content
gamedev.net
🔒 Locked

GLSL C7507 warning

Started by slicer4ever Dec 19, 2011 at 12:59 AM 1 replies 2.1k views
Original Post
slicer4ever
slicer4ever
hello all, when i compile a shader with an attribute of int, i get:
error C7507: OpenGL does not allow attributes of type int
error C7507: OpenGL does not allow attributes of type int[4]
error C7507: OpenGL does not allow attributes of type float[4]

i swear i've done this in the past without any problems.

any help on what i could be doing wrong, is much appreciated


#version 120
struct Jnt{
vec4 BindPos;
vec4 RelRot;
vec4 RelPos;
};

uniform Jnt Jnts[18];
attribute int NbrBns;
attribute int BnIdx[4];
attribute float BnWeight[4];

vec4 QuatRotatePoint(in vec4 pnt, in vec4 q){
vec4 o;
float ww = q[3]*q[3];
float wx = q[3]*q[0];
float wy = q[3]*q[1];
float wz = q[3]*q[2];
float xx = q[0]*q[0];
float xy = q[0]*q[1];
float xz = q[0]*q[2];
float yy = q[1]*q[1];
float yz = q[1]*q[2];
float zz = q[2]*q[2];
o.x = (ww*pnt.x + 2.0f*wy*pnt.z - 2.0f*wz*pnt.y + xx*pnt.x + 2.0f*xy*pnt.y + 2.0f*xz*pnt.z - zz*pnt.x - yy*pnt.x);
o.y = (2.0f*xy*pnt.x + yy*pnt.y + 2.0f*yz*pnt.z + 2.0f*wz*pnt.x - zz*pnt.y + ww*pnt.y - 2.0f*wx*pnt.z - xx*pnt.y);
o.z = (2.0f*xz*pnt.x + 2.0f*yz*pnt.y + zz*pnt.z - 2.0f*wy*pnt.x - yy*pnt.z + 2.0f*wx*pnt.y - xx*pnt.z + ww*pnt.z);
o.w = 1.0;
return o;
}

vec4 DeformPoint(in vec4 pnt){
vec4 out;
out.x = 0.0;
out.y = 0.0;
out.z = 0.0;
out.w = pnt.w;
for(int i=0;i<NbrBns;i++){
vec4 tmp;
tmp.x = pnt.x - Jnts[BnIdx].BindPos.x;
tmp.y = pnt.y - Jnts[BnIdx].BindPos.y;
tmp.z = pnt.z - Jnts[BnIdx].BindPos.z;
tmp = QuatRotatePoint(tmp, Jnts[BnIdx].RelRot);
out.x += (Jnts[BnIdx].BindPos.x+Jnts[BnIdx].RelPos.x-pnt.x)*BnWeight;
out.y += (Jnts[BnIdx].BindPos.y+Jnts[BnIdx].RelPos.y-pnt.y)*BnWeight;
out.z += (Jnts[BnIdx].BindPos.z+Jnts[BnIdx].RelPos.z-pnt.z)*BnWeight;
}
out.x += pnt.x;
out.y += pnt.y;
out.z += pnt.z;
return out;
}


^^Current vertex shader i'm trying to get working^^

edit: ok, fixed all my issues, i need to use in instead of attribute, and i need to not use keywords such as out for variable names(lol, oops).
V-man
V-man
I suggest that you simplify your shader such as

out.x += pnt.x;
out.y += pnt.y;
out.z += pnt.z;

becomes
out.xyz +=pnt.xyz;

http://www.opengl.org/wiki/GLSL_Optimizations#Use_Swizzle
elurahu
elurahu
My guess would be to change the shader version to something newer than 120. I don't believe it supports ints.

Topic Locked

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

Sign in to reply to this topic.