aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2019-02-28 16:28:49 +0100
committerRay <raysan5@gmail.com>2019-02-28 16:28:49 +0100
commitb570b32337cd08ca3cf6eece683d2e23171bcbd5 (patch)
tree99e6deba30782af15eb8c62893bf66af28e162ef
parent32c61b1fa0736113517357e1c116acdf1b021115 (diff)
downloadraylib-b570b32337cd08ca3cf6eece683d2e23171bcbd5.tar.gz
raylib-b570b32337cd08ca3cf6eece683d2e23171bcbd5.zip
Added some comments on #594
-rw-r--r--src/rlgl.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 52165150..717801e3 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -728,6 +728,8 @@ typedef struct DrawCall {
//unsigned int vaoId; // Vertex Array id to be used on the draw
//unsigned int shaderId; // Shader id to be used on the draw
unsigned int textureId; // Texture id to be used on the draw
+ // TODO: Support additional texture units?
+
//Matrix projection; // Projection matrix for this draw
//Matrix modelview; // Modelview matrix for this draw
} DrawCall;
@@ -4132,9 +4134,13 @@ static void DrawBuffersDefault(void)
glUniformMatrix4fv(currentShader.locs[LOC_MATRIX_MVP], 1, false, MatrixToFloat(matMVP));
glUniform4f(currentShader.locs[LOC_COLOR_DIFFUSE], 1.0f, 1.0f, 1.0f, 1.0f);
- glUniform1i(currentShader.locs[LOC_MAP_DIFFUSE], 0);
+ glUniform1i(currentShader.locs[LOC_MAP_DIFFUSE], 0); // Provided value refers to the texture unit (active)
+
+ // TODO: Support additional texture units on custom shader
+ //if (currentShader->locs[LOC_MAP_SPECULAR] > 0) glUniform1i(currentShader.locs[LOC_MAP_SPECULAR], 1);
+ //if (currentShader->locs[LOC_MAP_NORMAL] > 0) glUniform1i(currentShader.locs[LOC_MAP_NORMAL], 2);
- // NOTE: Additional map textures not considered for default buffers drawing
+ // NOTE: Right now additional map textures not considered for default buffers drawing
int vertexOffset = 0;
@@ -4164,6 +4170,10 @@ static void DrawBuffersDefault(void)
for (int i = 0; i < drawsCounter; i++)
{
glBindTexture(GL_TEXTURE_2D, draws[i].textureId);
+
+ // TODO: Find some way to bind additional textures --> Use global texture IDs? Register them on draw[i]?
+ //if (currentShader->locs[LOC_MAP_SPECULAR] > 0) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textureUnit1_id); }
+ //if (currentShader->locs[LOC_MAP_SPECULAR] > 0) { glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textureUnit2_id); }
if ((draws[i].mode == RL_LINES) || (draws[i].mode == RL_TRIANGLES)) glDrawArrays(draws[i].mode, vertexOffset, draws[i].vertexCount);
else