의 INT 중 4 바이트 I 다음 정점 셰이더있다 : I 이렇게 채워을 풀고 GLSL
#version 330 core
struct Bone
{
int parent;
float scale;
mat4 matrix;
};
uniform mat4 MVP;
uniform Bone[67] Bones;
layout(location = 0) in vec3 position;
layout(location = 1) in int boneIndex;
layout(location = 2) in vec4 weight;
layout(location = 3) in vec3 normal;
layout(location = 4) in vec2 UVCords;
out vec2 UV;
void main()
{
gl_Position = MVP * vec4(position, 1.0f);
UV = UVCords;
}
(C++)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)0); //float position[3]
glVertexAttribPointer(1, 1, GL_INT, GL_FALSE, sizeof(Vertex), (void*)12); //char boneIndex[4]
glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)16); //float weights[4]
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)32); //float normals[3]
glVertexAttribPointer(4, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)44); //float textureCords[2]
버퍼 개체의 실제 데이터를 포함 이들의 배열은 다음과 같습니다
이제struct Vertex
{
float position[3];
char boneIndex[4];
float weights[4];
float normals[3];
float textureCords[2];
};
, 내 질문에 내가,643,926,321에서 4 바이트를 추출 할 수있는 방법이다 GLSL 쪽에서 0? GLSL이 바이트 크기 타입을 지원하지 않는다는 것을 알고 있기 때문에 병이 4 개의 다른 int 변수로 추출해야한다고 생각합니다.
google이 먼저 내게주었습니다. http://www.gamedev.net/topic/556757-unpack-4-bytes-from-an-int-in-glsl/ – SAKrisT