From 8917a09da96105a56b1fd710eb7aeeddf1a92398 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Wed, 25 Jan 2017 18:25:37 +0100
Subject: [PATCH] improve docs in pixelgl

---
 pixelgl/attr.go    |  2 +-
 pixelgl/orphan.go  |  7 ++++---
 pixelgl/shader.go  | 12 ++++++------
 pixelgl/texture.go | 10 +++++-----
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/pixelgl/attr.go b/pixelgl/attr.go
index 3112ab4..7f78d23 100644
--- a/pixelgl/attr.go
+++ b/pixelgl/attr.go
@@ -6,7 +6,7 @@ package pixelgl
 //   AttrFormat{{"position", Vec2}, {"color", Vec4}, {"texCoord": Vec2}}
 type AttrFormat []Attr
 
-// Size returns the total size of all attributes of an attribute format.
+// Size returns the total size of all attributes of the AttrFormat.
 func (af AttrFormat) Size() int {
 	total := 0
 	for _, attr := range af {
diff --git a/pixelgl/orphan.go b/pixelgl/orphan.go
index 24f784a..eba99bc 100644
--- a/pixelgl/orphan.go
+++ b/pixelgl/orphan.go
@@ -2,11 +2,12 @@ package pixelgl
 
 import "github.com/go-gl/gl/v3.3-core/gl"
 
-// Init initializes OpenGL by loading the function pointers from the active OpenGL context.
-// This function must be manually run inside the main thread (Do, DoErr, DoVal, etc.).
+// Init initializes OpenGL by loading function pointers from the active OpenGL context.
+// This function must be manually run inside the main thread (using "github.com/faiface/mainthread"
+// package).
 //
 // It must be called under the presence of an active OpenGL context, e.g., always after calling
-// window.MakeContextCurrent().  Also, always call this function when switching contexts.
+// window.MakeContextCurrent(). Also, always call this function when switching contexts.
 func Init() {
 	err := gl.Init()
 	if err != nil {
diff --git a/pixelgl/shader.go b/pixelgl/shader.go
index 9bf074c..81f8218 100644
--- a/pixelgl/shader.go
+++ b/pixelgl/shader.go
@@ -119,17 +119,17 @@ func (s *Shader) delete() {
 	})
 }
 
-// VertexFormat returns the vertex attribute format of this shader. Do not change it.
+// VertexFormat returns the vertex attribute format of this Shader. Do not change it.
 func (s *Shader) VertexFormat() AttrFormat {
 	return s.vertexFmt
 }
 
-// UniformFormat returns the uniform attribute format of this shader. Do not change it.
+// UniformFormat returns the uniform attribute format of this Shader. Do not change it.
 func (s *Shader) UniformFormat() AttrFormat {
 	return s.uniformFmt
 }
 
-// SetUniformAttr sets the value of a uniform attribute of a shader. The attribute is
+// SetUniformAttr sets the value of a uniform attribute of this Shader. The attribute is
 // specified by the index in the Shader's uniform format.
 //
 // If the uniform attribute does not exist in the Shader, this method returns false.
@@ -152,7 +152,7 @@ func (s *Shader) UniformFormat() AttrFormat {
 //   Attr{Type: Mat43}: mgl32.Mat4x3
 // No other types are supported.
 //
-// The shader must be bound before calling this method.
+// The Shader must be bound before calling this method.
 func (s *Shader) SetUniformAttr(uniform int, value interface{}) (ok bool) {
 	if s.uniformLoc[uniform] < 0 {
 		return false
@@ -208,12 +208,12 @@ func (s *Shader) SetUniformAttr(uniform int, value interface{}) (ok bool) {
 	return true
 }
 
-// Begin binds a shader program. This is necessary before using the shader.
+// Begin binds the Shader program. This is necessary before using the Shader.
 func (s *Shader) Begin() {
 	s.program.bind()
 }
 
-// End unbinds a shader program and restores the previous one.
+// End unbinds the Shader program and restores the previous one.
 func (s *Shader) End() {
 	s.program.restore()
 }
diff --git a/pixelgl/texture.go b/pixelgl/texture.go
index ec4ea7e..eba9fef 100644
--- a/pixelgl/texture.go
+++ b/pixelgl/texture.go
@@ -15,7 +15,7 @@ type Texture struct {
 }
 
 // NewTexture creates a new texture with the specified width and height with some initial
-// pixel values. The pixels must be a sequence of RGBA values.
+// pixel values. The pixels must be a sequence of RGBA values (one byte per component).
 func NewTexture(width, height int, smooth bool, pixels []uint8) *Texture {
 	tex := &Texture{
 		tex: binder{
@@ -70,12 +70,12 @@ func (t *Texture) delete() {
 	})
 }
 
-// Width returns the width of a texture in pixels.
+// Width returns the width of the Texture in pixels.
 func (t *Texture) Width() int {
 	return t.width
 }
 
-// Height returns the height of a texture in pixels.
+// Height returns the height of the Texture in pixels.
 func (t *Texture) Height() int {
 	return t.height
 }
@@ -117,12 +117,12 @@ func (t *Texture) Pixels(x, y, w, h int) []uint8 {
 	return subPixels
 }
 
-// Begin binds a texture. This is necessary before using the texture.
+// Begin binds the Texture. This is necessary before using the Texture.
 func (t *Texture) Begin() {
 	t.tex.bind()
 }
 
-// End unbinds a texture and restores the previous one.
+// End unbinds the Texture and restores the previous one.
 func (t *Texture) End() {
 	t.tex.restore()
 }
-- 
GitLab