2020-02-12 00:29:35 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// GLEW
|
|
|
|
#include <glew.h>
|
|
|
|
|
|
|
|
// DGL
|
|
|
|
#include "DGL_FundamentalTypes.hpp"
|
|
|
|
#include "DGL_MiscTypes.hpp"
|
|
|
|
#include "DGL_Enum.hpp"
|
|
|
|
|
|
|
|
// Non-Standard C++
|
|
|
|
#include "Cpp_Alias.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-14 23:21:27 -08:00
|
|
|
namespace DGL
|
2020-02-12 00:29:35 -08:00
|
|
|
{
|
2020-02-13 22:13:16 -08:00
|
|
|
sfn BindBuffer(const EBufferTarget _targetType, const ID<Buffer> _buffer)
|
2020-02-12 00:29:35 -08:00
|
|
|
{
|
2020-02-13 22:13:16 -08:00
|
|
|
glBindBuffer(GLenum(_targetType), _buffer);
|
2020-02-12 00:29:35 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-13 22:13:16 -08:00
|
|
|
sfn BindVertexArray(const gUInt _referenceToTrackArray)
|
2020-02-12 00:29:35 -08:00
|
|
|
{
|
2020-02-13 22:13:16 -08:00
|
|
|
glBindVertexArray(_referenceToTrackArray);
|
2020-02-12 00:29:35 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-13 22:13:16 -08:00
|
|
|
template<typename TypeOfData>
|
|
|
|
sfn BufferData(ptr<TypeOfData> _data, const EBufferTarget _targetType, const EBufferUsage _usageType)
|
2020-02-12 00:29:35 -08:00
|
|
|
{
|
2020-02-13 22:13:16 -08:00
|
|
|
glBufferData(GLenum(_targetType), sizeof(TypeOfData), _data, GLenum(_usageType));
|
2020-02-12 00:29:35 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-13 22:13:16 -08:00
|
|
|
template<typename... Type, typename = EFrameBuffer>
|
|
|
|
sfn ClearBuffer(const Type... _buffersToClear)
|
2020-02-12 00:29:35 -08:00
|
|
|
{
|
2020-02-13 22:13:16 -08:00
|
|
|
glClear((gBitfield(_buffersToClear) | ...));
|
2020-02-12 00:29:35 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-13 22:13:16 -08:00
|
|
|
sfn DisableVertexAttributeArray(const gInt _vertexAttributeArrayIndex)
|
|
|
|
{
|
|
|
|
glDisableVertexAttribArray(_vertexAttributeArrayIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
sfn EnableVertexAttributeArray(const gInt _vertexAttributeArrayIndex)
|
|
|
|
{
|
|
|
|
glEnableVertexAttribArray(_vertexAttributeArrayIndex);
|
|
|
|
}
|
|
|
|
|
2020-02-12 00:29:35 -08:00
|
|
|
template<typename VertType>
|
|
|
|
sfn FormatVertexAttributes
|
|
|
|
(
|
|
|
|
gUInt _attributeIndex ,
|
|
|
|
EDataType _vertexComponenetType ,
|
|
|
|
ptr<void> _firstVertexComponentLocation,
|
|
|
|
gInt _numberOfVertexComponents ,
|
|
|
|
EBool _shouldNormalize
|
|
|
|
)
|
|
|
|
{
|
|
|
|
glVertexAttribPointer
|
|
|
|
(
|
|
|
|
_attributeIndex ,
|
|
|
|
_numberOfVertexComponents ,
|
|
|
|
GLenum(_vertexComponenetType),
|
|
|
|
GLenum(_shouldNormalize ),
|
|
|
|
sizeof(VertType ),
|
|
|
|
_firstVertexComponentLocation
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sfn GenerateBuffers(ptr<gUInt> _bufferReferencer, uInt64 _numberOfBuffersToReserve)
|
|
|
|
{
|
|
|
|
glGenBuffers(_numberOfBuffersToReserve, _bufferReferencer);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sfn GenerateVertexBuffers(ptr<gUInt> __referenceRetainerToBuffer, uInt64 _numOfObjectsToReserveFor)
|
|
|
|
{
|
|
|
|
glGenVertexArrays(_numOfObjectsToReserveFor, __referenceRetainerToBuffer);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|