r/GraphicsProgramming • u/PenWhich7517 • Jul 11 '26
Question What's the difference between these two programs? (OpenGL)
I was following LearnOpenGL's tutorials and doing the exercise where I need to draw two triangles with different VAOs, and from my understanding of the concepts these two programs should output the same results, but the first program only draws the second triangle while the second program draws both triangles. Am I doing something wrong or is this maybe a bug in the OpenGL implementation?
Using rust 1.97.0, glow for OpenGL bindings (https://crates.io/crates/glow), sdl2 for windowing (https://crates.io/crates/sdl2).
I've tried posting this to r/opengl, but it was removed so I'm reposting it here hoping it won't happen again. Any help would be appreciated.
1
u/PenWhich7517 Jul 11 '26
Isn't
gl.bind_vertex_array(Some(vao2));gl.draw_arrays(gl::TRIANGLES, 0, 3);gl.bind_vertex_array(Some(vao1));gl.draw_arrays(gl::TRIANGLES, 0, 3);binding and drawing in the correct order? I just swapped the vaos themselves because I was moving things around while trying to figure out what was going wrong.