Hello I dont know why but I seem to be
Hello I dont know why but I seem to be unable to use gl.DrawElements and ebo I'm surelly missing something. Il make a thread to post my code and render doc result
27 Replies
Also when I use (void*)0 instead of UIntPtr.Zero in DrawElement it throw this: System.ExecutionEngineException
When using DrawArray
When using DrawElement
Really weird that it won't work. I must be missing some little simple thing.
You are creating your vertex array after you create the buffers. This means that your
BindBuffer
calls are not being bound to the vertex array and are instead being bound to the “null” vertex array. Create and bind your vertex array before you create the buffers and see how it goes
I’m slightly surprised that DrawArray works at all eitherMe too
that was thowing me off XD
You should also be using
(void*) 0
instead of uintptr, as I believe silk will try and interpret that as a value and it won’t work
I may be misremembering but I believe that is the caseYeah if I use (void*) 0 with DrawElement it throw but with UIntPtr.Zero it just do not draw🙃
Yeah, the throwing behaviour is normal when somethings incorrect
Seems better than it used to be tho, when I was first implementing silk on Linux it crashed my entire driver several times lol
So you said:
Gen and bind the vertexArray,
Gend, bind and send vertBuffer and
gen, bind and send indexBuffer.
Right? it wont work
using the (void*) 0 too
Another issue I can see is that you are enabling the vertex attrib array after setting its pointer, I don’t know for sure but I’ve never seen it done in that order so I wouldn’t be surprised if it’s not working
So gen bind enable and Set pointer? It wont work either
Is this your entire code?
yes
Ah. You haven’t created a shader of any kind, you’ll need that to draw anything
But if I use DrawArrays it work and I have a black triangle🙃
Il add a shader to see if it help in any way
Yeah that’s very… odd… behaviour, definitely not spec compliant that’s for sure
I can recommend you follow the silk tutorials if you aren’t already, they go through everything in detail!
https://dotnet.github.io/Silk.NET/docs/opengl/c1/2-hello-quad.html
Silk.NET - High-Speed & Advanced .NET Graphics & Compute
1.2 - Hello Quad
Omg yes I follow it a while ago. I want thinking there was no use of Ebo. I'll do that real quick
Don’t worry there’s full use of everything to draw a quad including element buffers and shaders!
Thanks for pointing me the obvious 😅 The tutorial code work. I started my project so long ago that I was thinking I did the basic stuff right🙃
Haha no worries it happens
Sometime it so simple and obvious that you don't think of it 🤣
Don’t worry about it, graphics programming is just like that sometimes lol
Yeah it pretty hard sometime XD. It kinda work in my engine now 🙂 My abstraction was making thing out of order😅 Little question should I not be able to create the vbo and vbo prior to creating the vao and just rebinding the vbo and vbo after the vao?
Ex:
Yep you can do that as well. As long as you bind them after the vertex array has been created, it doesn’t matter when you create the buffers. Just be aware that if you create buffers before binding them to a VAO, you should always call
BindVertexArray(0)
before creating them as otherwise you risk overwriting a previously bound vertex array.Thanks