Jump to content
  • Advertisement
Sign in to follow this  
slicer4ever

OpenGL GLSL C7507 warning

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

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).

Share this post


Link to post
Share on other sites
Advertisement
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

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!