Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad29157

Browse filesBrowse files
committed
working
1 parent f1832cb commit ad29157
Copy full SHA for ad29157

File tree

Expand file treeCollapse file tree

2 files changed

+21
-18
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-18
lines changed

‎src/main/kotlin/learnOpenGL/common/Mesh.kt

Copy file name to clipboardExpand all lines: src/main/kotlin/learnOpenGL/common/Mesh.kt
+18-15Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ package learnOpenGL.common
33
import glm.BYTES
44
import glm.vec2.Vec2
55
import glm.vec3.Vec3
6+
import org.lwjgl.opengl.GL11.GL_FLOAT
67
import org.lwjgl.opengl.GL15.*
8+
import org.lwjgl.opengl.GL20.glEnableVertexAttribArray
9+
import org.lwjgl.opengl.GL20.glVertexAttribPointer
710
import org.lwjgl.opengl.GL30.glGenVertexArrays
811
import uno.buffer.byteBufferBig
912
import uno.buffer.intBufferBig
10-
import uno.gln.glBindBuffer
11-
import uno.gln.glBindVertexArray
12-
import uno.gln.intBuffer
13+
import uno.glf.glf
14+
import uno.glf.semantic
15+
import uno.gln.*
1316

1417
/**
1518
* Created by GBarbieri on 02.05.2017.
@@ -76,21 +79,21 @@ class Mesh(
7679

7780
// Set the vertex attribute pointers
7881
// Vertex Positions
79-
glEnableVertexAttribArray(0)
80-
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *)0)
82+
glEnableVertexAttribArray(semantic.attr.POSITION)
83+
glVertexAttribPointer(semantic.attr.POSITION, Vec3.length, GL_FLOAT, false, Vertex.size, 0)
8184
// Vertex Normals
82-
glEnableVertexAttribArray(1)
83-
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *) offsetof (Vertex, Normal))
85+
glEnableVertexAttribArray(semantic.attr.NORMAL)
86+
glVertexAttribPointer(semantic.attr.NORMAL, Vec3.length, GL_FLOAT, false, Vertex.size, Vec3.size)
8487
// Vertex Texture Coords
85-
glEnableVertexAttribArray(2)
86-
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *) offsetof (Vertex, TexCoords))
88+
glEnableVertexAttribArray(semantic.attr.TEX_COORD)
89+
glVertexAttribPointer(semantic.attr.TEX_COORD, Vec2.length, GL_FLOAT, false, Vertex.size, Vec3.size * 2)
8790
// Vertex Tangent
88-
glEnableVertexAttribArray(3)
89-
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *) offsetof (Vertex, Tangent))
90-
// Vertex Bitangent
91-
glEnableVertexAttribArray(4)
92-
glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *) offsetof (Vertex, Bitangent))
91+
// glEnableVertexAttribArray(3)
92+
// glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *) offsetof (Vertex, Tangent))
93+
// // Vertex Bitangent
94+
// glEnableVertexAttribArray(4)
95+
// glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid *) offsetof (Vertex, Bitangent))
9396

94-
glBindVertexArray(0)
97+
glBindVertexArray()
9598
}
9699
}

‎src/main/kotlin/learnOpenGL/common/Model.kt

Copy file name to clipboardExpand all lines: src/main/kotlin/learnOpenGL/common/Model.kt
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ class Model(path: String, val gammaCorrection: Boolean = false) {
7171
if (mesh.mTextureCoords.isNotEmpty())
7272
Vec2(mesh.mTextureCoords[0][i])
7373
else
74-
Vec2(),
75-
tangent = mesh.mTangents[i],
76-
bitangent = mesh.mBitangents[i])
74+
Vec2())
75+
// tangent = mesh.mTangents[i],
76+
// bitangent = mesh.mBitangents[i])
7777

7878
/* Now wak through each of the mesh's faces (a face is a mesh its triangle) and retrieve the corresponding
7979
* vertex indices. */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.