🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

RenderDoc output does not match actual OpenGL program output

Started by
3 comments, last by 21st Century Moose 3 years, 11 months ago

Hello Everyone,

I'm writing a game using OpenGL in which you play as a tank that can shoot shells. The shells are drawn via instanced rendering, and the instanced vertex array is simply a tightly-packed buffer of Vector3<f32> that gets updated every frame with a call to glBufferSubData().

The strange thing is that while my game's actual output is wrong, RenderDoc's frame capture shows me the output I would expect. The following screenshots were taken right after firing a couple of shells (sorry if they're a bit hard to see).

Game output
RenderDoc's output

As you can see, the game output is showing all of the shell's at their origin, as if the instanced vertex array's contents were all 0.0 . RenderDoc's output is actually correct, showing each tank shell at its proper position.

So like, what the hell. How do I even begin to understand what's going on here?I'm not even sure how those images could ever be different.

None

Advertisement

Plausibly, something is processed more correctly if RenderDoc is used, resulting in better output. It can be a side effect of a “debug” build or an interference from RenderDoc itself.

I'd try to log as much geometry data as possible (maybe with a simplified tank model: a tetrahedron for the base and one for the turret would have only 8 vertices and 12 edges) to find the place where the two executions of the “same” rendering code diverge and to test that geometry data according to RenderDoc agrees with your logs.

Omae Wa Mou Shindeiru

@LorenzoGatti I ended up resolving the issue. The first argument to the glBufferSubData call (as well as the glBindBuffer before it) was GL_VERTEX_ARRAY, instead of GL_ARRAY_BUFFER. Just a stupid mistake,

This still doesn't explain how RenderDoc was still showing the correct output, and I just wish OpenGL would actually crash or explicitly error out or something when I make an obvious programming error like that considering that accidental OpenGL misuse is the primary source of my graphics programming issues. GL_VERTEX_ARRAY isn't even a valid input to either of those functions!

None

https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBufferSubData.xhtml

This is supposed to cause a GL_INVALID_ENUM error, and both RenderDoc and your driver should be setting that error.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement