document AbstractBasicShaderProgram

Sat, 07 Mar 2020 01:25:37 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 07 Mar 2020 01:25:37 +0200
changeset 75
204dc77e5654
parent 74
6b51e7b7c459
child 76
7c4a63a02632

document AbstractBasicShaderProgram

src/gl/basicshaderprogram.h file | annotate | diff | comparison | revisions
--- a/src/gl/basicshaderprogram.h	Sat Mar 07 01:20:36 2020 +0200
+++ b/src/gl/basicshaderprogram.h	Sat Mar 07 01:25:37 2020 +0200
@@ -1,6 +1,13 @@
 #pragma once
 #include "common.h"
 
+/**
+ * @brief Base class for basic shader programs
+ *
+ * A basic program is a collection of a single VAO with a single VBO,
+ * a vertex shader and a fragment shader. This program deals with these
+ * components, leaving the program-specific details to the subclasses.
+ */
 class AbstractBasicShaderProgram : public QObject, protected QOpenGLFunctions
 {
 	Q_OBJECT
@@ -16,12 +23,19 @@
 protected:
 	void setMatrix(const char* name, const glm::mat4& matrix);
 	void checkForGLErrors();
+	/// \returns the source code of the vertex shader
 	virtual const char* vertexShaderSource() const = 0;
+	/// \returns the source code of the fragment shader
 	virtual const char* fragmentShaderSource() const = 0;
+	/// \returns the vertex data for the VBO
 	virtual const void* vertexData() const = 0;
+	/// \returns the size of a single vertex in bytes
 	virtual int vertexSize() const = 0;
+	/// \returns the amount of vertices in the data
 	virtual int vertexCount() const = 0;
+	/// Called during initialization to set up the VAO. Set up your vertex array attributes here.
 	virtual void setupVertexArrays() = 0;
+	// \returns what kind of elements are drawn (GL_QUADS, GL_TRIANGLES, GL_LINES, etc)
 	virtual GLenum drawMode() const = 0;
 	bool isInitialized = false;
 	QOpenGLBuffer buffer;

mercurial