diff options
| author | raysan5 <raysan5@gmail.com> | 2016-04-07 13:31:53 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-04-07 13:31:53 +0200 |
| commit | aa22d979834eeddb849f45bba7c0f467b575e6db (patch) | |
| tree | 50d1c417b2a2294e05e4d4ae638f7f4f4d923968 /src/rlgl.c | |
| parent | 4b51248372302bd9f1baf2452b389f57f0173d59 (diff) | |
| download | raylib-aa22d979834eeddb849f45bba7c0f467b575e6db.tar.gz raylib-aa22d979834eeddb849f45bba7c0f467b575e6db.zip | |
Simplified texture flip and added comments
Diffstat (limited to 'src/rlgl.c')
| -rw-r--r-- | src/rlgl.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1897,6 +1897,9 @@ Model rlglLoadModel(Mesh mesh) // Create buffers for our vertex data (positions, texcoords, normals) glGenBuffers(3, vertexBuffer); + + // NOTE: Default shader is assigned to model, so vbo buffers are properly linked to vertex attribs + // If model shader is changed, vbo buffers must be re-assigned to new location points (previously loaded) // Enable vertex attributes: position glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer[0]); @@ -2489,13 +2492,14 @@ static Shader LoadDefaultShader(void) } // Get location handlers to for shader attributes and uniforms +// NOTE: If any location is not found, loc point becomes -1 static void LoadDefaultShaderLocations(Shader *shader) { // Get handles to GLSL input attibute locations shader->vertexLoc = glGetAttribLocation(shader->id, "vertexPosition"); shader->texcoordLoc = glGetAttribLocation(shader->id, "vertexTexCoord"); shader->normalLoc = glGetAttribLocation(shader->id, "vertexNormal"); - shader->colorLoc = glGetAttribLocation(shader->id, "vertexColor"); // -1 if not found + shader->colorLoc = glGetAttribLocation(shader->id, "vertexColor"); // Get handles to GLSL uniform locations (vertex shader) shader->mvpLoc = glGetUniformLocation(shader->id, "mvpMatrix"); @@ -2503,8 +2507,8 @@ static void LoadDefaultShaderLocations(Shader *shader) // Get handles to GLSL uniform locations (fragment shader) shader->tintColorLoc = glGetUniformLocation(shader->id, "fragTintColor"); shader->mapDiffuseLoc = glGetUniformLocation(shader->id, "texture0"); - shader->mapNormalLoc = glGetUniformLocation(shader->id, "texture1"); // -1 if not found - shader->mapSpecularLoc = glGetUniformLocation(shader->id, "texture2"); // -1 if not found + shader->mapNormalLoc = glGetUniformLocation(shader->id, "texture1"); + shader->mapSpecularLoc = glGetUniformLocation(shader->id, "texture2"); } // Read text file |
