Need a little help with instanced element arrays

I’ll start with my output since that has the list of opengl calls made & with what contents since peops seem to want that more often than not.

make test
...
cd ../../../bin && ./tryextra._x86_64_linux_cc_debug.elf -D APP_DATA=../run
Opened module './libvfxglfw._x86_64_linux_cc_debug.so'
Opened module './libvfxgl._x86_64_linux_cc_debug.so'
~/src/libvfxgl/opengl_vfxapp.c:   43: app->ref = glCreateProgram();
Creating program 'flat'
Generating shader 'point' with path '../run/shaders/spec.glsl':
~/src/libvfxgl/opengl_shader.c:   95: glCreateShader( GL_VERTEX_SHADER );
~/src/libvfxgl/opengl_shader.c:  106: glShaderSource( 2, 1, [0x56211be6c880], (nil) );
~/src/libvfxgl/opengl_shader.c:  113: glCompileShader( 2 );
~/src/libvfxgl/opengl_shader.c:  114: glGetShaderiv( 2, GL_COMPILE_STATUS, 0x7ffe610e8f60 );
~/src/libvfxgl/opengl_vfxapp.c:   53: glAttachShader( 1, 2 );
Success
Generating shader 'color' with path '../run/shaders/frag.glsl':
~/src/libvfxgl/opengl_shader.c:   95: glCreateShader( GL_FRAGMENT_SHADER );
~/src/libvfxgl/opengl_shader.c:  106: glShaderSource( 3, 1, [0x56211c3ef6a0], (nil) );
~/src/libvfxgl/opengl_shader.c:  113: glCompileShader( 3 );
~/src/libvfxgl/opengl_shader.c:  114: glGetShaderiv( 3, GL_COMPILE_STATUS, 0x7ffe610e8f60 );
~/src/libvfxgl/opengl_vfxapp.c:   53: glAttachShader( 1, 3 );
Success
Linking program...
~/src/libvfxgl/opengl_vfxapp.c:   72: glLinkProgram( 1 );
~/src/libvfxgl/opengl_vfxapp.c:   73: glGetProgramiv( 1, GL_LINK_STATUS, 0x7ffe610e910c );
Success
Testing program...
~/src/libvfxgl/opengl_vfxapp.c:   88: glValidateProgram( 1 );
~/src/libvfxgl/opengl_vfxapp.c:   89: glGetProgramiv( 1, GL_VALIDATE_STATUS, 0x7ffe610e910c );
Success
~/src/libvfxgl/opengl_vfxapp.c:  136: glUseProgram( 1 );
==============================================[0] '(null)' ?, name count = 1
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxcfg.c:   24: glGenVertexArrays( 1, &ref );
~/src/libvfxgl/opengl_vfxcfg.c:    6: glBindVertexArray( 1 );
~/src/libvfxgl/opengl_vfxbuf.c:   90: glBindBuffer( GL_ARRAY_BUFFER, 1 );
~/src/libvfxgl/opengl_vfxbuf.c:   93: glBufferData( GL_ARRAY_BUFFER, 112, 0x56211c3c1650, GL_STATIC_DRAW );
> [0][0] 'NulPoint' uint
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:   24: var->loc = (GLint)glGetAttribLocation( 1, 'NulPoint' );
~/src/libvfxgl/opengl_vfxcfg.c:    6: glBindVertexArray( 1 );
~/src/libvfxgl/opengl_vfxbuf.c:   90: glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 2 );
~/src/libvfxgl/opengl_vfxbuf.c:   93: glBufferData( GL_ELEMENT_ARRAY_BUFFER, 28, 0x56211c3f0300, GL_STATIC_DRAW );
~/src/libvfxgl/opengl_vfxcfg.c:    6: glBindVertexArray( 1 );
~/src/libvfxgl/opengl_vfxbuf.c:   62: glVertexArrayElementBuffer( 1, 2 );
~/src/libvfxgl/opengl_vfxvar.c:  254: glVertexAttribPointer( 0, 1, GL_UNSIGNED_INT, GL_FALSE, 4, (nil) );
==============================================[1] 'UINTS' ?, name count = 2
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:   32: var->loc = (GLint)glGetUniformBlockIndex( 1, 'UINTS' );
~/src/libvfxgl/opengl_vfxbuf.c:   90: glBindBuffer( GL_UNIFORM_BUFFER, 3 );
~/src/libvfxgl/opengl_vfxbuf.c:   93: glBufferData( GL_UNIFORM_BUFFER, 12, 0x56211c3cdd70, GL_DYNAMIC_DRAW );
> [1][0] 'VtxCount' uint
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 3 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 0, 4, 0x56211c3cb740 );
> [1][1] 'FlatLine' uint
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 3 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 4, 4, 0x56211c3f51a4 );
==============================================[2] 'DINTS' ?, name count = 2
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:   32: var->loc = (GLint)glGetUniformBlockIndex( 1, 'DINTS' );
~/src/libvfxgl/opengl_vfxbuf.c:   90: glBindBuffer( GL_UNIFORM_BUFFER, 6 );
~/src/libvfxgl/opengl_vfxbuf.c:   93: glBufferData( GL_UNIFORM_BUFFER, 24, 0x56211c3f78b0, GL_DYNAMIC_DRAW );
> [2][0] 'WinPoint' ivec2
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 6 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 0, 8, 0x56211c3f1000 );
> [2][1] 'WinSpace' ivec3
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 6 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 4, 12, 0x56211c3cc7c4 );
==============================================[3] 'FNUMS' ?, name count = 5
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:   32: var->loc = (GLint)glGetUniformBlockIndex( 1, 'FNUMS' );
~/src/libvfxgl/opengl_vfxbuf.c:   90: glBindBuffer( GL_UNIFORM_BUFFER, 9 );
~/src/libvfxgl/opengl_vfxbuf.c:   93: glBufferData( GL_UNIFORM_BUFFER, 64, 0x56211c3d79b0, GL_DYNAMIC_DRAW );
> [3][0] 'WinScale' vec3
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 9 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 0, 12, 0x56211c3f41b0 );
> [3][1] 'RegScale' vec3
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 9 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 4, 12, 0x56211c3c45c4 );
> [3][2] 'RegPoint' vec3
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 9 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 8, 12, 0x56211c3ce278 );
> [3][3] 'RegEmits' vec3
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 9 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 12, 12, 0x56211c3e8ddc );
> [3][4] 'RegTakes' vec3
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 9 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 16, 12, 0x56211c3f3900 );
==============================================[4] 'DNUMS' ?, name count = 1
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:   32: var->loc = (GLint)glGetUniformBlockIndex( 1, 'DNUMS' );
~/src/libvfxgl/opengl_vfxbuf.c:   90: glBindBuffer( GL_UNIFORM_BUFFER, 15 );
~/src/libvfxgl/opengl_vfxbuf.c:   93: glBufferData( GL_UNIFORM_BUFFER, 16, 0x56211c3f6bb0, GL_DYNAMIC_DRAW );
> [4][0] 'dunused' double
~/src/libvfxgl/opengl_vfxbuf.c:   27: glGenBuffers( 1, &ref );
~/src/libvfxgl/opengl_vfxvar.c:  489: glBindBuffer( GL_UNIFORM_BUFFER, 15 );
~/src/libvfxgl/opengl_vfxvar.c:  492: glBufferSubData( GL_UNIFORM_BUFFER, 0, 8, 0x56211c3f02b0 );
==================Entering draw loop=====================
~/src/libvfxgl/opengl_vfxapp.c:  136: glUseProgram( 1 );
>	Enabling VfxVar 'NulPoint', takes 1, def->count = 0
~/src/libvfxgl/opengl_vfxvar.c:   80: glEnableVertexArrayAttrib(  1, 0  );
~/src/libvfxgl/opengl_vfxcfg.c:    6: glBindVertexArray( 1 );
~/src/libvfxgl/opengl_vfxbuf.c:   43: glBindBuffer( GL_ARRAY_BUFFER, 1 );
~/src/libvfxgl/opengl_vfxbuf.c:   62: glVertexArrayElementBuffer( 1, 2 );
~/src/libvfxgl/opengl_vfxbuf.c:  116: glDrawElementsInstanced( GL_TRIANGLE_STRIP, 7, GL_ELEMENT_ARRAY_BUFFER, 0x56211c3f0300, 4 );
~/src/tryextra/debug.c:   90:
source = GL_DEBUG_SOURCE_API, defect = GL_DEBUG_TYPE_ERROR, weight = GL_DEBUG_SEVERITY_HIGH, fromid = 2 (GL_ID_UNKOWN)
report = GL_INVALID_ENUM in glDrawElementsInstanced
make: *** [../../../gnu.mak:40: test] Interrupt
Compilation failed.

As you can see by the last few lines I’ve setup my debugging function to abort/break on the 1st error encountered, this was just to keep me sane when searching through the log, not even sure I’m using the uniforms right but I’ll get back to that when I can safely run & close the app without it aborting/breaking.

I’m sure you’ve noticed before getting to this statement but I seem to be using glDrawElementsInstanced wrong, using the above output could someone give an example of how they would expect the call/s to look when sending the draw command

The third argument to glDrawElementsInstanced is the type of the indices and must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT. GL_ELEMENT_ARRAY_BUFFER isn’t valid for that parameter.

Link to online reference page.

Thank you, I’ll give that an edit now

Edit: yep that put an end to that issue, just trying to fix a segfault when closing the app before I move onto my lack of anything on screen

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.