YourGameLib
Loading...
Searching...
No Matches
shape.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_GLSHAPE_H
21#define YOURGAME_GLSHAPE_H
22
23#include <vector>
24#include "yourgame/gl_include.h"
25#include "yourgame/gl/buffer.h"
26
27namespace yourgame
28{
29 namespace gl
30 {
31 class Shape
32 {
33 public:
35 {
36 GLuint index;
37 GLint size;
38 GLenum type;
39 GLboolean normalized;
40 GLsizei stride;
41 const GLvoid *pointer;
43 };
44
46 {
47 GLenum type;
48 GLenum drawMode;
49 GLsizei numElements;
50 };
51
52 static Shape *make(std::vector<ArrBufferDescr> arDescrs,
53 std::vector<Buffer *> arBuffers,
54 ElemArrBufferDescr elArDescr,
55 Buffer *elArBuffer);
57 bool addArrBuf(ArrBufferDescr arDescr, Buffer *buf);
58 ~Shape();
59 void draw();
60 void drawInstanced(GLsizei instancecount);
61
62 /* deleting the copy constructor and the copy assignment operator
63 prevents copying (and moving) of the object. */
64 Shape(Shape const &) = delete;
65 Shape &operator=(Shape const &) = delete;
66
67 private:
68 Shape() {}
69 ElemArrBufferDescr m_elArDescr;
70 GLuint m_vaoHandle;
71 };
72 } // namespace gl
73} // namespace yourgame
74
75#endif
Definition buffer.h:30
Definition shape.h:32
void draw()
Definition shape.cpp:98
bool addArrBuf(ArrBufferDescr arDescr, Buffer *buf)
Definition shape.cpp:68
~Shape()
Definition shape.cpp:93
Shape(Shape const &)=delete
static Shape * make(std::vector< ArrBufferDescr > arDescrs, std::vector< Buffer * > arBuffers, ElemArrBufferDescr elArDescr, Buffer *elArBuffer)
Definition shape.cpp:26
Shape & operator=(Shape const &)=delete
bool setElArDescr(Shape::ElemArrBufferDescr elArDescr)
Definition shape.cpp:62
void drawInstanced(GLsizei instancecount)
Definition shape.cpp:105
Definition audio.h:27
GLboolean normalized
Definition shape.h:39
const GLvoid * pointer
Definition shape.h:41
GLuint index
Definition shape.h:36
GLsizei stride
Definition shape.h:40
GLenum type
Definition shape.h:38
GLint size
Definition shape.h:37
GLuint attribDivisor
Definition shape.h:42
GLenum drawMode
Definition shape.h:48
GLsizei numElements
Definition shape.h:49
GLenum type
Definition shape.h:47