Skip to content

Commit 79ed38b

Browse files
committed
model fixes
1 parent d9d75e5 commit 79ed38b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

LuaSTG/Core/Graphics/Model_OpenGL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ namespace Core::Graphics
485485
}
486486
glBindBuffer(GL_ARRAY_BUFFER, mblock.vertex_buffer);
487487
glBufferData(GL_ARRAY_BUFFER, bytewidth, buffer.data.data() + bufferview.byteOffset + accessor.byteOffset, GL_STATIC_DRAW);
488-
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
488+
glVertexAttribPointer(0, tinygltf::GetNumComponentsInType(accessor.type), accessor.componentType, GL_FALSE, 0, 0);
489489

490490
mblock.draw_count = accessor.count;
491491
}
@@ -505,7 +505,7 @@ namespace Core::Graphics
505505
}
506506
glBindBuffer(GL_ARRAY_BUFFER, mblock.normal_buffer);
507507
glBufferData(GL_ARRAY_BUFFER, bytewidth, buffer.data.data() + bufferview.byteOffset + accessor.byteOffset, GL_STATIC_DRAW);
508-
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 0, 0);
508+
glVertexAttribPointer(3, tinygltf::GetNumComponentsInType(accessor.type), accessor.componentType, GL_FALSE, 0, 0);
509509
}
510510
if (prim.attributes.contains("COLOR_0"))
511511
{
@@ -523,7 +523,7 @@ namespace Core::Graphics
523523
}
524524
glBindBuffer(GL_ARRAY_BUFFER, mblock.color_buffer);
525525
glBufferData(GL_ARRAY_BUFFER, bytewidth, buffer.data.data() + bufferview.byteOffset + accessor.byteOffset, GL_STATIC_DRAW);
526-
glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 0, 0);
526+
glVertexAttribPointer(2, tinygltf::GetNumComponentsInType(accessor.type), accessor.componentType, GL_TRUE, 0, 0);
527527
}
528528
if (prim.attributes.contains("TEXCOORD_0"))
529529
{
@@ -541,7 +541,7 @@ namespace Core::Graphics
541541
}
542542
glBindBuffer(GL_ARRAY_BUFFER, mblock.uv_buffer);
543543
glBufferData(GL_ARRAY_BUFFER, bytewidth, buffer.data.data() + bufferview.byteOffset + accessor.byteOffset, GL_STATIC_DRAW);
544-
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
544+
glVertexAttribPointer(1, tinygltf::GetNumComponentsInType(accessor.type), accessor.componentType, GL_FALSE, 0, 0);
545545
}
546546
if (prim.indices >= 0)
547547
{

0 commit comments

Comments
 (0)