> On May 1, 2018, at 4:10 PM, Mattias Gaertner <nc-gaert...@netcologne.de> 
> wrote:
> 
> In pas2js it will probably look similar to this:
> 
> var vertices: array of glfloat = (-0.5, 0.5, -0.5, -0.5, 0.0, -0.5);
> var vertex_buffer: TInsertNameHere;
> begin
>  // Create a new buffer object
>  vertex_buffer = gl.createBuffer();
> 
>  // Bind an empty array buffer to it
>  gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);
> 
>  // Pass the vertices data to the buffer
>  gl.bufferData(gl.ARRAY_BUFFER, Float32Array.new(vertices), gl.STATIC_DRAW);
> 
>  // Unbind the buffer
>  gl.bindBuffer(gl.ARRAY_BUFFER, nil);
> end;
> 

Strange they renamed glGenBuffers to createBuffer().

That aside though not having records is a problem I imagine. They don’t exist 
in JS right, so how do they deal with that? I guess you could pack a record 
into an array literal if all the types were the same. Arrays of arrays in 
literals works also.

can’t we do that? We’re at the mercy of Float32Array.new packing that though or 
we need another method. What a waste of processing to convert that. That would 
be a nightmare for real applications to iterate all the verticies like that 
every time they were copied to the GPU.

verts: array[0..2] of TVec2f; // var arr = [[0,0],[0,0],[0,0]]



Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to