Added Texture class
This commit is contained in:
parent
1b2ed0cdf5
commit
e2e15dd98f
13 changed files with 8005 additions and 35 deletions
|
@ -2,6 +2,7 @@
|
|||
#define CORE_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <glad/glad.h>
|
||||
|
||||
#ifdef OGLU_WIN32
|
||||
#ifdef OGLU_BUILD_DLL
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define DRAWABLE_HPP
|
||||
|
||||
#include <core.hpp>
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace oglu
|
||||
{
|
||||
|
@ -15,13 +14,13 @@ namespace oglu
|
|||
const GLvoid* pointer;
|
||||
} VertexAttribute;
|
||||
|
||||
class OGLU_API AbstractObject
|
||||
class OGLU_API AbstractVertexArray
|
||||
{
|
||||
public:
|
||||
AbstractObject(const AbstractObject& other);
|
||||
~AbstractObject();
|
||||
AbstractVertexArray(const AbstractVertexArray& other);
|
||||
~AbstractVertexArray();
|
||||
|
||||
friend std::shared_ptr<AbstractObject> OGLU_API MakeObject(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
|
||||
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();
|
||||
|
@ -31,7 +30,7 @@ namespace oglu
|
|||
void BindAndDraw();
|
||||
|
||||
private:
|
||||
AbstractObject(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
|
||||
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);
|
||||
|
||||
|
@ -39,7 +38,7 @@ namespace oglu
|
|||
GLsizei count;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<AbstractObject> Object;
|
||||
typedef std::shared_ptr<AbstractVertexArray> VertexArray;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#ifndef OPENGLU_HPP
|
||||
#define OPENGLU_HPP
|
||||
|
||||
#include "core.hpp"
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include "color.hpp"
|
||||
#include "object.hpp"
|
||||
#include "shader.hpp"
|
||||
#include <color.hpp>
|
||||
#include <object.hpp>
|
||||
#include <shader.hpp>
|
||||
#include <texture.hpp>
|
||||
|
||||
namespace oglu
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define SHADER_HPP
|
||||
|
||||
#include <core.hpp>
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace oglu
|
||||
{
|
||||
|
|
32
include/texture.hpp
Normal file
32
include/texture.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef TEXTURE_HPP
|
||||
#define TEXTURE_HPP
|
||||
|
||||
#include <core.hpp>
|
||||
|
||||
namespace oglu
|
||||
{
|
||||
void ActiveTexture(GLubyte index);
|
||||
|
||||
class OGLU_API AbstractTexture
|
||||
{
|
||||
public:
|
||||
AbstractTexture(const AbstractTexture& other);
|
||||
~AbstractTexture();
|
||||
|
||||
friend std::shared_ptr<AbstractTexture> OGLU_API MakeTexture(const char* filename);
|
||||
|
||||
void Bind();
|
||||
void Unbind();
|
||||
|
||||
private:
|
||||
AbstractTexture(const char* filename);
|
||||
|
||||
private:
|
||||
int width, height, nrChannels;
|
||||
GLuint texture;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<AbstractTexture> Texture;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue