Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94949891
glbuffer.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 11, 15:43
Size
2 KB
Mime Type
text/x-c
Expires
Fri, Dec 13, 15:43 (2 d)
Engine
blob
Format
Raw Data
Handle
22902083
Attached To
rSYMKIT symkit
glbuffer.h
View Options
#ifndef __GRAPHICS_BUFFER_H__
#define __GRAPHICS_BUFFER_H__
#include <QGLBuffer>
#include <vector>
struct GLGroup
{
GLGroup(GLenum primitive = GL_TRIANGLES) : primitive(primitive) {}
/* Render primitive type */
GLenum primitive;
/*
* Memory allocated by the ibo
* Each primitive type needs a certain number of vertices to
* compose a geometrical face.
*
* POINTS -> 1
* LINES -> 2
* TRIANGLES -> 3
* QUADS -> 4
*
* To better understand primitives: https://www.khronos.org/opengl/wiki/Primitive
*/
GLuint ibo_size;
};
/*
* Color array RGBA
*
* R := red
* G := green
* B := blue
* A := alpha (transparency)
*
* All values must be bound in the range [0, 1]
*/
struct color_s
{
GLfloat red, green, blue, alpha;
};
typedef GLuint texture_t;
struct GLBuffer
{
GLBuffer() : vbo(QGLBuffer::VertexBuffer), ibo(QGLBuffer::IndexBuffer), color{1, 1, 1, 1} {}
/*
* vbo := Vertex buffer object
* ibo := Index buffer object
*
* The static rendering process is made to optimize/reduce the calls to the processor and
* reduce drastically the memory occuped by a graphical object.
*
* A vbo is a list of all 3-dimensional coordinates in the space which correspond to
* the vertices of the object to draw.
* This list is not supposed to be ordered, but it's made to avoid repetitions on the coordinates.
*
* A ibo is a list which contains all the informations about how to combine all vertices
* present in the vbo.
* That information has a different format depending on the choise of the GLPrimitive.
* In short it contains all indices combinations needed point to the right vertices in the
* right order.
*
*/
QGLBuffer vbo, ibo;
/* Virtual size of the vbo buffer (memsize) */
GLuint vbo_size;
/*
* Color array RGBA
*
* R := red
* G := green
* B := blue
* A := alpha (transparency)
*
* All values must be bound in the range [0, 1]
*/
color_s color;
texture_t texture;
/*
* Array of groups which compose the ibo.
* A ibo can be composed of a multitude of structures.
* This parameter contains the information about the data structure
* used to read/loop into the ibo.
* (So an empty vector means an empty ibo too)
*/
std::vector<GLGroup> groups;
};
#endif
Event Timeline
Log In to Comment