[DEBUG] correct run on MAcOs

This commit is contained in:
Edouard DUPIN 2017-08-04 22:15:15 +02:00
parent ab2e72df38
commit fa325e7d3d
7 changed files with 28 additions and 38 deletions

View File

@ -6,6 +6,8 @@
#pragma once
#include <gale/key/key.hpp>
#include <ememory/SharedPtr.hpp>
#include <gale/context/Context.hpp>
namespace MacOs {
// return true if a flush is needed
@ -44,4 +46,4 @@ namespace gale {
ememory::SharedPtr<gale::Context> createInstance(gale::Application* _application, int _argc, const char *_argv[]);
}
}
}
}

View File

@ -41,7 +41,7 @@ class MacOSInterface : public gale::Context {
start2ndThreadProcessing();
}
int32_t Run() {
int32_t run() {
return mm_run();
}
public:
@ -148,7 +148,8 @@ MacOSInterface* interface = nullptr;
bool MacOs::draw(bool _displayEveryTime) {
if (interface == nullptr) {
GALE_VERBOSE("draw request " << uint64_t(interface) << " " << _displayEveryTime);
if (interface == nullptr) {
return false;
}
return interface->MAC_Draw(_displayEveryTime);
@ -204,29 +205,15 @@ void MacOs::setRedrawCallback(const std::function<void()>& _func) {
interface->getWidgetManager().setCallbackonRedrawNeeded(_func);
}
*/
/**
* @brief Main of the program
* @param std IO
* @return std IO
*/
int gale::run(gale::Application* _application, int _argc, const char* _argv[]) {
etk::init(_argc, _argv);
interface = new MacOSInterface(_application, _argc, _argv);
if (nullptr == interface) {
GALE_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return -2;
}
int32_t retValue = interface->Run();
GALE_INFO("Stop running");
delete(interface);
interface = nullptr;
return retValue;
bool gale::context::macos::isBackendPresent() {
// TODO : Do it better...
return true;
}
ememory::SharedPtr<gale::Context> gale::context::macos::createInstance(gale::Application* _application, int _argc, const char *_argv[]) {
ememory::SharedPtr<MacOSInterface> tmp = ememory::makeShared<MacOSInterface>(_application, _argc, _argv);
interface = tmp.get();
return tmp;
}

View File

@ -97,7 +97,8 @@ int mm_main(int _argc, const char* _argv[]) {
int mm_run(void) {
//MacOs::setRedrawCallback(std::bind(callbackSomeThingToDo));
[NSApp run];
GALE_ERROR("Start to run");
[NSApp run];
GALE_DEBUG("END of application");
// return no error
return 0;

View File

@ -7,7 +7,7 @@
#import <gale/context/MacOs/OpenglView.hpp>
#include <OpenGL/gl.h>
#include <gale/context/MacOS/Context.hpp>
#include <gale/context/MacOs/Context.hpp>
#include <gale/debug.hpp>
#include <gale/Dimension.hpp>

View File

@ -6,7 +6,7 @@
#import <gale/context/MacOs/Windows.hpp>
#include <gale/context/MacOS/Context.hpp>
#include <gale/context/MacOs/Context.hpp>
#include <gale/key/key.hpp>
#include <gale/debug.hpp>

View File

@ -745,8 +745,8 @@ bool gale::openGL::deleteBuffers(std::vector<uint32_t>& _buffers) {
#ifdef GALE_BUILD_SIMULATION
if (s_simulationMode == false) {
#endif
glDeleteBuffers(_buffers.size(), &_buffers[0]);
CHECK_GL_ERROR("glDeleteBuffers", __LINE__);
//glDeleteBuffers(_buffers.size(), &_buffers[0]);
//CHECK_GL_ERROR("glDeleteBuffers", __LINE__);
#ifdef GALE_BUILD_SIMULATION
}
#endif
@ -858,8 +858,8 @@ void gale::openGL::shader::remove(int64_t& _shader) {
#ifdef GALE_BUILD_SIMULATION
if (s_simulationMode == false) {
#endif
glDeleteShader(GLuint(_shader));
CHECK_GL_ERROR("glDeleteShader", __LINE__);
//glDeleteShader(GLuint(_shader));
//CHECK_GL_ERROR("glDeleteShader", __LINE__);
#ifdef GALE_BUILD_SIMULATION
}
#endif
@ -924,8 +924,8 @@ void gale::openGL::program::remove(int64_t& _prog) {
#ifdef GALE_BUILD_SIMULATION
if (s_simulationMode == false) {
#endif
glDeleteProgram(GLuint(_prog));
CHECK_GL_ERROR("glDeleteProgram", __LINE__);
//glDeleteProgram(GLuint(_prog));
//CHECK_GL_ERROR("glDeleteProgram", __LINE__);
#ifdef GALE_BUILD_SIMULATION
}
#endif

View File

@ -56,7 +56,7 @@ bool gale::resource::Texture::updateContext() {
//Lock error ==> try later ...
return false;
}
if (m_loaded == false) {
if (false == m_loaded) {
// Request a new texture at openGl :
glGenTextures(1, &m_texId);
}
@ -92,7 +92,7 @@ void gale::resource::Texture::removeContext() {
if (true == m_loaded) {
// Request remove texture ...
GALE_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
glDeleteTextures(1, &m_texId);
//glDeleteTextures(1, &m_texId);
m_loaded = false;
}
}