Added documentation
This commit is contained in:
parent
0a7a835bcc
commit
da26e0391f
12 changed files with 930 additions and 79 deletions
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(openglu)
|
project(OpenGLUtility)
|
||||||
|
|
||||||
set(build_examples ON CACHE BOOL "Build examples")
|
set(build_examples ON CACHE BOOL "Build examples")
|
||||||
set(build_documentation ON CACHE BOOL "Generate documentation")
|
set(build_documentation ON CACHE BOOL "Generate documentation")
|
||||||
|
@ -43,8 +43,8 @@ target_include_directories(openglu PUBLIC
|
||||||
if(${build_documentation})
|
if(${build_documentation})
|
||||||
configure_file(doxyfile.in ${CMAKE_BINARY_DIR}/doxyfile @ONLY)
|
configure_file(doxyfile.in ${CMAKE_BINARY_DIR}/doxyfile @ONLY)
|
||||||
add_custom_target(openglu_doc ALL
|
add_custom_target(openglu_doc ALL
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_SOURCE_DIR}/doxyfile.in"
|
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_BINARY_DIR}/doxyfile"
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
COMMENT "Building documentation..."
|
COMMENT "Building documentation..."
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = "OpenGL Utility"
|
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
|
||||||
PROJECT_NUMBER =
|
PROJECT_NUMBER =
|
||||||
PROJECT_BRIEF =
|
PROJECT_BRIEF =
|
||||||
PROJECT_LOGO =
|
PROJECT_LOGO =
|
||||||
|
@ -29,7 +29,8 @@ ABBREVIATE_BRIEF = "The $name class" \
|
||||||
ALWAYS_DETAILED_SEC = NO
|
ALWAYS_DETAILED_SEC = NO
|
||||||
INLINE_INHERITED_MEMB = NO
|
INLINE_INHERITED_MEMB = NO
|
||||||
FULL_PATH_NAMES = YES
|
FULL_PATH_NAMES = YES
|
||||||
STRIP_FROM_PATH =
|
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ \
|
||||||
|
@PROJECT_BINARY_DIR@
|
||||||
STRIP_FROM_INC_PATH =
|
STRIP_FROM_INC_PATH =
|
||||||
SHORT_NAMES = NO
|
SHORT_NAMES = NO
|
||||||
JAVADOC_AUTOBRIEF = NO
|
JAVADOC_AUTOBRIEF = NO
|
||||||
|
@ -66,7 +67,7 @@ NUM_PROC_THREADS = 1
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = NO
|
||||||
EXTRACT_PRIVATE = NO
|
EXTRACT_PRIVATE = YES
|
||||||
EXTRACT_PRIV_VIRTUAL = NO
|
EXTRACT_PRIV_VIRTUAL = NO
|
||||||
EXTRACT_PACKAGE = NO
|
EXTRACT_PACKAGE = NO
|
||||||
EXTRACT_STATIC = NO
|
EXTRACT_STATIC = NO
|
||||||
|
@ -118,7 +119,7 @@ WARN_LOGFILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the input files
|
# Configuration options related to the input files
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
#INPUT = ../include
|
INPUT = @PROJECT_SOURCE_DIR@/include
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
FILE_PATTERNS = *.c \
|
FILE_PATTERNS = *.c \
|
||||||
*.cc \
|
*.cc \
|
||||||
|
|
|
@ -61,7 +61,7 @@ int main(int argc, char** argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make a square
|
// Make a square
|
||||||
oglu::VertexArray square = oglu::MakeObject(vertices, sizeof(vertices), indices, sizeof(indices), topology, sizeof(topology));
|
oglu::VertexArray square = oglu::MakeVertexArray(vertices, sizeof(vertices), indices, sizeof(indices), topology, sizeof(topology));
|
||||||
|
|
||||||
// Create a shader
|
// Create a shader
|
||||||
oglu::Shader shader;
|
oglu::Shader shader;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*****************************************************************//**
|
||||||
|
* @file color.hpp
|
||||||
|
* @brief Contains convenience for working with colors.
|
||||||
|
*
|
||||||
|
* @author Robert
|
||||||
|
* @date January 2021
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
#ifndef COLOR_HPP
|
#ifndef COLOR_HPP
|
||||||
#define COLOR_HPP
|
#define COLOR_HPP
|
||||||
|
|
||||||
|
@ -6,33 +14,130 @@
|
||||||
|
|
||||||
namespace oglu
|
namespace oglu
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Convenience class for storing and working with color
|
||||||
|
*/
|
||||||
class OGLU_API Color
|
class OGLU_API Color
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Constructs a transparent black
|
||||||
|
*/
|
||||||
Color();
|
Color();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new color
|
||||||
|
*
|
||||||
|
* @param red Red component
|
||||||
|
* @param blue Blue component
|
||||||
|
* @param green Green component
|
||||||
|
* @param alpha Red component
|
||||||
|
*/
|
||||||
Color(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha = 255);
|
Color(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha = 255);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLfloat r, g, b, a;
|
GLfloat r; ///< Red channel
|
||||||
|
GLfloat g; ///< Green channel
|
||||||
|
GLfloat b; ///< Blue channel
|
||||||
|
GLfloat a; ///< Alpha channel
|
||||||
|
|
||||||
static const Color Black;
|
static const Color Black; ///< Predefined Black
|
||||||
static const Color White;
|
static const Color White; ///< Predefined White
|
||||||
static const Color Red;
|
static const Color Red; ///< Predefined Red
|
||||||
static const Color Green;
|
static const Color Green; ///< Predefined Green
|
||||||
static const Color Blue;
|
static const Color Blue; ///< Predefined Blue
|
||||||
static const Color Yellow;
|
static const Color Yellow; ///< Predefined Yellow
|
||||||
static const Color Magenta;
|
static const Color Magenta; ///< Predefined Magenta
|
||||||
static const Color Cyan;
|
static const Color Cyan; ///< Predefined Cyan
|
||||||
static const Color Transparent;
|
static const Color Transparent; ///< Predefined Transparent
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Checks if two colors are equal.
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns True if every color channel is equal
|
||||||
|
*/
|
||||||
OGLU_API bool operator==(const Color& left, const Color& right);
|
OGLU_API bool operator==(const Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Checks if two colors are different.
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns True if not every color channel is equal
|
||||||
|
*/
|
||||||
OGLU_API bool operator!=(const Color& left, const Color& right);
|
OGLU_API bool operator!=(const Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Sums two colors
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns The sum of @p left and @p right. The result is clamped to the OpenGL color range.
|
||||||
|
*/
|
||||||
OGLU_API Color operator+(const Color& left, const Color& right);
|
OGLU_API Color operator+(const Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Subtracts two colors
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns The difference of @p left and @p right. The result is clamped to the OpenGL color range.
|
||||||
|
*/
|
||||||
OGLU_API Color operator-(const Color& left, const Color& right);
|
OGLU_API Color operator-(const Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Multiplies two colors component-wise
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns The componen-wise product of @p left and @p right.
|
||||||
|
*/
|
||||||
OGLU_API Color operator*(const Color& left, const Color& right);
|
OGLU_API Color operator*(const Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Sums two colors
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns Reference to @p left
|
||||||
|
*/
|
||||||
OGLU_API Color& operator+=(Color& left, const Color& right);
|
OGLU_API Color& operator+=(Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Subtracts two colors
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns Reference to @p left
|
||||||
|
*/
|
||||||
OGLU_API Color& operator-=(Color& left, const Color& right);
|
OGLU_API Color& operator-=(Color& left, const Color& right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @relates Color
|
||||||
|
* @brief Multiplies two colors component-wise
|
||||||
|
*
|
||||||
|
* @param left Left operand
|
||||||
|
* @param right Right operand
|
||||||
|
*
|
||||||
|
* @returns Reference to @p left
|
||||||
|
*/
|
||||||
OGLU_API Color& operator*=(Color& left, const Color& right);
|
OGLU_API Color& operator*=(Color& left, const Color& right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*****************************************************************//**
|
||||||
|
* \file core.hpp
|
||||||
|
* \brief Core includes and defines
|
||||||
|
*
|
||||||
|
* \author Robert
|
||||||
|
* \date January 2021
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
#ifndef CORE_HPP
|
#ifndef CORE_HPP
|
||||||
#define CORE_HPP
|
#define CORE_HPP
|
||||||
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#ifndef DRAWABLE_HPP
|
|
||||||
#define DRAWABLE_HPP
|
|
||||||
|
|
||||||
#include <core.hpp>
|
|
||||||
|
|
||||||
namespace oglu
|
|
||||||
{
|
|
||||||
typedef OGLU_API struct {
|
|
||||||
GLuint index;
|
|
||||||
GLint size;
|
|
||||||
GLenum type;
|
|
||||||
GLboolean normalized;
|
|
||||||
GLsizei stride;
|
|
||||||
const GLvoid* pointer;
|
|
||||||
} VertexAttribute;
|
|
||||||
|
|
||||||
class OGLU_API AbstractVertexArray
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AbstractVertexArray(const AbstractVertexArray& other);
|
|
||||||
~AbstractVertexArray();
|
|
||||||
|
|
||||||
friend std::shared_ptr<AbstractVertexArray> OGLU_API MakeObject(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
|
|
||||||
|
|
||||||
GLuint GetVAO() { return VAO; }
|
|
||||||
void Bind();
|
|
||||||
void Unbind();
|
|
||||||
|
|
||||||
void Draw();
|
|
||||||
void BindAndDraw();
|
|
||||||
|
|
||||||
private:
|
|
||||||
AbstractVertexArray(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
|
|
||||||
|
|
||||||
inline void RegisterVertexAttribPointer(GLuint index, const VertexAttribute& topology);
|
|
||||||
|
|
||||||
GLuint VAO, VBO, EBO;
|
|
||||||
GLsizei count;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::shared_ptr<AbstractVertexArray> VertexArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,17 +1,48 @@
|
||||||
|
/*****************************************************************//**
|
||||||
|
* @file openglu.hpp
|
||||||
|
* @brief Basic includes and some exposed OpenGL
|
||||||
|
*
|
||||||
|
* @author Lauchmelder
|
||||||
|
* @date January 2021
|
||||||
|
*********************************************************************/
|
||||||
#ifndef OPENGLU_HPP
|
#ifndef OPENGLU_HPP
|
||||||
#define OPENGLU_HPP
|
#define OPENGLU_HPP
|
||||||
|
|
||||||
#include <color.hpp>
|
#include <color.hpp>
|
||||||
#include <object.hpp>
|
#include <vertexArray.hpp>
|
||||||
#include <shader.hpp>
|
#include <shader.hpp>
|
||||||
#include <texture.hpp>
|
#include <texture.hpp>
|
||||||
|
|
||||||
namespace oglu
|
namespace oglu
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Loads the GL Loader to be used by OGLU.
|
||||||
|
*
|
||||||
|
* OpenGL function addresses can vary across platforms and drivers, so we
|
||||||
|
* need to know where these functions are in order to work properly.
|
||||||
|
*
|
||||||
|
* @param[in] proc A pointer to a function that returns the addresses of OpenGL functions
|
||||||
|
*/
|
||||||
OGLU_API void LoadGLLoader(GLADloadproc proc);
|
OGLU_API void LoadGLLoader(GLADloadproc proc);
|
||||||
|
|
||||||
// Some raw, exposed OpenGL until I know where to put then
|
/**
|
||||||
|
* @brief Wrapper of glViewport.
|
||||||
|
*
|
||||||
|
* @param[in] x Horizontal Position of the viewport
|
||||||
|
* @param[in] y Vertical Position of the viewport
|
||||||
|
* @param[in] width Width of the viewport
|
||||||
|
* @param[in] height Height of the viewport
|
||||||
|
*/
|
||||||
OGLU_API void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
OGLU_API void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Convenience function for glClear
|
||||||
|
*
|
||||||
|
* Sets the clear color and then clears the screen.
|
||||||
|
*
|
||||||
|
* @param[in] mask Buffers to be cleared
|
||||||
|
* @param[in] clearColor Color to clear the screen with
|
||||||
|
*/
|
||||||
OGLU_API void ClearScreen(GLbitfield mask, Color clearColor);
|
OGLU_API void ClearScreen(GLbitfield mask, Color clearColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*****************************************************************//**
|
||||||
|
* \file shader.hpp
|
||||||
|
* \brief Contains functions and objects relevant to shading
|
||||||
|
*
|
||||||
|
* \author Robert
|
||||||
|
* \date January 2021
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
#ifndef SHADER_HPP
|
#ifndef SHADER_HPP
|
||||||
#define SHADER_HPP
|
#define SHADER_HPP
|
||||||
|
|
||||||
|
@ -7,128 +15,689 @@ namespace oglu
|
||||||
{
|
{
|
||||||
class Color;
|
class Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief An object representing an OpenGL Shader Program.
|
||||||
|
*
|
||||||
|
* This class contains the OpenGL Shader Program and supplies the user
|
||||||
|
* with functions to operate on this program.
|
||||||
|
*
|
||||||
|
* This class cannot be instantiated, this should be done via MakeShader(const char* vertexShaderFile, const char* fragmentShaderFile).
|
||||||
|
*/
|
||||||
class OGLU_API AbstractShader
|
class OGLU_API AbstractShader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs a new shader program.
|
||||||
|
*
|
||||||
|
* Use this function to create new shaders.
|
||||||
|
*
|
||||||
|
* @param[in] vertexShaderFile Filepath to the vertex shader
|
||||||
|
* @param[in] fragmentShaderFile Filepath to the fragment shader
|
||||||
|
*
|
||||||
|
* @return A shared pointer to the shader program.
|
||||||
|
*/
|
||||||
friend std::shared_ptr<AbstractShader> OGLU_API MakeShader(const char* vertexShaderFile, const char* fragmentShaderFile);
|
friend std::shared_ptr<AbstractShader> OGLU_API MakeShader(const char* vertexShaderFile, const char* fragmentShaderFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy constructor.
|
||||||
|
*
|
||||||
|
* Copying a shader is generally possible. Since the user is given a shared pointer the
|
||||||
|
* shader program is only deleted once every instance has been deconstructed.
|
||||||
|
*
|
||||||
|
* @param[in] other Shader to copy from
|
||||||
|
*/
|
||||||
AbstractShader(const AbstractShader& other);
|
AbstractShader(const AbstractShader& other);
|
||||||
~AbstractShader();
|
~AbstractShader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Use this shader.
|
||||||
|
*/
|
||||||
void Use();
|
void Use();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the uniform location within the program.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
*
|
||||||
|
* @return Location of the uniform.
|
||||||
|
*/
|
||||||
GLint GetUniformLocation(const GLchar* name);
|
GLint GetUniformLocation(const GLchar* name);
|
||||||
|
|
||||||
#pragma region Uniforms
|
#pragma region Uniforms
|
||||||
|
/**
|
||||||
|
* @brief Set uniform float.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLfloat v0);
|
void SetUniform(const GLchar* name, GLfloat v0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform float.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLfloat v0);
|
void SetUniform(GLint location, GLfloat v0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform vec2.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLfloat v0, GLfloat v1);
|
void SetUniform(const GLchar* name, GLfloat v0, GLfloat v1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform vec2.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLfloat v0, GLfloat v1);
|
void SetUniform(GLint location, GLfloat v0, GLfloat v1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform vec3.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1, v2 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLfloat v0, GLfloat v1, GLfloat v2);
|
void SetUniform(const GLchar* name, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform vec3.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1, v2 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
void SetUniform(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform vec4.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1, v2, v3 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
void SetUniform(const GLchar* name, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform vec4.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1, v2, v3 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
void SetUniform(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform int.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLint v0);
|
void SetUniform(const GLchar* name, GLint v0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform int.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLint v0);
|
void SetUniform(GLint location, GLint v0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform ivec2.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLint v0, GLint v1);
|
void SetUniform(const GLchar* name, GLint v0, GLint v1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform ivec2.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLint v0, GLint v1);
|
void SetUniform(GLint location, GLint v0, GLint v1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform ivec3.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1, v2 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLint v0, GLint v1, GLint v2);
|
void SetUniform(const GLchar* name, GLint v0, GLint v1, GLint v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform ivec3.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1, v2 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLint v0, GLint v1, GLint v2);
|
void SetUniform(GLint location, GLint v0, GLint v1, GLint v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform ivec4.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1, v2, v3 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLint v0, GLint v1, GLint v2, GLint v3);
|
void SetUniform(const GLchar* name, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform ivec4.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1, v2, v3 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
void SetUniform(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uint.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLuint v0);
|
void SetUniform(const GLchar* name, GLuint v0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uint.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLuint v0);
|
void SetUniform(GLint location, GLuint v0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uvec2.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLuint v0, GLuint v1);
|
void SetUniform(const GLchar* name, GLuint v0, GLuint v1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uvec2.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLuint v0, GLuint v1);
|
void SetUniform(GLint location, GLuint v0, GLuint v1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uvec3.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1, v2 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLuint v0, GLuint v1, GLuint v2);
|
void SetUniform(const GLchar* name, GLuint v0, GLuint v1, GLuint v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uvec3.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1, v2 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLuint v0, GLuint v1, GLuint v2);
|
void SetUniform(GLint location, GLuint v0, GLuint v1, GLuint v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uvec4.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0, v1, v2, v3 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(const GLchar* name, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
void SetUniform(const GLchar* name, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform uvec4.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0, v1, v2, v3 Value to set the uniform to
|
||||||
|
*/
|
||||||
void SetUniform(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
void SetUniform(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
||||||
|
|
||||||
void SetUniform(const GLchar* name, const Color* v0, bool ignoreAlpha = false);
|
/**
|
||||||
void SetUniform(GLint location, const Color* v0, bool ignoreAlpha = false);
|
* @brief Set uniform color.
|
||||||
|
*
|
||||||
|
* Sets either a uniform vec3 or vec4, depending on wether alpha is enabled.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
* @param[in] ignoreAlpha Toggles the alpha channel
|
||||||
|
*/
|
||||||
|
void SetUniform(const GLchar* name, const Color& v0, bool ignoreAlpha = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set uniform color.
|
||||||
|
*
|
||||||
|
* Sets either a uniform vec3 or vec4, depending on wether alpha is enabled.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] v0 Value to set the uniform to
|
||||||
|
* @param[in] ignoreAlpha Toggles the alpha channel
|
||||||
|
*/
|
||||||
|
void SetUniform(GLint location, const Color& v0, bool ignoreAlpha = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform float.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform1fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
void SetUniform1fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform float.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform1fv(GLint location, GLsizei count, const GLfloat* value);
|
void SetUniform1fv(GLint location, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform vec2.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform2fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
void SetUniform2fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform vec2.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform2fv(GLint location, GLsizei count, const GLfloat* value);
|
void SetUniform2fv(GLint location, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform vec3.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform3fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
void SetUniform3fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform vec3.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform3fv(GLint location, GLsizei count, const GLfloat* value);
|
void SetUniform3fv(GLint location, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform vec4.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform4fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
void SetUniform4fv(const GLchar* name, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform vec4.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform4fv(GLint location, GLsizei count, const GLfloat* value);
|
void SetUniform4fv(GLint location, GLsizei count, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform int.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform1iv(const GLchar* name, GLsizei count, const GLint* value);
|
void SetUniform1iv(const GLchar* name, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform int.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform1iv(GLint location, GLsizei count, const GLint* value);
|
void SetUniform1iv(GLint location, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform ivec2.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform2iv(const GLchar* name, GLsizei count, const GLint* value);
|
void SetUniform2iv(const GLchar* name, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform ivec2.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform2iv(GLint location, GLsizei count, const GLint* value);
|
void SetUniform2iv(GLint location, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform ivec3.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform3iv(const GLchar* name, GLsizei count, const GLint* value);
|
void SetUniform3iv(const GLchar* name, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform ivec3.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform3iv(GLint location, GLsizei count, const GLint* value);
|
void SetUniform3iv(GLint location, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform ivec4.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform4iv(const GLchar* name, GLsizei count, const GLint* value);
|
void SetUniform4iv(const GLchar* name, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform ivec4.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform4iv(GLint location, GLsizei count, const GLint* value);
|
void SetUniform4iv(GLint location, GLsizei count, const GLint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uint.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform1uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
void SetUniform1uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uint.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform1uiv(GLint location, GLsizei count, const GLuint* value);
|
void SetUniform1uiv(GLint location, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uvec2.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform2uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
void SetUniform2uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uvec2.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform2uiv(GLint location, GLsizei count, const GLuint* value);
|
void SetUniform2uiv(GLint location, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uvec3.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform3uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
void SetUniform3uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uvec3.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform3uiv(GLint location, GLsizei count, const GLuint* value);
|
void SetUniform3uiv(GLint location, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uvec4.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform4uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
void SetUniform4uiv(const GLchar* name, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set array of uniform uvec4.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniform4uiv(GLint location, GLsizei count, const GLuint* value);
|
void SetUniform4uiv(GLint location, GLsizei count, const GLuint* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 2x2 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix2fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix2fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 2x2 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 3x3 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix3fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix3fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 3x3 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 4x4 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix4fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix4fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 4x4 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 2x3 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix2x3fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix2x3fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 2x3 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 3x2 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix3x2fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix3x2fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 3x2 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 2x4 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix2x4fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix2x4fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 2x4 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 4x2 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix4x2fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix4x2fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 4x2 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 3x4 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix3x4fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix3x4fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 3x4 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 4x3 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] name Name of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix4x3fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix4x3fv(const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (array of) uniform 4x3 matrix.
|
||||||
|
*
|
||||||
|
* @param[in] location Location of the uniform
|
||||||
|
* @param[in] count Amount of elements to set
|
||||||
|
* @param[in] transpose Wether to transpose the supplied matrix
|
||||||
|
* @param[in] value Values to set uniforms to
|
||||||
|
*/
|
||||||
void SetUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
void SetUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
#pragma endregion Uniforms
|
#pragma endregion Uniforms
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Construct a shader program.
|
||||||
|
*
|
||||||
|
* To avoid accidental deletion of shader programs while they're still in use,
|
||||||
|
* this constructor has been made private. To create a shader program use
|
||||||
|
* MakeShader(const char* vertexShaderFile, const char* fragmentShaderFile).
|
||||||
|
*
|
||||||
|
* @param[in] vertexShaderFile Filepath to the vertex shader
|
||||||
|
* @param[in] fragmentShaderFile Filepath to the fragment shader
|
||||||
|
*/
|
||||||
AbstractShader(const char* vertexShaderFile, const char* fragmentShaderFile);
|
AbstractShader(const char* vertexShaderFile, const char* fragmentShaderFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Loads a shader file from disk
|
||||||
|
*
|
||||||
|
* @param[in] filename Filepath to the shader
|
||||||
|
* @param[out] buffer Contents of the shader file
|
||||||
|
*/
|
||||||
void LoadShaderSource(const char* filename, char** buffer);
|
void LoadShaderSource(const char* filename, char** buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLuint program;
|
GLuint program; ///< Handle to the Shader program
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<AbstractShader> Shader;
|
typedef std::shared_ptr<AbstractShader> Shader;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*****************************************************************//**
|
||||||
|
* \file texture.hpp
|
||||||
|
* \brief Contains functions and objects relevant to textures
|
||||||
|
*
|
||||||
|
* \author Robert
|
||||||
|
* \date January 2021
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
#ifndef TEXTURE_HPP
|
#ifndef TEXTURE_HPP
|
||||||
#define TEXTURE_HPP
|
#define TEXTURE_HPP
|
||||||
|
|
||||||
|
@ -5,25 +13,74 @@
|
||||||
|
|
||||||
namespace oglu
|
namespace oglu
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @relates AbstractTexture
|
||||||
|
* @brief Set active texture unit
|
||||||
|
*
|
||||||
|
* @param[in] index Index of the texture unit (Note: This index is actually an offset to @p GL_TEXTURE0)
|
||||||
|
*/
|
||||||
void ActiveTexture(GLubyte index);
|
void ActiveTexture(GLubyte index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief An object representing an OpenGL Texture.
|
||||||
|
*
|
||||||
|
* This class contains the OpenGL Texture and supplies the user
|
||||||
|
* with functions to operate on this texture.
|
||||||
|
*
|
||||||
|
* This class cannot be instantiated, this should be done via MakeTexture(const char* filename).
|
||||||
|
*/
|
||||||
class OGLU_API AbstractTexture
|
class OGLU_API AbstractTexture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs a new texture.
|
||||||
|
*
|
||||||
|
* Use this function to create new textures.
|
||||||
|
*
|
||||||
|
* @param[in] vertexShaderFile Filepath to the image file
|
||||||
|
*
|
||||||
|
* @return A shared pointer to the texture.
|
||||||
|
*/
|
||||||
|
friend std::shared_ptr<AbstractTexture> OGLU_API MakeTexture(const char* filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy constructor.
|
||||||
|
*
|
||||||
|
* Copying a texture is generally possible. Since the user is given a shared pointer the
|
||||||
|
* texture is only deleted once every instance has been deconstructed.
|
||||||
|
*
|
||||||
|
* @param[in] other Texture to copy from
|
||||||
|
*/
|
||||||
AbstractTexture(const AbstractTexture& other);
|
AbstractTexture(const AbstractTexture& other);
|
||||||
~AbstractTexture();
|
~AbstractTexture();
|
||||||
|
|
||||||
friend std::shared_ptr<AbstractTexture> OGLU_API MakeTexture(const char* filename);
|
/**
|
||||||
|
* @brief Bind this texture.
|
||||||
|
*/
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unbind this texture.
|
||||||
|
*/
|
||||||
void Unbind();
|
void Unbind();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Construct a texture.
|
||||||
|
*
|
||||||
|
* To avoid accidental deletion of textures while they're still in use,
|
||||||
|
* this constructor has been made private. To create a texture use
|
||||||
|
* MakeTexture(const char* filename).
|
||||||
|
*
|
||||||
|
* @param[in] vertexShaderFile Filepath to the image file
|
||||||
|
*/
|
||||||
AbstractTexture(const char* filename);
|
AbstractTexture(const char* filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int width, height, nrChannels;
|
int width; ///< Width of the loaded image
|
||||||
GLuint texture;
|
int height; ///< Height of the loaded image
|
||||||
|
int nrChannels; ///< Channels of the loaded image
|
||||||
|
GLuint texture; ///< OpenGL handle to the texture
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<AbstractTexture> Texture;
|
typedef std::shared_ptr<AbstractTexture> Texture;
|
||||||
|
|
124
include/vertexArray.hpp
Normal file
124
include/vertexArray.hpp
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/*****************************************************************//**
|
||||||
|
* \file vertexArray.hpp
|
||||||
|
* \brief Contains functions and objects relevant to VAOs
|
||||||
|
*
|
||||||
|
* \author Robert
|
||||||
|
* \date January 2021
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#ifndef VERTEXARRAY_HPP
|
||||||
|
#define VERTEXARRAY_HPP
|
||||||
|
|
||||||
|
#include <core.hpp>
|
||||||
|
|
||||||
|
namespace oglu
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Structure to store topology data.
|
||||||
|
*/
|
||||||
|
OGLU_API struct VertexAttribute {
|
||||||
|
/*@{*/
|
||||||
|
GLuint index; ///< Index of the vertex attribute
|
||||||
|
GLint size; ///< Number of elements in this attribute
|
||||||
|
GLenum type; ///< Datatype of the elements
|
||||||
|
GLboolean normalized; ///< Normalize fixed-point data
|
||||||
|
GLsizei stride; ///< Byte offset between these attributes
|
||||||
|
const GLvoid* pointer; ///< Offset of this attribute into the data
|
||||||
|
/*@}*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief An object representing an OpenGL VAO.
|
||||||
|
*
|
||||||
|
* This class contains the OpenGL VAO and supplies the user
|
||||||
|
* with functions to operate on this VAO.
|
||||||
|
*
|
||||||
|
* This class cannot be instantiated, this should be done via MakeVertexArray().
|
||||||
|
*/
|
||||||
|
class OGLU_API AbstractVertexArray
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs a new VAO.
|
||||||
|
*
|
||||||
|
* Use this function to create new VAOs.
|
||||||
|
*
|
||||||
|
* @param[in] vertices Array of vertex data
|
||||||
|
* @param[in] verticesSize Size of vertex array
|
||||||
|
* @param[in] indices Array of index data
|
||||||
|
* @param[in] indicesSize Size of index array
|
||||||
|
* @param[in] topology Array of VertexAttribute
|
||||||
|
* @param[in] topologySize Size of topology array
|
||||||
|
*
|
||||||
|
* @return A shared pointer to the texture.
|
||||||
|
*/
|
||||||
|
friend std::shared_ptr<AbstractVertexArray> OGLU_API MakeVertexArray(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy constructor.
|
||||||
|
*
|
||||||
|
* Copying a VAO is generally possible. Since the user is given a shared pointer the
|
||||||
|
* VAO is only deleted once every instance has been deconstructed.
|
||||||
|
*
|
||||||
|
* @param[in] other VAO to copy from
|
||||||
|
*/
|
||||||
|
AbstractVertexArray(const AbstractVertexArray& other);
|
||||||
|
~AbstractVertexArray();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Bind this VAO.
|
||||||
|
*/
|
||||||
|
void Bind();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unbind this VAO.
|
||||||
|
*/
|
||||||
|
void Unbind();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Draw this VAO.
|
||||||
|
*
|
||||||
|
* This function does not bind the VAO before drawing, be careful when using this. Also see: BindAndDraw()
|
||||||
|
*/
|
||||||
|
void Draw();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Draw this VAO.
|
||||||
|
*
|
||||||
|
* This function binds, draws, then unbinds the VAO. Also see: Draw()
|
||||||
|
*/
|
||||||
|
void BindAndDraw();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Construct a VAO.
|
||||||
|
*
|
||||||
|
* To avoid accidental deletion of VAO while they're still in use,
|
||||||
|
* this constructor has been made private. To create a texture use
|
||||||
|
* MakeVertexArray().
|
||||||
|
*
|
||||||
|
* @param[in] vertices Array of vertex data
|
||||||
|
* @param[in] verticesSize Size of vertex array
|
||||||
|
* @param[in] indices Array of index data
|
||||||
|
* @param[in] indicesSize Size of index array
|
||||||
|
* @param[in] topology Array of VertexAttribute
|
||||||
|
* @param[in] topologySize Size of topology array
|
||||||
|
*/
|
||||||
|
AbstractVertexArray(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Registers and enables a Vertex Attribute Pointer.
|
||||||
|
*/
|
||||||
|
inline void RegisterVertexAttribPointer(GLuint index, const VertexAttribute& topology);
|
||||||
|
|
||||||
|
// TODO: Create new class for Buffer objects. Then multiple VAOs can use the same buffers
|
||||||
|
GLuint VAO; ///< Handle to OpenGL VAO
|
||||||
|
GLuint VBO; ///< Handle to OpenGL VBO
|
||||||
|
GLuint EBO; ///< Handle to OpenGL EBO
|
||||||
|
GLsizei count; ///< Amount of indices
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<AbstractVertexArray> VertexArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -213,17 +213,17 @@ namespace oglu
|
||||||
glUniform4ui(location, v0, v1, v2, v3);
|
glUniform4ui(location, v0, v1, v2, v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractShader::SetUniform(const GLchar* name, const Color* v0, bool ignoreAlpha)
|
void AbstractShader::SetUniform(const GLchar* name, const Color& v0, bool ignoreAlpha)
|
||||||
{
|
{
|
||||||
SetUniform(glGetUniformLocation(program, name), v0, ignoreAlpha);
|
SetUniform(glGetUniformLocation(program, name), v0, ignoreAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractShader::SetUniform(GLint location, const Color* v0, bool ignoreAlpha)
|
void AbstractShader::SetUniform(GLint location, const Color& v0, bool ignoreAlpha)
|
||||||
{
|
{
|
||||||
if (ignoreAlpha)
|
if (ignoreAlpha)
|
||||||
glUniform3f(location, v0->r, v0->g, v0->b);
|
glUniform3f(location, v0.r, v0.g, v0.b);
|
||||||
else
|
else
|
||||||
glUniform4f(location, v0->r, v0->g, v0->b, v0->a);
|
glUniform4f(location, v0.r, v0.g, v0.b, v0.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractShader::SetUniform1fv(const GLchar* name, GLsizei count, const GLfloat* value)
|
void AbstractShader::SetUniform1fv(const GLchar* name, GLsizei count, const GLfloat* value)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "object.hpp"
|
#include "vertexArray.hpp"
|
||||||
|
|
||||||
namespace oglu
|
namespace oglu
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace oglu
|
||||||
glDeleteBuffers(1, &EBO);
|
glDeleteBuffers(1, &EBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexArray MakeObject(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize)
|
VertexArray MakeVertexArray(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize)
|
||||||
{
|
{
|
||||||
AbstractVertexArray* obj = new AbstractVertexArray(vertices, verticesSize, indices, indicesSize, topology, topologySize);
|
AbstractVertexArray* obj = new AbstractVertexArray(vertices, verticesSize, indices, indicesSize, topology, topologySize);
|
||||||
return VertexArray(obj);
|
return VertexArray(obj);
|
Loading…
Add table
Add a link
Reference in a new issue