I am currently trying to port old code to OpenGL-4.4 core profile. The main reason is I would like to use new features such as SSBOs and some drivers don’t offer a compact profile for OpenGL 4.x (mainly Intel mesa).
The old code did (I think) pretty much what I wanted. Since the per-vertex data changes each draw, it simply streamed down that data from user managed memory each glDrawArrays call.
The code works well with compat profile, but as soon as I request a core profile context nothing is drawn.
I have to admit, I really struggle finding the issue:
/* Initialization */ // Create persistently mapped SSBO for Fragment shader glGenBuffers( 1, &maskBuffer ); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, maskBuffer); glBindBuffer( GL_SHADER_STORAGE_BUFFER, maskBuffer ); //Create an immutable data store for the buffer size_t bufferSize( MASK_WIDTH * MASK_HEIGHT * 4 ); GLbitfield flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT; glBufferStorage( GL_SHADER_STORAGE_BUFFER, bufferSize, 0, flags); maskBufferData = (uint8_t*) glMapBufferRange( GL_SHADER_STORAGE_BUFFER, 0, bufferSize, flags ); // configure vertex attrib arrays, stream directly from user managed memory each draw() call glEnableVertexAttribArray(0); vertices = (GLfloat*) malloc(sizeof(GLfloat) * 2 * 32); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertices); attrs = (GLfloat*) malloc(sizeof(GLfloat) * 3 * 32); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, attrs); /* Rendering */ // Write vertices etc glDrawArrays(GL_QUADS, 0, 32);
Any ideas why nothing is rendered?
Thank you in advance.