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:
Jack 2024-08-25 22:16:14 -04:00
parent 944f98243c
commit f638a2f1f8
2 changed files with 315 additions and 308 deletions

View File

@ -1,7 +1,7 @@
#version 450 core #version 450 core
layout(location = 0) in vec3 inPosition; layout(location = 0) in vec3 posAttrib;
layout(location = 1) in vec2 inTexCoord; layout(location = 1) in vec2 texCoordAttrib;
out VS_OUT { out VS_OUT {
vec3 position; vec3 position;
@ -9,6 +9,6 @@ out VS_OUT {
} vs_out; } vs_out;
void main() { void main() {
vs_out.position = (vec4(inPosition, 1.0f)).xyz; vs_out.position = (vec4(posAttrib, 1.0f)).xyz;
vs_out.texCoord = inTexCoord; vs_out.texCoord = texCoordAttrib;
} }

View File

@ -160,13 +160,13 @@ GLuint InitShader(const char* vShaderFile, const char* fShaderFile)
} }
//set shader attrib locations //set shader attrib locations
const int pos_loc = 0; const int posLoc = 0;
const int tex_coord_loc = 1; const int texCoordLoc = 1;
const int normal_loc = 2; const int normalLoc = 2;
glBindAttribLocation(program, pos_loc, "pos_attrib"); glBindAttribLocation(program, posLoc, "posAttrib");
glBindAttribLocation(program, tex_coord_loc, "tex_coord_attrib"); glBindAttribLocation(program, texCoordLoc, "texCoordAttrib");
glBindAttribLocation(program, normal_loc, "normal_attrib"); glBindAttribLocation(program, normalLoc, "normalAttrib");
/* link and error check */ /* link and error check */
glLinkProgram(program); glLinkProgram(program);
@ -238,13 +238,13 @@ GLuint InitShader(const char* vShaderFile, const char* gShaderFile, const char*
} }
//set shader attrib locations //set shader attrib locations
const int pos_loc = 0; const int posLoc = 0;
const int tex_coord_loc = 1; const int texCoordLoc = 1;
const int normal_loc = 2; const int normalLoc = 2;
glBindAttribLocation(program, pos_loc, "pos_attrib"); glBindAttribLocation(program, posLoc, "posAttrib");
glBindAttribLocation(program, tex_coord_loc, "tex_coord_attrib"); glBindAttribLocation(program, texCoordLoc, "texCoordAttrib");
glBindAttribLocation(program, normal_loc, "normal_attrib"); glBindAttribLocation(program, normalLoc, "normalAttrib");
/* link and error check */ /* link and error check */
glLinkProgram(program); glLinkProgram(program);
@ -315,6 +315,13 @@ GLuint InitShader( const char* vShaderFile, const char* tcShader, const char* te
glAttachShader( program, shader ); 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 */ /* link and error check */
glLinkProgram(program); glLinkProgram(program);