Bind attribute location
Realized that attribute locations were not bound for the geometry pass. Fixed that and renamed variables to be camelCase
This commit is contained in:
parent
944f98243c
commit
f638a2f1f8
|
@ -1,7 +1,7 @@
|
|||
#version 450 core
|
||||
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec2 inTexCoord;
|
||||
layout(location = 0) in vec3 posAttrib;
|
||||
layout(location = 1) in vec2 texCoordAttrib;
|
||||
|
||||
out VS_OUT {
|
||||
vec3 position;
|
||||
|
@ -9,6 +9,6 @@ out VS_OUT {
|
|||
} vs_out;
|
||||
|
||||
void main() {
|
||||
vs_out.position = (vec4(inPosition, 1.0f)).xyz;
|
||||
vs_out.texCoord = inTexCoord;
|
||||
vs_out.position = (vec4(posAttrib, 1.0f)).xyz;
|
||||
vs_out.texCoord = texCoordAttrib;
|
||||
}
|
|
@ -160,13 +160,13 @@ GLuint InitShader(const char* vShaderFile, const char* fShaderFile)
|
|||
}
|
||||
|
||||
//set shader attrib locations
|
||||
const int pos_loc = 0;
|
||||
const int tex_coord_loc = 1;
|
||||
const int normal_loc = 2;
|
||||
const int posLoc = 0;
|
||||
const int texCoordLoc = 1;
|
||||
const int normalLoc = 2;
|
||||
|
||||
glBindAttribLocation(program, pos_loc, "pos_attrib");
|
||||
glBindAttribLocation(program, tex_coord_loc, "tex_coord_attrib");
|
||||
glBindAttribLocation(program, normal_loc, "normal_attrib");
|
||||
glBindAttribLocation(program, posLoc, "posAttrib");
|
||||
glBindAttribLocation(program, texCoordLoc, "texCoordAttrib");
|
||||
glBindAttribLocation(program, normalLoc, "normalAttrib");
|
||||
|
||||
/* link and error check */
|
||||
glLinkProgram(program);
|
||||
|
@ -238,13 +238,13 @@ GLuint InitShader(const char* vShaderFile, const char* gShaderFile, const char*
|
|||
}
|
||||
|
||||
//set shader attrib locations
|
||||
const int pos_loc = 0;
|
||||
const int tex_coord_loc = 1;
|
||||
const int normal_loc = 2;
|
||||
const int posLoc = 0;
|
||||
const int texCoordLoc = 1;
|
||||
const int normalLoc = 2;
|
||||
|
||||
glBindAttribLocation(program, pos_loc, "pos_attrib");
|
||||
glBindAttribLocation(program, tex_coord_loc, "tex_coord_attrib");
|
||||
glBindAttribLocation(program, normal_loc, "normal_attrib");
|
||||
glBindAttribLocation(program, posLoc, "posAttrib");
|
||||
glBindAttribLocation(program, texCoordLoc, "texCoordAttrib");
|
||||
glBindAttribLocation(program, normalLoc, "normalAttrib");
|
||||
|
||||
/* link and error check */
|
||||
glLinkProgram(program);
|
||||
|
@ -315,6 +315,13 @@ GLuint InitShader( const char* vShaderFile, const char* tcShader, const char* te
|
|||
glAttachShader( program, shader );
|
||||
}
|
||||
|
||||
//set shader attrib locations
|
||||
const int posLoc = 0;
|
||||
const int texCoordLoc = 1;
|
||||
|
||||
glBindAttribLocation(program, posLoc, "posAttrib");
|
||||
glBindAttribLocation(program, texCoordLoc, "texCoordAttrib");
|
||||
|
||||
/* link and error check */
|
||||
glLinkProgram(program);
|
||||
|
||||
|
|
Loading…
Reference in New Issue