OpenGL compute shaders: Are VAOs and IBOs the same as graphics shaders?

So I haven’t made an actual compute shader. I want to get the physical geometry of an animation. So this is the code that I have written to load the positions and bone information.


#pragma once
#include "animvert.h"
#include "GL/glew.h"
#include <vector>
struct compVert {
	float pos[4];	
	float weights[4];
	float boneIDs[4];
using namespace std;
class ComputeMesh
	void draw();
	void loadverts(vector<AnimVertex> verts);
	void loadinds(vector<GLuint> inds);
	void init();
	unsigned int totinds;
	unsigned int vertcnt;
	GLuint vao, vbo, ibo;
	vector<GLuint> inds;
	vector<compVert> verts;
#include "ComputeMesh.h"

	glDeleteVertexArrays(1, &vao);
	glDeleteBuffers(1, &vbo);
	glDeleteBuffers(1, &ibo);

void ComputeMesh::draw()
	glDrawElements(GL_TRIANGLES, inds.size(), GL_UNSIGNED_INT, 0);

void ComputeMesh::loadverts(vector<AnimVertex> iverts)
	compVert vert;
	for (int i = 0; i < iverts.size(); i++) {
		for (int j = 0; j < 4; j++) {
			vert.pos[j] = j < 3 ?[j] : 1;
			vert.weights[j] =[j];
			vert.boneIDs[j] =[j];
	vertcnt += iverts.size();

void ComputeMesh::loadinds(vector<GLuint> iinds)
	for (int i = 0; i < iinds.size(); i++) inds.push_back( + vertcnt);
	totinds = inds.size();

void ComputeMesh::init()
	glGenVertexArrays(1, &vao);
	glGenBuffers(1, &vbo);
	glGenBuffers(1, &ibo);

	glBindBuffer(GL_ARRAY_BUFFER, vbo);
	glBufferData(GL_ARRAY_BUFFER, sizeof(compVert) * verts.size(), &verts[0], GL_STATIC_DRAW);

	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, inds.size() * sizeof(GLuint), &inds[0], GL_STATIC_DRAW);

	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 48, (GLvoid*)0); 
	glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 48, (GLvoid*)(4 * sizeof(GLfloat))); 
	glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 48, (GLvoid*)(4 * sizeof(GLfloat))); 

	glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, vbo);

I changed the subject of your thread to make it clear that you were actually asking a question, and what that question might be. Going forward, please ask the question in the message body as well, use punctuation (e.g. ? / . / etc.) so the meaning of your text is clear, and provide more background on your problem (English text, not just code).

In OpenGL, there is only Buffer object, a GPU-accessible block of storage. It’s the same buffer object used across all different types of shaders.

In OpenGL, there are many different bind targets to which you can bind a buffer object. This tells OpenGL what to do with it. It doesn’t make it a different type of object somehow.

One of these many binding points is GL_ELEMENT_ARRAY_BUFFER. This is where you’d bind a portion of a buffer object for OpenGL to pull data for indexed draw calls (e.g. glDrawElements()) from. Some people refer to a buffer object bound to this binding location an IBO (Index Buffer Object). It’s common but confusing, as nothing fundamentally changes with the actual “buffer object”. It’s just how you’re choosing to use it. Moreover, this GL_ELEMENT_ARRAY_BUFFER binding target is used by draw calls (to feed graphics shaders), so it specifically has nothing to do with compute shaders.

Vertex Array Objects (VAOs) are a totally different animal. They’re used to help setup vertex attribute and index list bindings for draw calls. So these too have nothing to do with compute shaders.

So none of the terms you explicitly asked about (IBO, VAO) are shared between graphics shaders and compute shaders.

On the other hand, the underlying Buffer objects referenced by these can be shared between graphics and compute shaders.