I have multiple objects, each one of them has its own index buffer, vertex buffer, some have a different shader or texture, and all of them have the same vertex format (x, y, z, u, v, nx, ny, nz). I don't want to batch my objects together, but render them in separate draw calls. Lets say that I want to render 5 different objects (cubes, spheres, etc.), do I have to create a new vao for each one of them, or is there a way to tell OpenGL that I want to render 5 different buffers with the same layout/format?
Draw multiple buffers with the same vertex layout
724 Views Asked by Dave F. At
1
There are 1 best solutions below
Related Questions in OPENGL
- How to fix "Access violation executing location" when using GLFW and GLAD
- getting Access violation writing location when calling glDrawElements caused by shader
- Experimenting with GLFW library: window boundary problem and normalized coordinates
- OpenGL Framebuffer/FBO RTT subpixel movement discrepancy
- Why isn't my glfw window showing anything?
- How can glPushMatrix affect the rotation of an object around a rotating object?
- g++ / vscode apparently cannot see my src folder? "cc1plus.exe: fatal error: src/glad.c No such file or directory"
- Does addition-assignment cause dependency chain in GLSL?
- Compiling C++ program with Opengl and Glut in windows
- Using Silk.NET in WinForms
- What happens when rendering an OpenGL buffer that has been padded with NULL (or another value)?
- How can I make a sphere follow an eight-like path in Python using OpenGL?
- OpenGL only rendering second triangle, first triangle not visible
- OpenGL shows black texture on quad
- My Visual Studio 2022 consistently gives me errors saying that the GLchar variable type is undefined
Related Questions in VERTEX-BUFFER
- How can I properly manage data in modern OpenGL while considering performance?
- Create struct for vertex buffer on DX9
- JOGL - updating vertex coordinates - glMapBuffer always returns null
- Interpolate data buffers using OpenGL?
- Code Assist, OpenGL VAO/VBO Classes not drawing
- OpenGL: problem with vertex indices buffer
- Vertex Buffer Objects Open GL
- DirectX: Small distortion between 2 sprite polygons
- OpenGL: Why these codes draws nothing, with interleaved VBO and GLSL
- Allocating vertex buffer object
- OpenGL changing vertex position
- Ways of drawing vertex ranges in Direct3D
- OpenGL Draw Multiple Vertex Arrays
- When drawing multiple objects, when do you create a new vertex array object?
- Should a new VertexBuffer3D & IndexBuffer3D be created for each Program3D used?
Related Questions in VERTEX-ARRAY-OBJECT
- Moderngl: Render VAO with multiple shaders
- Why is my code not displaying on phone emulator with vertex array object in opengl
- How to refactor code from Vertex Array to Vertex Array Object methods
- Why should I bind the index buffer to draw elements with a VAO?
- Draw multiple buffers with the same vertex layout
- Can I glDeleteBuffer a VBO and IBO after binding to a VAO?
- GL_POLYGONS does not work how do i get my function to work
- update vertices and indices in OPENGL
- Why do I get an 'invalid operation error' when I use glGenVertexArrays() in PyOpenGL eventhough I am creating an OpenGL 4.1 context?
- Using multiple VBO in a VAO
- Error when calling GL30.glGenVertexArrays();
- When drawing multiple objects, when do you create a new vertex array object?
- OpenGL Draw Multiple Vertex Arrays
- OpenGL can't update vertex buffer with VAO procedure
- OpenGL program doesn't show a triangle
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You don't need to tell OpenGL this; you simply modify the VAO and change the buffers without changing the vertex format.
Now granted, you can't do that without providing the vertex format parameters to
glVertexAttribPointer. So at the very least, you have to remember what those parameters still are.Fortunately, separate attribute format exists (in GL 4.3+), which allows you to change the buffer bindings (which are still stored in a VAO) separately from the functions that change the vertex format. So you should just be able to call
glBindVertexBufferandglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ...)to change the buffers.