summaryrefslogtreecommitdiffstats
path: root/src/RendererSection.cpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-06-28 13:25:32 +0200
committerLaG1924 <lag1924@gmail.com>2021-06-28 13:25:32 +0200
commitf324c49d896eae159b7499ad6467f03dbcc900ca (patch)
tree6b4565293c2c43edd6484aaf38ea33a66fc91adc /src/RendererSection.cpp
parentMoved block face model matrix transformation to CPU (diff)
downloadAltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.tar
AltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.tar.gz
AltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.tar.bz2
AltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.tar.lz
AltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.tar.xz
AltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.tar.zst
AltCraft-f324c49d896eae159b7499ad6467f03dbcc900ca.zip
Diffstat (limited to '')
-rw-r--r--src/RendererSection.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/RendererSection.cpp b/src/RendererSection.cpp
index 1e0a1d0..e19043d 100644
--- a/src/RendererSection.cpp
+++ b/src/RendererSection.cpp
@@ -9,12 +9,10 @@
const GLfloat uv_coords[] = {
0.0f, 0.0f,
- 1.0f, 1.0f,
- 0.0f, 1.0f,
-
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 1.0f, 1.0f,
+ 1.0f, 0.0f,
+ 1.0f, 1.0f,
+ 0.0f, 1.0f,
+
};
const GLuint magicUniqueConstant = 88375;
@@ -41,30 +39,22 @@ RendererSection::RendererSection(const RendererSectionData &data) {
//Cube vertices
GLuint VertAttribPos = 3;
glBindBuffer(GL_ARRAY_BUFFER, Vbo[POSITIONS]);
- glVertexAttribPointer(VertAttribPos, 4, GL_FLOAT, GL_FALSE, 6 * 4 * sizeof(GLfloat), nullptr);
+ glVertexAttribPointer(VertAttribPos, 4, GL_FLOAT, GL_FALSE, 4 * 4 * sizeof(GLfloat), nullptr);
glEnableVertexAttribArray(VertAttribPos);
glVertexAttribDivisor(VertAttribPos, 1);
- glVertexAttribPointer(VertAttribPos + 1, 4, GL_FLOAT, GL_FALSE, 6 * 4 * sizeof(GLfloat), (void*)(1 * 4 * sizeof(GLfloat)));
+ glVertexAttribPointer(VertAttribPos + 1, 4, GL_FLOAT, GL_FALSE, 4 * 4 * sizeof(GLfloat), (void*)(1 * 4 * sizeof(GLfloat)));
glEnableVertexAttribArray(VertAttribPos + 1);
glVertexAttribDivisor(VertAttribPos + 1, 1);
- glVertexAttribPointer(VertAttribPos + 2, 4, GL_FLOAT, GL_FALSE, 6 * 4 * sizeof(GLfloat), (void*)(2 * 4 * sizeof(GLfloat)));
+ glVertexAttribPointer(VertAttribPos + 2, 4, GL_FLOAT, GL_FALSE, 4 * 4 * sizeof(GLfloat), (void*)(2 * 4 * sizeof(GLfloat)));
glEnableVertexAttribArray(VertAttribPos + 2);
glVertexAttribDivisor(VertAttribPos + 2, 1);
- glVertexAttribPointer(VertAttribPos + 3, 4, GL_FLOAT, GL_FALSE, 6 * 4 * sizeof(GLfloat), (void*)(3 * 4 * sizeof(GLfloat)));
+ glVertexAttribPointer(VertAttribPos + 3, 4, GL_FLOAT, GL_FALSE, 4 * 4 * sizeof(GLfloat), (void*)(3 * 4 * sizeof(GLfloat)));
glEnableVertexAttribArray(VertAttribPos + 3);
glVertexAttribDivisor(VertAttribPos + 3, 1);
- glVertexAttribPointer(VertAttribPos + 4, 4, GL_FLOAT, GL_FALSE, 6 * 4 * sizeof(GLfloat), (void*)(4 * 4 * sizeof(GLfloat)));
- glEnableVertexAttribArray(VertAttribPos + 4);
- glVertexAttribDivisor(VertAttribPos + 4, 1);
-
- glVertexAttribPointer(VertAttribPos + 5, 4, GL_FLOAT, GL_FALSE, 6 * 4 * sizeof(GLfloat), (void*)(5 * 4 * sizeof(GLfloat)));
- glEnableVertexAttribArray(VertAttribPos + 5);
- glVertexAttribDivisor(VertAttribPos + 5, 1);
-
//Cube UVs
GLuint UvAttribPos = 2;
glBindBuffer(GL_ARRAY_BUFFER, VboUvs);
@@ -146,7 +136,7 @@ void swap(RendererSection & lhs, RendererSection & rhs) {
void RendererSection::Render(RenderState &renderState) {
OPTICK_EVENT();
renderState.SetActiveVao(Vao);
- glDrawArraysInstanced(GL_TRIANGLES, 0, 6, numOfFaces);
+ glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, numOfFaces);
glCheckError();
}