[DEBUG] correct run on MAcOs
This commit is contained in:
parent
ab2e72df38
commit
fa325e7d3d
@ -6,6 +6,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gale/key/key.hpp>
|
#include <gale/key/key.hpp>
|
||||||
|
#include <ememory/SharedPtr.hpp>
|
||||||
|
#include <gale/context/Context.hpp>
|
||||||
|
|
||||||
namespace MacOs {
|
namespace MacOs {
|
||||||
// return true if a flush is needed
|
// return true if a flush is needed
|
||||||
|
@ -41,7 +41,7 @@ class MacOSInterface : public gale::Context {
|
|||||||
start2ndThreadProcessing();
|
start2ndThreadProcessing();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Run() {
|
int32_t run() {
|
||||||
return mm_run();
|
return mm_run();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
@ -148,7 +148,8 @@ MacOSInterface* interface = nullptr;
|
|||||||
|
|
||||||
|
|
||||||
bool MacOs::draw(bool _displayEveryTime) {
|
bool MacOs::draw(bool _displayEveryTime) {
|
||||||
if (interface == nullptr) {
|
GALE_VERBOSE("draw request " << uint64_t(interface) << " " << _displayEveryTime);
|
||||||
|
if (interface == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return interface->MAC_Draw(_displayEveryTime);
|
return interface->MAC_Draw(_displayEveryTime);
|
||||||
@ -204,29 +205,15 @@ void MacOs::setRedrawCallback(const std::function<void()>& _func) {
|
|||||||
interface->getWidgetManager().setCallbackonRedrawNeeded(_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");
|
bool gale::context::macos::isBackendPresent() {
|
||||||
delete(interface);
|
// TODO : Do it better...
|
||||||
interface = nullptr;
|
return true;
|
||||||
return retValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,8 @@ int mm_main(int _argc, const char* _argv[]) {
|
|||||||
|
|
||||||
int mm_run(void) {
|
int mm_run(void) {
|
||||||
//MacOs::setRedrawCallback(std::bind(callbackSomeThingToDo));
|
//MacOs::setRedrawCallback(std::bind(callbackSomeThingToDo));
|
||||||
[NSApp run];
|
GALE_ERROR("Start to run");
|
||||||
|
[NSApp run];
|
||||||
GALE_DEBUG("END of application");
|
GALE_DEBUG("END of application");
|
||||||
// return no error
|
// return no error
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#import <gale/context/MacOs/OpenglView.hpp>
|
#import <gale/context/MacOs/OpenglView.hpp>
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#include <gale/context/MacOS/Context.hpp>
|
#include <gale/context/MacOs/Context.hpp>
|
||||||
#include <gale/debug.hpp>
|
#include <gale/debug.hpp>
|
||||||
#include <gale/Dimension.hpp>
|
#include <gale/Dimension.hpp>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#import <gale/context/MacOs/Windows.hpp>
|
#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/key/key.hpp>
|
||||||
|
|
||||||
#include <gale/debug.hpp>
|
#include <gale/debug.hpp>
|
||||||
|
@ -745,8 +745,8 @@ bool gale::openGL::deleteBuffers(std::vector<uint32_t>& _buffers) {
|
|||||||
#ifdef GALE_BUILD_SIMULATION
|
#ifdef GALE_BUILD_SIMULATION
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glDeleteBuffers(_buffers.size(), &_buffers[0]);
|
//glDeleteBuffers(_buffers.size(), &_buffers[0]);
|
||||||
CHECK_GL_ERROR("glDeleteBuffers", __LINE__);
|
//CHECK_GL_ERROR("glDeleteBuffers", __LINE__);
|
||||||
#ifdef GALE_BUILD_SIMULATION
|
#ifdef GALE_BUILD_SIMULATION
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -858,8 +858,8 @@ void gale::openGL::shader::remove(int64_t& _shader) {
|
|||||||
#ifdef GALE_BUILD_SIMULATION
|
#ifdef GALE_BUILD_SIMULATION
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glDeleteShader(GLuint(_shader));
|
//glDeleteShader(GLuint(_shader));
|
||||||
CHECK_GL_ERROR("glDeleteShader", __LINE__);
|
//CHECK_GL_ERROR("glDeleteShader", __LINE__);
|
||||||
#ifdef GALE_BUILD_SIMULATION
|
#ifdef GALE_BUILD_SIMULATION
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -924,8 +924,8 @@ void gale::openGL::program::remove(int64_t& _prog) {
|
|||||||
#ifdef GALE_BUILD_SIMULATION
|
#ifdef GALE_BUILD_SIMULATION
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
glDeleteProgram(GLuint(_prog));
|
//glDeleteProgram(GLuint(_prog));
|
||||||
CHECK_GL_ERROR("glDeleteProgram", __LINE__);
|
//CHECK_GL_ERROR("glDeleteProgram", __LINE__);
|
||||||
#ifdef GALE_BUILD_SIMULATION
|
#ifdef GALE_BUILD_SIMULATION
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,7 +56,7 @@ bool gale::resource::Texture::updateContext() {
|
|||||||
//Lock error ==> try later ...
|
//Lock error ==> try later ...
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_loaded == false) {
|
if (false == m_loaded) {
|
||||||
// Request a new texture at openGl :
|
// Request a new texture at openGl :
|
||||||
glGenTextures(1, &m_texId);
|
glGenTextures(1, &m_texId);
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ void gale::resource::Texture::removeContext() {
|
|||||||
if (true == m_loaded) {
|
if (true == m_loaded) {
|
||||||
// Request remove texture ...
|
// Request remove texture ...
|
||||||
GALE_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
|
GALE_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
|
||||||
glDeleteTextures(1, &m_texId);
|
//glDeleteTextures(1, &m_texId);
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user