From 77901bb05dbf75e92dd8974ccb23053bb3b2dabf Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 16 Mar 2022 20:54:19 +0100 Subject: Add docstrings --- graphics.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'graphics.go') diff --git a/graphics.go b/graphics.go index a952e40..6c93204 100644 --- a/graphics.go +++ b/graphics.go @@ -59,6 +59,7 @@ void main() { ` + "\x00" ) +// Graphics is a struct to save OpenGL-related data like shaders. type Graphics struct { version string vao uint32 @@ -69,6 +70,7 @@ type Graphics struct { trafoUniform int32 } +// newGraphics initializes a new Graphics struct and returns it. func newGraphics() Graphics { var graphics Graphics = Graphics{} @@ -111,6 +113,7 @@ func newGraphics() Graphics { return graphics } +// draw executes the rendering process for a Graphics struct one time. func (graphics Graphics) draw() { gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) gl.UseProgram(graphics.program) @@ -162,6 +165,7 @@ func makeVao(points []float32, normals []float32) uint32 { return vao } +// compileShaders compiles the shader from source code. func compileShader(source string, shaderType uint32) (uint32, error) { log.Println("Compiling shader") @@ -187,6 +191,7 @@ func compileShader(source string, shaderType uint32) (uint32, error) { return shader, nil } +// setTrafo sets the current transformation matrix of the given Graphics struct. func (graphics *Graphics) setTrafo(trafo mgl32.Mat4) { graphics.trafo = trafo } -- cgit v1.2.3-70-g09d2