Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set the model vertex colors to white
When running the given examples I had an all black screen.
I realized the shader was still multiplying the texture and vertex
colors.

An alternative solution would be to modify the fragment shader,
but felt it was better to provide proper Vertex attributes.
  • Loading branch information
PeterShinners committed Oct 14, 2016
commit 86fd19d54b1a542157a69390fb1de204128cfdc9
2 changes: 2 additions & 0 deletions 08_Loading_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ vertex.texCoord = {
attrib.texcoords[2 * index.texcoord_index + 0],
attrib.texcoords[2 * index.texcoord_index + 1]
};

vertex.color = {1.0f, 1.0f, 1.0f};
```

Unfortunately the `attrib.vertices` array is an array of `float` values instead
Expand Down
2 changes: 2 additions & 0 deletions code/model_loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@ class HelloTriangleApplication {
1.0f - attrib.texcoords[2 * index.texcoord_index + 1]
};

vertex.color = {1.0f, 1.0f, 1.0f};

if (uniqueVertices.count(vertex) == 0) {
uniqueVertices[vertex] = vertices.size();
vertices.push_back(vertex);
Expand Down