[DEV/DEBUG] No stl start to work (add manual type declaration (NO RTTI))

This commit is contained in:
Edouard DUPIN 2017-09-17 00:12:49 +02:00
parent 5df959666e
commit 851398b31f
24 changed files with 131 additions and 78 deletions

View File

@ -7,7 +7,8 @@
#include <etk/types.hpp>
#include <gale/Application.hpp>
#include <gale/context/Context.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::Application);
gale::Application::Application() :
m_canDraw(false),

View File

@ -6,7 +6,9 @@
#include <gale/Dimension.hpp>
#include <gale/debug.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::distance);
ETK_DECLARE_TYPE(gale::Dimension);
// TODO : set this in a super class acced in a statin fuction...
// ratio in milimeter :
static bool isInit = false;

View File

@ -7,6 +7,8 @@
#include <gale/debug.hpp>
#include <gale/context/Context.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::Thread);
gale::Thread::Thread() :
m_state(state::stop),

View File

@ -23,7 +23,8 @@
#include <gale/resource/Manager.hpp>
#include <etk/Map.hpp>
#include <echrono/Steady.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::Context);
/**
* @brief get the main gale mutex (event or periodic call mutex).
@ -120,11 +121,6 @@ void gale::contextUnRegisterThread(ethread::Thread* _thread) {
g_lockContextMap.unLock();
}
void gale::Context::setInitImage(const etk::String& _fileName) {
//m_initDisplayImageName = _fileName;
}
/**
* @brief set the curent interface.
@ -146,9 +142,10 @@ void gale::Context::unLockContext() {
void gale::Context::processEvents() {
int32_t nbEvent = 0;
//GALE_DEBUG(" ******** Event");
while (m_msgSystem.count()>0) {
//GALE_DEBUG(" ******** Event " << m_msgSystem.count());
while (m_msgSystem.count() > 0) {
nbEvent++;
GALE_DEBUG(" [" << nbEvent << "] event ...");
etk::Function<void(gale::Context& _context)> func;
{
ethread::RecursiveLock lock(m_mutex);
@ -290,7 +287,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
#ifdef GALE_BUILD_SIMULATION
GALE_PRINT(" 'simulation' For simulation backend");
#endif
GALE_PRINT(" can be set with environement variable 'export EWOL_BACKEND=xxx'");
GALE_PRINT(" can be set with environement variable 'export GALE_BACKEND=xxx'");
#endif
#if defined(__TARGET_OS__Windows)
GALE_PRINT(" --gale-backend=XXX");
@ -298,7 +295,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
#ifdef GALE_BUILD_SIMULATION
GALE_PRINT(" 'simulation' For simulation backend");
#endif
GALE_PRINT(" can be set with environement variable 'export EWOL_BACKEND=xxx'");
GALE_PRINT(" can be set with environement variable 'export GALE_BACKEND=xxx'");
#endif
#if defined(__TARGET_OS__MacOs)
GALE_PRINT(" --gale-backend=XXX");
@ -306,7 +303,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
#ifdef GALE_BUILD_SIMULATION
GALE_PRINT(" 'simulation' For simulation backend");
#endif
GALE_PRINT(" can be set with environement variable 'export EWOL_BACKEND=xxx'");
GALE_PRINT(" can be set with environement variable 'export GALE_BACKEND=xxx'");
#endif
GALE_PRINT(" -h/--help");
GALE_PRINT(" Display this help");
@ -623,15 +620,17 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
m_simulationFile.filePuts(etk::toString(_displayEveryTime));
m_simulationFile.filePuts("\n");
}
//GALE_VERBOSE("Call draw");
echrono::Steady currentTime = echrono::Steady::now();
//GALE_WARNING("Time = " << currentTime);
// TODO : Review this ...
// this is to prevent the multiple display at the a high frequency ...
#if ( !defined(__TARGET_OS__Windows) \
&& !defined(__TARGET_OS__Android))
if(currentTime - m_previousDisplayTime < echrono::milliseconds(8)) {
ethread::sleepMilliSeconds((1));
return false;
}
if(currentTime - m_previousDisplayTime < echrono::milliseconds(8)) {
ethread::sleepMilliSeconds((1));
return false;
}
#endif
m_previousDisplayTime = currentTime;
@ -658,6 +657,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
*/
if (m_application != nullptr) {
// Redraw all needed elements
GALE_DEBUG("Regenerate Display");
m_application->onRegenerateDisplay(*this);
needRedraw = m_application->isDrawingNeeded();
}
@ -678,6 +678,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
}
if( needRedraw == true
|| _displayEveryTime == true) {
GALE_DEBUG(" ==> real Draw");
lockContext();
m_resourceManager.updateContext();
unLockContext();
@ -888,7 +889,7 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
etk::String request = "";
// get the environement variable:
char * basicEnv = getenv("EWOL_BACKEND");
char * basicEnv = getenv("GALE_BACKEND");
if (nullptr != basicEnv) {
etk::String tmpVal = basicEnv;
//TODO : Check if it leak ...
@ -951,7 +952,7 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
request = tmpVal;
}
#else
GALE_ERROR("Unsupported environement variable 'EWOL_BACKEND' in this mode");
GALE_ERROR("Unsupported environement variable 'GALE_BACKEND' in this mode");
#endif
}
for(int32_t iii=0; iii<_argc; ++iii) {
@ -1016,7 +1017,7 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
request = tmpVal;
}
#else
GALE_ERROR("Unsupported environement variable 'EWOL_BACKEND' in this mode");
GALE_ERROR("Unsupported environement variable 'GALE_BACKEND' in this mode");
#endif
}
}

View File

@ -286,11 +286,6 @@ namespace gale {
*/
static int main(int _argc, const char *_argv[]);
public:
/**
* @brief Special for init (main) set the start image when loading data
* @param[in] _fileName Name of the image to load
*/
void setInitImage(const etk::String& _fileName);
/**
* @brief Internal API to run the processing of the event loop ...
* @return The Exit value of the program

View File

@ -11,7 +11,10 @@
#include <gale/context/InputManager.hpp>
#include <gale/Application.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::context::InputManager);
ETK_DECLARE_TYPE(gale::context::InputPoperty);
ETK_DECLARE_TYPE(gale::context::InputLimit);
#define EVENT_DEBUG GALE_VERBOSE
//#define EVENT_DEBUG GALE_DEBUG

View File

@ -26,22 +26,31 @@ extern "C" {
#if defined(__TARGET_OS__Linux)
#if defined(__TARGET_OS__Web)
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
extern "C" {
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
}
#include <gale/renderer/openGL/openGL.hpp>
#include <gale/renderer/openGL/openGL-include.hpp>
#include <GL/glext.h>
#include <GL/glfw.h>
extern "C" {
#include <GL/glext.h>
#include <GL/glfw.h>
}
#else
#include <GL/glx.h>
extern "C" {
#include <GL/glx.h>
}
#endif
#elif defined(__TARGET_OS__MacOs)
#include <OpenGL/glx.h>
extern "C" {
#include <OpenGL/glx.h>
}
#endif
#include <X11/Xatom.h>
#include <sys/times.h>
extern "C" {
#include <X11/Xatom.h>
#include <sys/times.h>
}
/*
#define GUI_LOCK() XLockDisplay(m_display)
#define GUI_UNLOCK() XUnlockDisplay(m_display)
@ -168,7 +177,7 @@ class X11Interface : public gale::Context {
public:
X11Interface(gale::Application* _application, int32_t _argc, const char* _argv[]) :
gale::Context(_application, _argc, _argv),
m_display(nullptr),
m_display(NULL),
m_originX(0),
m_originY(0),
m_cursorEventX(0),
@ -176,7 +185,7 @@ class X11Interface : public gale::Context {
m_currentHeight(0),
m_currentWidth(0),
#if !defined(__TARGET_OS__Web)
m_visual(nullptr),
m_visual(NULL),
#endif
m_doubleBuffered(0),
m_run(false),
@ -272,10 +281,10 @@ class X11Interface : public gale::Context {
char * atomNameTarget = XGetAtomName(m_display, req->target);
GALE_INFO("X11 property: \"" << atomNameProperty << "\"");
GALE_INFO("X11 target: \"" << atomNameTarget << "\"");
if (atomNameProperty != nullptr) {
if (atomNameProperty != NULL) {
XFree(atomNameProperty);
}
if (atomNameTarget != nullptr) {
if (atomNameTarget != NULL) {
XFree(atomNameTarget);
}
}
@ -329,15 +338,15 @@ class X11Interface : public gale::Context {
XSelectionRequestEvent *req=&(event.xselectionrequest);
#ifdef DEBUG_X11_EVENT
{
if (req->property == 0) {
if (req->property == NULL) {
GALE_ERROR("Get nullptr ATOM ... property");
break;
}
if (req->selection == 0) {
if (req->selection == NULL) {
GALE_ERROR("Get nullptr ATOM ... selection");
break;
}
if (req->target == 0) {
if (req->target == NULL) {
GALE_ERROR("Get nullptr ATOM ... target");
break;
}
@ -345,9 +354,15 @@ class X11Interface : public gale::Context {
char * atomNameSelection = XGetAtomName(m_display, req->selection);
char * atomNameTarget = XGetAtomName(m_display, req->target);
GALE_INFO(" from: " << atomNameProperty << " request=" << atomNameSelection << " in " << atomNameTarget);
if (atomNameProperty != nullptr) { XFree(atomNameProperty); }
if (atomNameSelection != nullptr) { XFree(atomNameSelection); }
if (atomNameTarget != nullptr) { XFree(atomNameTarget); }
if (atomNameProperty != NULL) {
XFree(atomNameProperty);
}
if (atomNameSelection != NULL) {
XFree(atomNameSelection);
}
if (atomNameTarget != NULL) {
XFree(atomNameTarget);
}
}
#endif
@ -824,6 +839,7 @@ class X11Interface : public gale::Context {
#endif
XSync(m_display,0);
}
//specialEventThatNeedARedraw = true;
// draw after switch the previous windows ...
if (specialEventThatNeedARedraw == true) {
X11_INFO("specialEventThatNeedARedraw = " << specialEventThatNeedARedraw);
@ -1091,8 +1107,8 @@ class X11Interface : public gale::Context {
static char *title = (char*)"Gale";
// Connect to the X server
m_display = XOpenDisplay(nullptr);
if(m_display == nullptr) {
m_display = XOpenDisplay(NULL);
if(m_display == NULL) {
GALE_CRITICAL("Could not open display X.");
exit(-1);
} else {
@ -1106,7 +1122,7 @@ class X11Interface : public gale::Context {
#if !defined(__TARGET_OS__Web)
// get an appropriate visual
m_visual = glXChooseVisual(m_display, Xscreen, attrListDbl);
if (m_visual == nullptr) {
if (m_visual == NULL) {
m_visual = glXChooseVisual(m_display, Xscreen, attrListSgl);
m_doubleBuffered = false;
GALE_ERROR("GL-X singlebuffered rendering will be used, no doublebuffering available");
@ -1131,8 +1147,8 @@ class X11Interface : public gale::Context {
// Create a colormap - only needed on some X clients, eg. IRIX
Window Xroot = RootWindow(m_display, Xscreen);
#if !defined(__TARGET_OS__Web)
if ( m_display != nullptr
&& m_visual != nullptr) {
if ( m_display != NULL
&& m_visual != NULL) {
attr.colormap = XCreateColormap(m_display, Xroot, m_visual->visual, AllocNone);
}
#endif
@ -1206,10 +1222,10 @@ class X11Interface : public gale::Context {
StartupState->flags = StateHint;
XSetWMProperties(m_display, m_WindowHandle,&textprop, &textprop,/* Window title/icon title*/
nullptr, 0,/* Argv[], argc for program*/
NULL, 0,/* Argv[], argc for program*/
&hints, /* Start position/size*/
StartupState,/* Iconised/not flag */
nullptr);
NULL);
XFree(StartupState);
@ -1218,15 +1234,15 @@ class X11Interface : public gale::Context {
//XIfEvent(m_display, &event, WaitForMapNotify, (char*)&m_WindowHandle);
m_xim = XOpenIM(m_display, nullptr, NULL, NULL);
if (m_xim == nullptr) {
m_xim = XOpenIM(m_display, NULL, NULL, NULL);
if (m_xim == NULL) {
GALE_ERROR("Could not open input method");
return false;
}
/*
XIMStyles *styles=nullptr;
char* failed_arg = XGetIMValues(m_xim, XNQueryInputStyle, &styles, nullptr);
if (failed_arg != nullptr) {
XIMStyles *styles=NULL;
char* failed_arg = XGetIMValues(m_xim, XNQueryInputStyle, &styles, NULL);
if (failed_arg != NULL) {
GALE_ERROR("XIM Can't get styles");
return false;
}
@ -1234,8 +1250,8 @@ class X11Interface : public gale::Context {
GALE_INFO("style " << styles->supported_styles[iii]);
}
*/
m_xic = XCreateIC(m_xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, m_WindowHandle, nullptr);
if (m_xic == nullptr) {
m_xic = XCreateIC(m_xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, m_WindowHandle, NULL);
if (m_xic == NULL) {
GALE_ERROR("Could not open IC");
return false;
}
@ -1280,7 +1296,7 @@ class X11Interface : public gale::Context {
return;
}
char* tmpVal = new char[4*dataImage.getWidth()*dataImage.getHeight()];
if (nullptr == tmpVal) {
if (tmpVal == NULL) {
GALE_CRITICAL("Allocation error ...");
return;
}
@ -1323,8 +1339,8 @@ class X11Interface : public gale::Context {
default:
return;
}
if ( m_display == nullptr
|| m_visual == nullptr) {
if ( m_display == NULL
|| m_visual == NULL) {
GALE_ERROR("X11 Can not create Image Icon ==> nullptr on m_display or m_visual");
return;
}
@ -1385,7 +1401,7 @@ class X11Interface : public gale::Context {
}
// allocate a WM hints structure.
XWMHints* win_hints = XAllocWMHints();
if (win_hints == nullptr) {
if (win_hints == NULL) {
GALE_ERROR("XAllocWMHints - out of memory");
return;
}

View File

@ -9,6 +9,8 @@
#include <gale/debug.hpp>
#include <gale/context/clipBoard.hpp>
#include <gale/context/Context.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::context::clipBoard::clipboardListe);
/*
note: copy id data :

View File

@ -8,6 +8,9 @@
#include <gale/context/commandLine.hpp>
#include <etk/Vector.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::context::CommandLine);
void gale::context::CommandLine::parse(int32_t _argc, const char* _argv[]) {
for (int32_t i=1 ; i<_argc; i++) {
GALE_INFO("commandLine : \"" << _argv[i] << "\"" );

View File

@ -5,6 +5,8 @@
*/
#include <gale/context/cursor.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::context::cursor);
static const char* cursorDescriptionString[] = {
"cursor::arrow",

View File

@ -6,6 +6,8 @@
#include <gale/key/Special.hpp>
#include <etk/stdTools.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::key::Special);
#define GALE_FLAG_KEY_CAPS_LOCK 0x00000001
#define GALE_FLAG_KEY_SHIFT 0x00000030

View File

@ -6,6 +6,8 @@
#include <gale/key/keyboard.hpp>
#include <etk/stdTools.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(enum gale::key::keyboard);
static const char* keyboardDescriptionString[] = {
"keyboard::unknow",

View File

@ -6,6 +6,8 @@
#include <gale/key/status.hpp>
#include <etk/stdTools.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(enum gale::key::status);
static const char* statusDescriptionString[] = {
"status::unknow",

View File

@ -6,7 +6,8 @@
#include <gale/key/type.hpp>
#include <etk/stdTools.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(enum gale::key::type);
static const char* typeDescriptionString[] = {
"type::unknow",

View File

@ -6,6 +6,9 @@
#include <etk/types.hpp>
#include <gale/orientation.hpp>
#include <etk/String.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(enum gale::orientation);
static const char* listValues[] = {
"orientation::screenAuto",

View File

@ -28,8 +28,8 @@ static void checkGlError(const char* _op, int32_t _localLine) {
}
#endif
}
#define CHECK_GL_ERROR(cmd,line) do { } while (false)
//#define CHECK_GL_ERROR(cmd,line) checkGlError(cmd,line)
//#define CHECK_GL_ERROR(cmd,line) do { } while (false)
#define CHECK_GL_ERROR(cmd,line) checkGlError(cmd,line)
#define OPENGL_ERROR(data) do { } while (false)
//#define OPENGL_ERROR(data) GALE_ERROR(data)
@ -330,6 +330,7 @@ etk::Stream& gale::openGL::operator <<(etk::Stream& _os, enum gale::openGL::flag
etk::makePair(openGL::flag_alphaTest, "FLAG_ALPHA_TEST"),
etk::makePair(openGL::flag_fog, "FLAG_FOG")
};
_os << "{";
bool hasOne = false;
for (auto &it : list) {
@ -473,7 +474,7 @@ void gale::openGL::reset() {
}
void gale::openGL::enable(enum gale::openGL::flag _flagID) {
//GALE_INFO("Enable : " <GALE_ERROR< _flagID);
OPENGL_INFO("Enable : " << _flagID);
#ifdef DIRECT_MODE
#ifdef GALE_BUILD_SIMULATION
if (s_simulationMode == false) {
@ -495,7 +496,7 @@ void gale::openGL::enable(enum gale::openGL::flag _flagID) {
}
void gale::openGL::disable(enum gale::openGL::flag _flagID) {
//GALE_INFO("Disable : " << _flagID);
OPENGL_INFO("Disable : " << _flagID);
#ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if (basicFlag[iii].curentFlag == (uint32_t)_flagID) {
@ -872,7 +873,7 @@ bool gale::openGL::shader::compile(int64_t _shader, const etk::String& _data) {
#ifdef GALE_BUILD_SIMULATION
if (s_simulationMode == false) {
#endif
glShaderSource(GLuint(_shader), 1, (const char**)&data, nullptr);
glShaderSource(GLuint(_shader), 1, (const char**)&data, NULL);
CHECK_GL_ERROR("glShaderSource", __LINE__);
glCompileShader(GLuint(_shader));
CHECK_GL_ERROR("glCompileShader", __LINE__);

View File

@ -11,7 +11,8 @@
#include <gale/renderer/openGL/openGL.hpp>
#include <gale/context/Context.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::resource::Manager);
gale::resource::Manager::Manager() :
m_contextHasBeenRemoved(true),

View File

@ -11,6 +11,8 @@
#include <etk/os/FSNode.hpp>
#include <gale/gale.hpp>
#include <gale/renderer/openGL/openGL-include.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::resource::Program);
//#define LOCAL_DEBUG GALE_VERBOSE
#define LOCAL_DEBUG GALE_DEBUG
@ -203,7 +205,7 @@ int32_t gale::resource::Program::getAttribute(etk::String _elementName) {
return m_elementList.size()-1;
}
int32_t gale::resource::Program::getUniform(etk::String _elementName) {
int32_t gale::resource::Program::getUniform(const etk::String& _elementName) {
ethread::RecursiveLock lock(m_mutex);
// check if it exist previously :
for(size_t iii=0; iii<m_elementList.size(); iii++) {

View File

@ -125,7 +125,7 @@ namespace gale {
* @param[in] _elementName Name of the requested uniform.
* @return An abstract ID of the current uniform (this value is all time availlable, even if the program will be reloaded)
*/
int32_t getUniform(etk::String _elementName);
int32_t getUniform(const etk::String& _elementName);
/**
* @brief Send a uniform element to the spefified ID (not send if does not really exist in the openGL program)
* @param[in] _idElem Id of the uniform that might be sended.

View File

@ -10,7 +10,9 @@
#include <gale/resource/Manager.hpp>
#include <gale/gale.hpp>
#include <gale/context/Context.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::Resource);
gale::Resource::Resource() :
m_id(0),

View File

@ -12,6 +12,9 @@
#include <gale/renderer/openGL/openGL-include.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::resource::Shader);
gale::resource::Shader::Shader() :
gale::Resource(),
m_exist(false),
@ -47,7 +50,7 @@ gale::resource::Shader::~Shader() {
}
bool gale::resource::Shader::updateContext() {
ethread::RecursiveLock lock(m_mutex);
ethread::RecursiveLock lock(m_mutex, true);
if (lock.tryLock() == false) {
//Lock error ==> try later ...
return false;

View File

@ -10,6 +10,8 @@
#include <gale/resource/Manager.hpp>
#include <gale/resource/Texture.hpp>
#include <gale/renderer/openGL/openGL-include.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::resource::Texture);
/**
* @brief get the next power 2 if the input
@ -51,7 +53,7 @@ gale::resource::Texture::~Texture() {
}
bool gale::resource::Texture::updateContext() {
ethread::RecursiveLock lock(m_mutex);
ethread::RecursiveLock lock(m_mutex, true);
if (lock.tryLock() == false) {
//Lock error ==> try later ...
return false;

View File

@ -9,6 +9,8 @@
#include <gale/resource/Manager.hpp>
#include <gale/resource/VirtualBufferObject.hpp>
#include <gale/renderer/openGL/openGL-include.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(gale::resource::VirtualBufferObject);
void gale::resource::VirtualBufferObject::init(int32_t _number) {
gale::Resource::init();
@ -49,12 +51,14 @@ void gale::resource::VirtualBufferObject::retreiveData() {
bool gale::resource::VirtualBufferObject::updateContext() {
GALE_VERBOSE(" Start: [" << getId() << "] '" << getName() << "' (size=" << m_buffer[0].size() << ")");
ethread::RecursiveLock lock(m_mutex);
ethread::RecursiveLock lock(m_mutex, true);
if (lock.tryLock() == false) {
//Lock error ==> try later ...
GALE_WARNING(" ==> Lock error on VBO");
return false;
}
if (m_exist == false) {
GALE_DEBUG(" ==> ALLOCATE new handle");
// Allocate and assign a Vertex Array Object to our handle
gale::openGL::genBuffers(m_vbo);
}
@ -63,9 +67,10 @@ bool gale::resource::VirtualBufferObject::updateContext() {
GALE_VERBOSE("VBO : add [" << getId() << "]=" << m_buffer[iii].size() << "*sizeof(float) OGl_Id=" << m_vbo[iii]);
if (m_vboUsed[iii] == true) {
// select the buffer to set data inside it ...
if (m_buffer[iii].size()>0) {
if (m_buffer[iii].size() > 0) {
gale::openGL::bindBuffer(m_vbo[iii]);
gale::openGL::bufferData(sizeof(float)*m_buffer[iii].size(), &((m_buffer[iii])[0]), gale::openGL::usage::streamDraw);
float* bufferPonter =&(m_buffer[iii][0]);
gale::openGL::bufferData(sizeof(float)*m_buffer[iii].size(), bufferPonter, gale::openGL::usage::streamDraw);
}
}
}

View File

@ -45,7 +45,6 @@ class MainApplication : public gale::Application {
}
// TO facilitate some debugs we add a name of the VBO:
m_verticesVBO->setName("[VBO] of basic SAMPLE");
m_verticesVBO->pushOnBuffer(GALE_SAMPLE_VBO_VERTICES, vec3(-0.5,-0.5,0));
m_verticesVBO->pushOnBuffer(GALE_SAMPLE_VBO_VERTICES, vec3(0,0.5,0));
m_verticesVBO->pushOnBuffer(GALE_SAMPLE_VBO_VERTICES, vec3(0.5,-0.5,0));
@ -58,6 +57,7 @@ class MainApplication : public gale::Application {
}
void onDraw(gale::Context& _context) override {
m_angle += 0.01;
TEST_INFO("==> appl Draw ...");
ivec2 size = getSize();
// set the basic openGL view port: (position drawed in the windows)
gale::openGL::setViewPort(ivec2(0,0),size);