These are chat archives for opentk/opentk

29th
Apr 2018
chatbridge
@chatbridge
Apr 29 09:37
(Discord) SourceSkyBoxer: And why does Neo Kabuto make happy for OpenTK but for me nothing why does it happen with wavefront 😦
Bobitsmagic
@Bobitsmagic
Apr 29 20:01
Hi
chatbridge
@chatbridge
Apr 29 20:02
(Discord) Jax (Nihlus): Heya
Bobitsmagic
@Bobitsmagic
Apr 29 20:03
how can i start a drawcall from a specific vertex or index of the given buffer?
so i have bound a vertexbuffer and a indexbuffer and want for example draw the first half of the vertices and then change the texture and draw the second half
chatbridge
@chatbridge
Apr 29 20:07
(Discord) winterhell: You'll have to do 2 draw calls
(Discord) winterhell: For example
GL.DrawElements<short>(PrimitiveType.Triangles, count, DrawElementsType.UnsignedShort, indices);
Bobitsmagic
@Bobitsmagic
Apr 29 20:20
but how do i say where to start with the drawing?
so how do i say on wich vertex it should start the next drawcall? or will it continue where it stoped the last drawcall?
(Discord) winterhell: DrawRangeElements then
(Discord) winterhell: you can specify a starting index on that one
(Discord) winterhell: You do one Draw call with the first half of the vertices, then you change the texture, then you do a Draw call with the second half
Bobitsmagic
@Bobitsmagic
Apr 29 20:25
thanks
chatbridge
@chatbridge
Apr 29 20:25
(Discord) winterhell: You're welcome. Hope it help
Bobitsmagic
@Bobitsmagic
Apr 29 20:52

int start = 0;
for(int i = 0; i < SortedBlocks.Count; i++)
{
TextureManager.SetBlockTexture(Textures[i]);

GL.DrawElements(
    PrimitiveType.Quads, start + SortedBlocks[i].Count * 4,
    DrawElementsType.UnsignedShort,
    IntPtr.Zero);

start += SortedBlocks[i].Count * 4;

}

this is my code now and it works but i dont understand why because i add the start to the count parameter and that should make no sense but it works like this pretty well