2 #ifndef KJY_OBJECT_ORIENTED_OPENGL_VERTEX_ARRAY_OBJECT_HPP_ 3 #define KJY_OBJECT_ORIENTED_OPENGL_VERTEX_ARRAY_OBJECT_HPP_ 4 #include "../OOOGL_Core.hpp" 14 glGenVertexArrays(1, getIdPtr());
15 glGetInteger64v(GL_MAX_VERTEX_ATTRIBS, reinterpret_cast<GLint64*>(&(attrib_count)));
16 attrib_enabled_LUT.resize(attrib_count,
false);
22 void enableVertexAttribArray(GLuint index);
23 void disableVertexAttribArray(GLuint index);
24 void enableAllVertexAttribs();
25 void disableAllVertexAttribs();
26 bool isAttribArrayEnabled(GLuint index)
const;
28 void setVertexAtrribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
const GLvoid* pointer)
const;
29 void setVertexAttribPointerIntegral(GLuint index, GLint size, GLenum type, GLsizei stride,
const GLvoid* pointer)
const;
30 void setVertexAttribPointerLong(GLuint index, GLint size, GLenum type, GLsizei stride,
const GLvoid* pointer)
const;
33 void autoVertexAttribPointer(GLuint index,
ArrayBuffer vbo);
35 virtual size_t numPossessed()
const override {
return(_possessed_buffers.size());}
36 virtual void possessObject(
ArrayBuffer buffer)
override;
38 virtual bool doesPossessObject(
ArrayBuffer buffer)
const override;
40 virtual void dispossessObject(
const ArrayBuffer& buffer)
override;
43 void possessBuffer(
ArrayBuffer buffer) {possessObject(buffer);}
45 bool doesPossessBuffer(
ArrayBuffer buffer)
const {
return(doesPossessObject(buffer));}
46 bool doesPossessBuffer(
ElementArrayBuffer buffer)
const {
return(doesPossessObject(buffer));}
47 void dispossessBuffer(
const ArrayBuffer& buffer) {dispossessObject(buffer);};
51 std::vector<bool> attrib_enabled_LUT;
52 size_t attrib_count = 0;
55 static void _destroyVAO(
const GLuint*
self){
56 glDeleteVertexArrays(1,
self);
59 std::map<GLuint, OpenGlBuffer> _possessed_buffers;
65 virtual const char* what()
const noexcept
override{
return(_whatstr.c_str());}
67 const std::string _whatstr;
73 virtual const char* what()
const noexcept
override{
return(_whatstr.c_str());}
75 const std::string _whatstr;
84 size_t numLinkedArrayBuffers()
const {
return(linked_vbos.size());}
85 size_t numLinkedElementBuffers()
const {
return(linked_elbos.size());}
86 void linkArrayBuffer(GLuint index,
ArrayBuffer buffer);
89 void unlinkArrayBuffer(GLuint index);
91 void unlinkAllArrayBuffers();
93 void unlinkAllElementBuffers();
95 bool hasLinkedBuffer(GLuint index)
const;
96 const ArrayBuffer getArrayBuffer(GLuint index)
const;
101 typedef std::vector<ElementArrayBuffer> LinkedElementsVector_t;
103 LinkedArraysVector_t linked_vbos;
104 LinkedElementsVector_t linked_elbos;
107 using vboiterator = LinkedArraysVector_t::iterator;
108 using const_vboiterator = LinkedArraysVector_t::const_iterator;
110 inline const_vboiterator linkedArrayBufsBegin()
const {
return(linked_vbos.begin());}
111 inline vboiterator linkedArrayBufsBegin() {
return(linked_vbos.begin());}
112 inline const_vboiterator linkedArrayBufsEnd()
const {
return(linked_vbos.end());}
113 inline vboiterator linkedArrayBufsEnd() {
return(linked_vbos.end());}
114 inline std::vector<ElementArrayBuffer>::const_iterator linkedElementBufsBegin()
const {
return(linked_elbos.begin());}
115 inline std::vector<ElementArrayBuffer>::iterator linkedElementBufsBegin() {
return(linked_elbos.begin());}
116 inline std::vector<ElementArrayBuffer>::const_iterator linkedElementBufsEnd()
const {
return(linked_elbos.end());}
117 inline std::vector<ElementArrayBuffer>::iterator linkedElementBufsEnd() {
return(linked_elbos.end());}
119 void autoSetupBuffersForDraw();
120 void autoDisableBuffersAfterDraw();
Definition: Buffers.hpp:142
Definition: OOOGL_Core.hpp:119
Definition: OOOGL_Core.hpp:144
Definition: OOOGL_Core.hpp:105
Definition: Buffers.hpp:110
Definition: VertexArrayObject.hpp:11
Definition: VertexArrayObject.hpp:62
Definition: VertexArrayObject.hpp:70
Definition: Core_Utilities.cpp:3
Definition: Buffers.hpp:106