beyond-all-reason / beyond-all-reason/RecoilEngine
TypedRenderBuffer<T>::InitVAO() calls glDisableVertexAttribArray after unbinding the VAO?
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
Once the `vao.Unbind();` call is made... there is no valid VAO for `glDisableVertexAttribArray` to work on right?
Am I missing something?
Maybe it should look more like:
```
template
inline void TypedRenderBuffer::InitVAO() const
{
assert(vbo);
vao.Bind(); //will instantiate
vbo->Bind();
if (ebo)
ebo->Bind();
for (const AttributeDef& ad : T::attributeDefs) {
glEnableVertexAttribArray(ad.index);
glVertexAttribDivisor(ad.index, 0);
//assume only float or float convertible values
glVertexAttribPointer(ad.index, ad.count, ad.type, ad.normalize, ad.stride, ad.data);
}
//restore default state
for (const AttributeDef& ad : T::attributeDefs) {
glDisableVertexAttribArray(ad.index);
}
vao.Unbind();
vbo->Unbind();
if (ebo)
ebo->Unbind();
}
```
Contributor guide
Research direction
Start at TypedRenderBuffer::InitVAO() and trace the VAO binding state around vao.Bind(), glDisableVertexAttribArray, and vao.Unbind(). Confirm the correct ordering from the OpenGL behavior used by this code, then verify that the initialization leaves the intended vertex-array state without affecting later rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100