Shark.cpp
branchv_0
changeset 2 3faef2f5128e
parent 1 fb65455622b9
child 3 48dc4ae894b0
--- a/Shark.cpp	Tue Nov 28 22:45:33 2023 +0100
+++ b/Shark.cpp	Wed Nov 29 01:11:19 2023 +0100
@@ -237,13 +237,13 @@
 			glm::radians(ctx.fov),
 			width / height,
 			0.1f, 100.0f);
-	glUniformMatrix4fv(ProgAttr.projection, 1, GL_FALSE, &projection[0][0]);
+	glUniformMatrix4fv(ProgAttr.uProjection, 1, GL_FALSE, &projection[0][0]);
 
 	glm::mat4 view = glm::lookAt(
 			ctx.cameraPos,
 			ctx.cameraPos + ctx.cameraFront,
 			ctx.cameraUp);
-	glUniformMatrix4fv(ProgAttr.view, 1, GL_FALSE, &view[0][0]);
+	glUniformMatrix4fv(ProgAttr.uView, 1, GL_FALSE, &view[0][0]);
 
 	// glBindVertexArray(vao);
 
@@ -252,7 +252,7 @@
 	// float angle = 20.0f;
 	// glm::vec3 xxx = glm::vec3(1.0f, 0.3f, 0.5f);
 	// model = glm::rotate(model, glm::radians(angle), xxx);
-	glUniformMatrix4fv(ProgAttr.model, 1, GL_FALSE, &model[0][0]);
+	glUniformMatrix4fv(ProgAttr.uModel, 1, GL_FALSE, &model[0][0]);
 
 	glDrawArrays(GL_TRIANGLES, 0, 2 * 3); // viz loadVertices() kde plníme data
 	std::cerr << "GLSL: glDrawArrays()" << std::endl;
@@ -286,16 +286,16 @@
 		};
 
 		// Vertex data:
-		glVertexAttribPointer(ProgAttr.vertexXYZ, 3, // vertex items
+		glVertexAttribPointer(ProgAttr.aVertexXYZ, 3, // vertex items
 				GL_FLOAT, GL_FALSE, 5 * sizeof (float),
 				(void*) 0);
-		glEnableVertexAttribArray(ProgAttr.vertexXYZ);
+		glEnableVertexAttribArray(ProgAttr.aVertexXYZ);
 
 		// Texture positions:
-		glVertexAttribPointer(ProgAttr.textureXY, 2, // texture items
+		glVertexAttribPointer(ProgAttr.aTextureXY, 2, // texture items
 				GL_FLOAT, GL_FALSE, 5 * sizeof (float),
 				(void*) (3 * sizeof (float)));
-		glEnableVertexAttribArray(ProgAttr.textureXY);
+		glEnableVertexAttribArray(ProgAttr.aTextureXY);
 
 		glBufferData(GL_ARRAY_BUFFER,
 				vertices.size() * sizeof (vertices[0]),
@@ -415,14 +415,14 @@
 
 		glLinkProgram(program);
 
-		ProgAttr.vertexXYZ = glGetAttribLocation(program, "vertices");
-		ProgAttr.textureXY = glGetAttribLocation(program, "textureCoordinates");
-		ProgAttr.model = glGetUniformLocation(program, "model");
-		ProgAttr.view = glGetUniformLocation(program, "view");
-		ProgAttr.projection = glGetUniformLocation(program, "projection");
-		ProgAttr.jazz = glGetUniformLocation(program, "jazz");
-		ProgAttr.color = glGetFragDataLocation(program, "outColor");
-		glBindFragDataLocation(program, ProgAttr.color, "outColor");
+		ProgAttr.aVertexXYZ = glGetAttribLocation(program, "aVertexXYZ");
+		ProgAttr.aTextureXY = glGetAttribLocation(program, "aTextureXY");
+		ProgAttr.uModel = glGetUniformLocation(program, "uModel");
+		ProgAttr.uView = glGetUniformLocation(program, "uView");
+		ProgAttr.uProjection = glGetUniformLocation(program, "uProjection");
+		ProgAttr.uTexture = glGetUniformLocation(program, "uTexture");
+		ProgAttr.fColor = glGetFragDataLocation(program, "fColor");
+		glBindFragDataLocation(program, ProgAttr.fColor, "fColor");
 		// listVariables(program);
 		GLint linkStatus;
 		glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);