000-hellotriangle

command
v0.0.0-...-63defff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 10 Imported by: 0

README

Hello triangle

VBOs

Vertex attributes are views into the VBO, which may be much larger than the data that is interesting to the renderer.

glVertexAttribPointer behaviour

This function is quite counter intuitive, even when one has a good grasp on pointers, structs and offsets.

glVertexAttribPointer explanation

TODO: I still don't understand why the heck I'm calling

gl.VertexAttribPointerWithOffset(vertAttrib, 2, gl.FLOAT, false, 2*attrSize, 0)

With size=2... Why? My best guess is that each "vertex" is composed of two gl.FLOAT's, so the size of the vertex is 2? This may be related to the DrawArrays call which takes a count parameter. Which is 3:

// Inside render loop...
gl.DrawArrays(gl.TRIANGLES, 0, 3)

So maybe DrawArrays iterates over the array with the following loop condition(?):

iLimit := size*count

for i:=first; i < iLimit; i++ {
    offset := i*stride + first
    // ...
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL