[DEV] first display with VBO ... just vertex...
This commit is contained in:
parent
ba5bbea967
commit
857d475d23
@ -11,4 +11,5 @@ varying vec4 f_color;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = texture2D(EW_texID, f_texcoord) * f_color;
|
||||
gl_FragColor = vec4(1.0,1.0,0.2,0.6);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ ewol::Mesh::Mesh(etk::UString genName) :
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
//ewol::resource::Keep("w", m_verticesVBO);
|
||||
ewol::resource::Keep("w", m_verticesVBO);
|
||||
}
|
||||
|
||||
ewol::Mesh::~Mesh(void)
|
||||
@ -35,7 +35,7 @@ ewol::Mesh::~Mesh(void)
|
||||
ewol::resource::Release(m_texture1);
|
||||
}
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
//ewol::resource::Release(m_verticesVBO);
|
||||
ewol::resource::Release(m_verticesVBO);
|
||||
}
|
||||
|
||||
|
||||
@ -63,14 +63,18 @@ void ewol::Mesh::Draw(mat4& positionMatrix)
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_texture1->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_vertices[0]);
|
||||
//m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_vertices[0]);
|
||||
m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, 0);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_uvTextures[0]);
|
||||
//m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_uvTextures[0]);
|
||||
//m_GLprogram->SendAttributePointer(m_GLPosition, 2/*u,v*/, m_verticesVBO, 1);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
//m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
//m_GLprogram->SendAttributePointer(m_GLPosition, 4/*r,g,b,a*/, m_verticesVBO, 2);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_vertices.Size());
|
||||
m_GLprogram->UnUse();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBindBuffer(GL_ARRAY_BUFFER,0);
|
||||
}
|
||||
|
||||
|
@ -181,17 +181,26 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
|
||||
|
||||
// Put the attributes in buffers
|
||||
m_vertices.PushBack(vertices[vertexIndex-1]);
|
||||
m_verticesVBO->GetRefBuffer().PushBack(vertices[vertexIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer().PushBack(vertices[vertexIndex-1].y);
|
||||
m_verticesVBO->GetRefBuffer().PushBack(vertices[vertexIndex-1].z);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].y);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].z);
|
||||
m_uvTextures.PushBack(uvTextures[uvIndex-1]);
|
||||
m_verticesVBO->GetRefBuffer(1).PushBack(uvTextures[uvIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer(1).PushBack(uvTextures[uvIndex-1].y);
|
||||
draw::Color tmpppp(0xFFFFFFFF);
|
||||
draw::Colorf tmppppp(tmpppp);
|
||||
m_coordColor.PushBack(tmppppp);
|
||||
m_verticesVBO->GetRefBuffer(2).PushBack(tmppppp.r);
|
||||
m_verticesVBO->GetRefBuffer(2).PushBack(tmppppp.g);
|
||||
m_verticesVBO->GetRefBuffer(2).PushBack(tmppppp.b);
|
||||
m_verticesVBO->GetRefBuffer(2).PushBack(tmppppp.a);
|
||||
|
||||
if (indicesNormal.Size()>iii) {
|
||||
uint32_t normalIndex = indicesNormal[iii];
|
||||
m_normals.PushBack(normals[normalIndex-1]);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].y);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].z);
|
||||
}
|
||||
}
|
||||
m_verticesVBO->Flush();
|
||||
|
@ -296,9 +296,33 @@ void ewol::Program::SendAttribute(int32_t idElem, int32_t nbElement, void* point
|
||||
GL_FALSE, // take our values as-is
|
||||
jumpBetweenSample, // no extra data between each position
|
||||
pointer); // Pointer on the buffer
|
||||
checkGlError("glVertexAttribPointer", __LINE__);
|
||||
//checkGlError("glVertexAttribPointer", __LINE__);
|
||||
glEnableVertexAttribArray(m_elementList[idElem].m_elementId);
|
||||
checkGlError("glEnableVertexAttribArray", __LINE__);
|
||||
//checkGlError("glEnableVertexAttribArray", __LINE__);
|
||||
}
|
||||
|
||||
void ewol::Program::SendAttributePointer(int32_t idElem, int32_t nbElement, ewol::VirtualBufferObject* vbo, int32_t index, int32_t jumpBetweenSample)
|
||||
{
|
||||
if (0==m_program) {
|
||||
return;
|
||||
}
|
||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||
return;
|
||||
}
|
||||
if (false == m_elementList[idElem].m_isLinked) {
|
||||
return;
|
||||
}
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo->GetGL_ID(index));
|
||||
glVertexAttribPointer(m_elementList[idElem].m_elementId, // attribute ID of OpenGL
|
||||
nbElement, // number of elements per vertex, here (r,g,b,a)
|
||||
GL_FLOAT, // the type of each element
|
||||
GL_FALSE, // take our values as-is
|
||||
jumpBetweenSample, // no extra data between each position
|
||||
0); // Pointer on the buffer
|
||||
//checkGlError("glVertexAttribPointer", __LINE__);
|
||||
glEnableVertexAttribArray(m_elementList[idElem].m_elementId);
|
||||
//checkGlError("glEnableVertexAttribArray", __LINE__);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -320,7 +344,7 @@ void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, mat4 _ma
|
||||
_matrix.Transpose();
|
||||
}
|
||||
glUniformMatrix4fv(m_elementList[idElem].m_elementId, nbElement, GL_FALSE, _matrix.m_mat);
|
||||
checkGlError("glUniformMatrix4fv", __LINE__);
|
||||
//checkGlError("glUniformMatrix4fv", __LINE__);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -338,7 +362,7 @@ void ewol::Program::Uniform1f(int32_t idElem, float value1)
|
||||
return;
|
||||
}
|
||||
glUniform1f(m_elementList[idElem].m_elementId, value1);
|
||||
checkGlError("glUniform1f", __LINE__);
|
||||
//checkGlError("glUniform1f", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform2f(int32_t idElem, float value1, float value2)
|
||||
{
|
||||
@ -353,7 +377,7 @@ void ewol::Program::Uniform2f(int32_t idElem, float value1, float value2)
|
||||
return;
|
||||
}
|
||||
glUniform2f(m_elementList[idElem].m_elementId, value1, value2);
|
||||
checkGlError("glUniform2f", __LINE__);
|
||||
//checkGlError("glUniform2f", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform3f(int32_t idElem, float value1, float value2, float value3)
|
||||
{
|
||||
@ -368,7 +392,7 @@ void ewol::Program::Uniform3f(int32_t idElem, float value1, float value2, float
|
||||
return;
|
||||
}
|
||||
glUniform3f(m_elementList[idElem].m_elementId, value1, value2, value3);
|
||||
checkGlError("glUniform3f", __LINE__);
|
||||
//checkGlError("glUniform3f", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform4f(int32_t idElem, float value1, float value2, float value3, float value4)
|
||||
{
|
||||
@ -383,7 +407,7 @@ void ewol::Program::Uniform4f(int32_t idElem, float value1, float value2, float
|
||||
return;
|
||||
}
|
||||
glUniform4f(m_elementList[idElem].m_elementId, value1, value2, value3, value4);
|
||||
checkGlError("glUniform4f", __LINE__);
|
||||
//checkGlError("glUniform4f", __LINE__);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -401,7 +425,7 @@ void ewol::Program::Uniform1i(int32_t idElem, int32_t value1)
|
||||
return;
|
||||
}
|
||||
glUniform1i(m_elementList[idElem].m_elementId, value1);
|
||||
checkGlError("glUniform1i", __LINE__);
|
||||
//checkGlError("glUniform1i", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform2i(int32_t idElem, int32_t value1, int32_t value2)
|
||||
{
|
||||
@ -416,7 +440,7 @@ void ewol::Program::Uniform2i(int32_t idElem, int32_t value1, int32_t value2)
|
||||
return;
|
||||
}
|
||||
glUniform2i(m_elementList[idElem].m_elementId, value1, value2);
|
||||
checkGlError("glUniform2i", __LINE__);
|
||||
//checkGlError("glUniform2i", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform3i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3)
|
||||
{
|
||||
@ -431,7 +455,7 @@ void ewol::Program::Uniform3i(int32_t idElem, int32_t value1, int32_t value2, in
|
||||
return;
|
||||
}
|
||||
glUniform3i(m_elementList[idElem].m_elementId, value1, value2, value3);
|
||||
checkGlError("glUniform3i", __LINE__);
|
||||
//checkGlError("glUniform3i", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform4i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3, int32_t value4)
|
||||
{
|
||||
@ -446,7 +470,7 @@ void ewol::Program::Uniform4i(int32_t idElem, int32_t value1, int32_t value2, in
|
||||
return;
|
||||
}
|
||||
glUniform4i(m_elementList[idElem].m_elementId, value1, value2, value3, value4);
|
||||
checkGlError("glUniform4i", __LINE__);
|
||||
//checkGlError("glUniform4i", __LINE__);
|
||||
}
|
||||
|
||||
|
||||
@ -473,7 +497,7 @@ void ewol::Program::Uniform1fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
return;
|
||||
}
|
||||
glUniform1fv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform1fv", __LINE__);
|
||||
//checkGlError("glUniform1fv", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform2fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
{
|
||||
@ -496,7 +520,7 @@ void ewol::Program::Uniform2fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
return;
|
||||
}
|
||||
glUniform2fv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform2fv", __LINE__);
|
||||
//checkGlError("glUniform2fv", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform3fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
{
|
||||
@ -519,7 +543,7 @@ void ewol::Program::Uniform3fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
return;
|
||||
}
|
||||
glUniform3fv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform3fv", __LINE__);
|
||||
//checkGlError("glUniform3fv", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform4fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
{
|
||||
@ -542,7 +566,7 @@ void ewol::Program::Uniform4fv(int32_t idElem, int32_t nbElement, float *value)
|
||||
return;
|
||||
}
|
||||
glUniform4fv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform4fv", __LINE__);
|
||||
//checkGlError("glUniform4fv", __LINE__);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -568,7 +592,7 @@ void ewol::Program::Uniform1iv(int32_t idElem, int32_t nbElement, int32_t *value
|
||||
return;
|
||||
}
|
||||
glUniform1iv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform1iv", __LINE__);
|
||||
//checkGlError("glUniform1iv", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||
{
|
||||
@ -591,7 +615,7 @@ void ewol::Program::Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value
|
||||
return;
|
||||
}
|
||||
glUniform2iv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform2iv", __LINE__);
|
||||
//checkGlError("glUniform2iv", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||
{
|
||||
@ -614,7 +638,7 @@ void ewol::Program::Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value
|
||||
return;
|
||||
}
|
||||
glUniform3iv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform3iv", __LINE__);
|
||||
//checkGlError("glUniform3iv", __LINE__);
|
||||
}
|
||||
void ewol::Program::Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||
{
|
||||
@ -637,7 +661,7 @@ void ewol::Program::Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value
|
||||
return;
|
||||
}
|
||||
glUniform4iv(m_elementList[idElem].m_elementId, nbElement, value);
|
||||
checkGlError("glUniform4iv", __LINE__);
|
||||
//checkGlError("glUniform4iv", __LINE__);
|
||||
}
|
||||
|
||||
|
||||
@ -650,7 +674,7 @@ void ewol::Program::Use(void)
|
||||
return;
|
||||
}
|
||||
glUseProgram(m_program);
|
||||
checkGlError("glUseProgram", __LINE__);
|
||||
//checkGlError("glUseProgram", __LINE__);
|
||||
}
|
||||
|
||||
|
||||
@ -670,13 +694,13 @@ void ewol::Program::SetTexture0(int32_t idElem, GLint textureOpenGlID)
|
||||
checkGlError("glEnable", __LINE__);
|
||||
#endif
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
checkGlError("glActiveTexture", __LINE__);
|
||||
//checkGlError("glActiveTexture", __LINE__);
|
||||
// set the textureID
|
||||
glBindTexture(GL_TEXTURE_2D, textureOpenGlID);
|
||||
checkGlError("glBindTexture", __LINE__);
|
||||
//checkGlError("glBindTexture", __LINE__);
|
||||
// Set the texture on the uniform attribute
|
||||
glUniform1i(m_elementList[idElem].m_elementId, /*GL_TEXTURE*/0);
|
||||
checkGlError("glUniform1i", __LINE__);
|
||||
//checkGlError("glUniform1i", __LINE__);
|
||||
m_hasTexture = true;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <ewol/renderer/openGL.h>
|
||||
#include <ewol/renderer/resources/Resource.h>
|
||||
#include <ewol/renderer/resources/Shader.h>
|
||||
#include <ewol/renderer/resources/VirtualBufferObject.h>
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
@ -81,6 +82,7 @@ namespace ewol
|
||||
* @param[in] jumpBetweenSample Number of byte to jump between 2 vertex (this permit to enterlace informations)
|
||||
*/
|
||||
void SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample=0);
|
||||
void SendAttributePointer(int32_t idElem, int32_t nbElement, ewol::VirtualBufferObject* vbo, int32_t index, int32_t jumpBetweenSample=0);
|
||||
/**
|
||||
* @brief User request an Uniform on this program.
|
||||
* @note uniform value is availlable for all the fragment shader in the program (only one value for all)
|
||||
|
@ -8,15 +8,17 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/renderer/ResourceManager.h>
|
||||
#include <ewol/renderer/resources/VirtualBufferObject.h>
|
||||
|
||||
|
||||
|
||||
ewol::VirtualBufferObject::VirtualBufferObject(const etk::UString& accesMode):
|
||||
ewol::VirtualBufferObject::VirtualBufferObject(const etk::UString& accesMode, int32_t nbElement):
|
||||
ewol::Resource(),
|
||||
m_exist(false),
|
||||
m_vbo(0)
|
||||
m_nbVBO(nbElement)
|
||||
{
|
||||
for (int32_t iii=0; iii<NB_VBO_MAX; iii++) {
|
||||
m_vbo[iii]=0;
|
||||
}
|
||||
m_resourceLevel = 3;
|
||||
EWOL_DEBUG("OGL : load VBO mode=\"" << accesMode << "\"");
|
||||
}
|
||||
@ -36,48 +38,48 @@ void ewol::VirtualBufferObject::RetreiveData(void)
|
||||
|
||||
void ewol::VirtualBufferObject::UpdateContext(void)
|
||||
{
|
||||
if (true==m_exist) {
|
||||
// update the data
|
||||
if (m_buffer.Size()<=0) {
|
||||
RemoveContext();
|
||||
} else {
|
||||
EWOL_INFO("VBO: Update [" << m_uniqueId << "]=" << m_buffer.Size() << "*sizeof(float) OGl_Id=" << m_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*m_buffer.Size(), &m_buffer[0], GL_STATIC_DRAW);
|
||||
//
|
||||
}
|
||||
} else {
|
||||
// create the Buffer
|
||||
if (m_buffer.Size()>0) {
|
||||
// Allocate and assign a Vertex Array Object to our handle
|
||||
glGenVertexArrays(1, &m_vao);
|
||||
glGenBuffers(1, &m_vbo);
|
||||
EWOL_INFO("VBO: Add [" << m_uniqueId << "]=" << m_buffer.Size() << "*sizeof(float) OGl_Id=" << m_vbo);
|
||||
m_exist = true;
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*m_buffer.Size(), &m_buffer[0], GL_STATIC_DRAW);
|
||||
//glEnableVertexAttribArray(0);
|
||||
//glDisableVertexAttribArray(0);
|
||||
}
|
||||
// Note we did not create the buffer when no data is needed
|
||||
if (false==m_exist) {
|
||||
// Allocate and assign a Vertex Array Object to our handle
|
||||
glGenBuffers(m_nbVBO, m_vbo);
|
||||
}
|
||||
m_exist = true;
|
||||
for (int32_t iii=0; iii<m_nbVBO; iii++) {
|
||||
EWOL_INFO("VBO : Add [" << m_uniqueId << "]=" << m_buffer[iii].Size() << "*sizeof(float) OGl_Id=" << m_vbo[iii]);
|
||||
// select the buffer to set data inside it ...
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vbo[iii]);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*m_buffer[iii].Size(), &((m_buffer[iii])[0]), GL_STATIC_DRAW);
|
||||
}
|
||||
// un-bind it to permet to have no erreor in the next display ...
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::RemoveContext(void)
|
||||
{
|
||||
if (true==m_exist) {
|
||||
EWOL_INFO("VBO: Remove [" << m_uniqueId << "]=" << m_buffer.Size() << "*sizeof(float) OGl_Id=" << m_vbo);
|
||||
glDeleteBuffers(1, &m_vbo);
|
||||
EWOL_INFO("VBO: Remove [" << m_uniqueId << "] OGl_Id=" << m_vbo[0]
|
||||
<< "/" << m_vbo[1]
|
||||
<< "/" << m_vbo[2]
|
||||
<< "/" << m_vbo[3]
|
||||
<< "/" << m_vbo[4]
|
||||
<< "/" << m_vbo[5]
|
||||
<< "/" << m_vbo[6]
|
||||
<< "/" << m_vbo[7]
|
||||
<< "/" << m_vbo[8]
|
||||
<< "/" << m_vbo[9]);
|
||||
glDeleteBuffers(m_nbVBO, m_vbo);
|
||||
m_exist = false;
|
||||
m_vbo = 0;
|
||||
for (int32_t iii=0; iii<NB_VBO_MAX; iii++) {
|
||||
m_vbo[iii] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::RemoveContextToLate(void)
|
||||
{
|
||||
m_exist = false;
|
||||
m_vbo = 0;
|
||||
for (int32_t iii=0; iii<NB_VBO_MAX; iii++) {
|
||||
m_vbo[iii] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::Reload(void)
|
||||
@ -85,3 +87,11 @@ void ewol::VirtualBufferObject::Reload(void)
|
||||
RemoveContext();
|
||||
UpdateContext();
|
||||
}
|
||||
|
||||
|
||||
void ewol::VirtualBufferObject::Flush(void)
|
||||
{
|
||||
// request to the manager to be call at the next update ...
|
||||
ewol::resource::Update(this);
|
||||
}
|
||||
|
||||
|
@ -14,25 +14,26 @@
|
||||
#include <ewol/renderer/resources/Resource.h>
|
||||
#include <ewol/renderer/openGL.h>
|
||||
|
||||
#define NB_VBO_MAX (10)
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
/**
|
||||
* @brief VirtualBufferObject is a specific resources for opengl, this load the data directly in the graphic card ad keep these inside
|
||||
*/
|
||||
// TODO : use and test it
|
||||
class VirtualBufferObject : public ewol::Resource
|
||||
{
|
||||
private :
|
||||
bool m_exist; //!< This data is availlable in the Graphic card
|
||||
GLuint m_vbo; //!< OpenGl ID of this VBO
|
||||
GLuint m_vao;
|
||||
etk::Vector<float> m_buffer; //!< data that is availlable in the VBO system ...
|
||||
int32_t m_nbVBO; //! number of simultaneous VBO
|
||||
GLuint m_vbo[NB_VBO_MAX]; //!< OpenGl ID of this VBO
|
||||
etk::Vector<float> m_buffer[NB_VBO_MAX]; //!< data that is availlable in the VBO system ...
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor of this VBO.
|
||||
* @param[in] accesMode Acces mode : ???
|
||||
*/
|
||||
VirtualBufferObject(const etk::UString& accesMode);
|
||||
VirtualBufferObject(const etk::UString& accesMode, int32_t nbElement=4);
|
||||
/**
|
||||
* @brief Destructor of this VBO.
|
||||
*/
|
||||
@ -46,12 +47,12 @@ namespace ewol
|
||||
* @brief Get the real OpenGL ID.
|
||||
* @return the Ogl id reference of this VBO.
|
||||
*/
|
||||
GLuint GetGL_ID(void) { return m_vbo; };
|
||||
GLuint GetGL_ID(int32_t id) { return m_vbo[id]; };
|
||||
/**
|
||||
* @brief Get a reference on hte buffer data for this VBO.
|
||||
* @return A reference on the data.
|
||||
*/
|
||||
etk::Vector<float>& GetRefBuffer(void) { return m_buffer; };
|
||||
etk::Vector<float>& GetRefBuffer(int32_t id) { return m_buffer[id]; };
|
||||
/**
|
||||
* @brief Get the data from the graphic card.
|
||||
*/
|
||||
@ -59,7 +60,7 @@ namespace ewol
|
||||
/**
|
||||
* @brief Send the data to the graphic card.
|
||||
*/
|
||||
void Flush(void) { UpdateContext(); };
|
||||
void Flush(void);
|
||||
/**
|
||||
* @brief This load/reload the data in the opengl context, needed when removed previously.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user