[DEV] update ewol to gale (basic work step 2)
This commit is contained in:
parent
4325aaecf2
commit
6560b59eab
@ -63,7 +63,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) {
|
||||
m_GLprogram->use();
|
||||
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
||||
// TextureID
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resource->getRendererId());
|
||||
// position :
|
||||
m_GLprogram->sendAttribute(m_GLPosition, m_coord);
|
||||
// Texture :
|
||||
|
@ -84,12 +84,12 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
|
||||
if (m_distanceFieldMode == true) {
|
||||
EWOL_ERROR("FONT type error Request distance field and display normal ...");
|
||||
}
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resource->getRendererId());
|
||||
} else {
|
||||
if (m_distanceFieldMode == false) {
|
||||
EWOL_ERROR("FONT type error Request normal and display distance field ...");
|
||||
}
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resourceDF->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resourceDF->getRendererId());
|
||||
}
|
||||
// position :
|
||||
m_GLprogram->sendAttribute(m_GLPosition, m_coord);
|
||||
|
@ -199,7 +199,7 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) {
|
||||
}
|
||||
if (nullptr!=m_resourceTexture) {
|
||||
// TextureID
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resourceTexture->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_resourceTexture->getRendererId());
|
||||
}
|
||||
// Request the draw of the elements :
|
||||
//gale::openGL::drawArrays(gale::openGL::render_triangle, 0, SHAPER_NB_MAX_VERTEX);
|
||||
|
@ -53,7 +53,7 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en
|
||||
m_GLprogram->use();
|
||||
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
||||
// Texture :
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_font->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_font->getRendererId());
|
||||
m_GLprogram->uniform1i(m_GLtextWidth, m_font->getOpenGlSize().x());
|
||||
m_GLprogram->uniform1i(m_GLtextHeight, m_font->getOpenGlSize().x());
|
||||
// position :
|
||||
@ -92,7 +92,7 @@ void ewol::compositing::Text::drawD(bool _disableDepthTest) {
|
||||
m_GLprogram->use();
|
||||
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
||||
// Texture :
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_font->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_font->getRendererId());
|
||||
m_GLprogram->uniform1i(m_GLtextWidth, m_font->getOpenGlSize().x());
|
||||
m_GLprogram->uniform1i(m_GLtextHeight, m_font->getOpenGlSize().x());
|
||||
// position :
|
||||
|
@ -64,7 +64,7 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _
|
||||
m_GLprogram->use();
|
||||
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
||||
// Texture :
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getRendererId());
|
||||
m_GLprogram->uniform1i(m_GLtextWidth, m_fontDF->getOpenGlSize().x());
|
||||
m_GLprogram->uniform1i(m_GLtextHeight, m_fontDF->getOpenGlSize().x());
|
||||
m_GLprogram->sendAttribute(m_GLPosition, m_coord);
|
||||
@ -102,7 +102,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) {
|
||||
m_GLprogram->use();
|
||||
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
||||
// Texture :
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getId());
|
||||
m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getRendererId());
|
||||
m_GLprogram->uniform1i(m_GLtextWidth, m_fontDF->getOpenGlSize().x());
|
||||
m_GLprogram->uniform1i(m_GLtextHeight, m_fontDF->getOpenGlSize().x());
|
||||
m_GLprogram->sendAttribute(m_GLPosition, m_coord);
|
||||
|
@ -33,51 +33,18 @@
|
||||
|
||||
#include <ewol/context/Context.h>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief get the main ewol mutex (event or periodic call mutex).
|
||||
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
||||
* @return the main inteface Mutex
|
||||
*/
|
||||
static std::mutex& mutexInterface() {
|
||||
static std::mutex s_interfaceMutex;
|
||||
return s_interfaceMutex;
|
||||
}
|
||||
|
||||
|
||||
static ewol::Context* l_curentInterface=nullptr;
|
||||
ewol::Context& ewol::getContext() {
|
||||
#if DEBUG_LEVEL > 2
|
||||
if(nullptr == l_curentInterface){
|
||||
EWOL_CRITICAL("[CRITICAL] try acces at an empty interface");
|
||||
}
|
||||
#endif
|
||||
return *l_curentInterface;
|
||||
gale::Context& context = gale::getContext();
|
||||
std::shared_ptr<gale::Application> appl = context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
EWOL_CRITICAL("[CRITICAL] try acces at an empty GALE application (can not get Context)");
|
||||
// ???
|
||||
}
|
||||
return *(std::static_pointer_cast<ewol::Context>(appl));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief set the curent interface.
|
||||
* @note this lock the main mutex
|
||||
*/
|
||||
void ewol::Context::lockContext() {
|
||||
mutexInterface().lock();
|
||||
l_curentInterface = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set the curent interface at nullptr.
|
||||
* @note this un-lock the main mutex
|
||||
*/
|
||||
void ewol::Context::unLockContext() {
|
||||
l_curentInterface = nullptr;
|
||||
mutexInterface().unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ewol::Context::setInitImage(const std::string& _fileName) {
|
||||
//m_initDisplayImageName = _fileName;
|
||||
}
|
||||
@ -100,7 +67,6 @@ void ewol::Context::inputEventUnGrabPointer() {
|
||||
|
||||
|
||||
void ewol::Context::onCreate(gale::Context& _context) {
|
||||
lockContext();
|
||||
EWOL_INFO(" == > Ewol system init (BEGIN)");
|
||||
// Add basic ewol translation:
|
||||
ewol::translate::addPath("ewol", "DATA:translate/ewol/");
|
||||
@ -140,34 +106,27 @@ void ewol::Context::onCreate(gale::Context& _context) {
|
||||
#endif
|
||||
*/
|
||||
EWOL_INFO(" == > Ewol system init (END)");
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onStart(gale::Context& _context) {
|
||||
lockContext();
|
||||
if (m_application == nullptr) {
|
||||
// TODO : Request exit of the application .... with error ...
|
||||
unLockContext();
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_application->getNbStepInit(); ++iii) {
|
||||
m_application->init(*this, iii);
|
||||
}
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onResume(gale::Context& _context) {
|
||||
lockContext();
|
||||
unLockContext();
|
||||
|
||||
}
|
||||
|
||||
void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
||||
lockContext();
|
||||
EWOL_INFO("REGENERATE_DISPLAY");
|
||||
// check if the user selected a windows
|
||||
if (m_windowsCurrent == nullptr) {
|
||||
EWOL_INFO("No windows ...");
|
||||
unLockContext();
|
||||
return;
|
||||
}
|
||||
// Redraw all needed elements
|
||||
@ -176,11 +135,9 @@ void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
||||
markDrawingIsNeeded();
|
||||
}
|
||||
//markDrawingIsNeeded();
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onDraw(gale::Context& _context) {
|
||||
lockContext();
|
||||
EWOL_INFO("DRAW");
|
||||
// clean internal data...
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
@ -189,22 +146,16 @@ void ewol::Context::onDraw(gale::Context& _context) {
|
||||
return;
|
||||
}
|
||||
m_windowsCurrent->sysDraw();
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onPause(gale::Context& _context) {
|
||||
lockContext();
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onStop(gale::Context& _context) {
|
||||
lockContext();
|
||||
m_application->unInit(*this);
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onDestroy(gale::Context& _context) {
|
||||
lockContext();
|
||||
EWOL_INFO(" == > Ewol system Un-Init (BEGIN)");
|
||||
// Remove current windows
|
||||
m_windowsCurrent.reset();
|
||||
@ -221,14 +172,12 @@ void ewol::Context::onDestroy(gale::Context& _context) {
|
||||
// now All must be removed !!!
|
||||
m_objectManager.unInit();
|
||||
EWOL_INFO(" == > Ewol system Un-Init (END)");
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::onPointer(enum gale::key::type _type,
|
||||
int32_t _pointerID,
|
||||
const vec2& _pos,
|
||||
gale::key::status _state) {
|
||||
lockContext();
|
||||
switch (_state) {
|
||||
case gale::key::status_move:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
||||
@ -247,18 +196,15 @@ void ewol::Context::onPointer(enum gale::key::type _type,
|
||||
EWOL_DEBUG("Unknow state : " << _state);
|
||||
break;
|
||||
}
|
||||
unLockContext();
|
||||
}
|
||||
void ewol::Context::onKeyboard(gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
char32_t _value,
|
||||
gale::key::status _state) {
|
||||
lockContext();
|
||||
// store the keyboard special key status for mouse event...
|
||||
m_input.setLastKeyboardSpecial(_special);
|
||||
if (m_windowsCurrent == nullptr) {
|
||||
// No windows ...
|
||||
unLockContext();
|
||||
return;
|
||||
}
|
||||
bool repeate = (_state == gale::key::status_downRepeate);
|
||||
@ -269,14 +215,12 @@ void ewol::Context::onKeyboard(gale::key::Special& _special,
|
||||
_type,
|
||||
isDown) == true) {
|
||||
// Keep a shortcut ...
|
||||
unLockContext();
|
||||
return;
|
||||
}
|
||||
// get the current focused Widget :
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = m_widgetManager.focusGet();
|
||||
if (tmpWidget == nullptr) {
|
||||
// no Widget ...
|
||||
unLockContext();
|
||||
return;
|
||||
}
|
||||
// check if the widget allow repeating key events.
|
||||
@ -314,7 +258,6 @@ void ewol::Context::onKeyboard(gale::key::Special& _special,
|
||||
EWOL_DEBUG("remove Repeate key ...");
|
||||
}
|
||||
}
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -328,12 +271,10 @@ void ewol::Context::processEvents() {
|
||||
*/
|
||||
|
||||
void ewol::Context::onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId) {
|
||||
lockContext();
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = m_widgetManager.focusGet();
|
||||
if (tmpWidget != nullptr) {
|
||||
tmpWidget->onEventClipboard(_clipboardId);
|
||||
}
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
|
||||
@ -367,7 +308,6 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
|
||||
//! Event management section ...
|
||||
{
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
processEvents();
|
||||
if (m_initStepId < m_application->getNbStepInit()) {
|
||||
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||
@ -388,7 +328,6 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
|
||||
//! bool needRedraw = ewol::widgetManager::isDrawingNeeded();
|
||||
needRedraw = m_widgetManager.isDrawingNeeded();
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
bool hasDisplayDone = false;
|
||||
//! drawing section :
|
||||
@ -437,7 +376,6 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
|
||||
}
|
||||
{
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
// release open GL Context
|
||||
gale::openGL::lock();
|
||||
// while The Gui is drawing in OpenGl, we do some not realTime things
|
||||
@ -447,7 +385,6 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
m_resourceManager.cleanInternalRemoved();
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
return hasDisplayDone;
|
||||
}
|
||||
@ -473,40 +410,40 @@ void ewol::Context::setWindows(const std::shared_ptr<ewol::widget::Windows>& _wi
|
||||
std::shared_ptr<ewol::widget::Windows> ewol::Context::getWindows() {
|
||||
return m_windowsCurrent;
|
||||
};
|
||||
void ewol::Context::onResize(const ivec2& _size) {
|
||||
EWOL_ERROR("Resize: " << _size);
|
||||
forceRedrawAll();
|
||||
}
|
||||
|
||||
void ewol::Context::forceRedrawAll() {
|
||||
if (m_windowsCurrent == nullptr) {
|
||||
return;
|
||||
}
|
||||
// TODO: m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y()));
|
||||
ivec2 size = getSize();
|
||||
m_windowsCurrent->calculateSize(vec2(size.x(), size.y()));
|
||||
}
|
||||
/*
|
||||
void ewol::Context::OS_Stop() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
EWOL_INFO("OS_Stop...");
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->sysOnKill();
|
||||
}
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::OS_Suspend() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
EWOL_INFO("OS_Suspend...");
|
||||
m_previousDisplayTime = -1;
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateSuspend();
|
||||
}
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::OS_Resume() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
EWOL_INFO("OS_Resume...");
|
||||
m_previousDisplayTime = ewol::getTime();
|
||||
m_objectManager.timeCallResume(m_previousDisplayTime);
|
||||
@ -514,28 +451,23 @@ void ewol::Context::OS_Resume() {
|
||||
m_windowsCurrent->onStateResume();
|
||||
}
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
void ewol::Context::OS_Foreground() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
EWOL_INFO("OS_Foreground...");
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateForeground();
|
||||
}
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
|
||||
void ewol::Context::OS_Background() {
|
||||
// set the curent interface :
|
||||
lockContext();
|
||||
EWOL_INFO("OS_Background...");
|
||||
if (m_windowsCurrent != nullptr) {
|
||||
m_windowsCurrent->onStateBackground();
|
||||
}
|
||||
// release the curent interface :
|
||||
unLockContext();
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -65,18 +65,6 @@ namespace ewol {
|
||||
virtual ~Context();
|
||||
private:
|
||||
ewol::context::InputManager m_input;
|
||||
protected:
|
||||
/**
|
||||
* @brief set the curent interface.
|
||||
* @note this lock the main mutex
|
||||
*/
|
||||
void lockContext();
|
||||
/**
|
||||
* @brief set the curent interface at nullptr.
|
||||
* @note this un-lock the main mutex
|
||||
*/
|
||||
void unLockContext();
|
||||
|
||||
public: // herited function:
|
||||
virtual void onCreate(gale::Context& _context);
|
||||
virtual void onStart(gale::Context& _context);
|
||||
@ -140,6 +128,8 @@ namespace ewol {
|
||||
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
|
||||
*/
|
||||
void inputEventUnGrabPointer();
|
||||
// herited function:
|
||||
virtual void onResize(const ivec2& _size);
|
||||
#if 0
|
||||
/**
|
||||
* @brief Inform the Gui that we want to have a copy of the clipboard
|
||||
|
@ -145,15 +145,16 @@ bool ewol::Object::parameterSetOnWidgetNamed(const std::string& _objectName, con
|
||||
return object->parameterSet(_config, _value);
|
||||
}
|
||||
|
||||
ewol::object::Manager& ewol::Object::getObjectManager() const {
|
||||
ewol::object::Manager& ewol::Object::getObjectManager() {
|
||||
ewol::object::Manager& tmp = ewol::getContext().getEObjectManager();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ewol::Context& ewol::Object::getContext() const {
|
||||
ewol::Context& ewol::Object::getContext() {
|
||||
return ewol::getContext();
|
||||
}
|
||||
std::shared_ptr<ewol::Object> ewol::Object::getObjectNamed(const std::string& _objectName) const {
|
||||
|
||||
std::shared_ptr<ewol::Object> ewol::Object::getObjectNamed(const std::string& _objectName) {
|
||||
return getObjectManager().getObjectNamed(_objectName);
|
||||
}
|
||||
|
||||
@ -171,4 +172,5 @@ bool ewol::parameterSetOnObjectNamed(const std::string& _objectName, const std::
|
||||
return false;
|
||||
}
|
||||
return object->parameterSet(_config, _value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,32 @@ namespace ewol {
|
||||
return object; \
|
||||
}
|
||||
|
||||
#define DECLARE_SINGLE_FACTORY(className,uniqueName) \
|
||||
template<typename ... T> static std::shared_ptr<className> create( T&& ... all ) { \
|
||||
std::shared_ptr<className> object; \
|
||||
std::shared_ptr<ewol::Object> object2 = getObjectNamed(uniqueName); \
|
||||
if (object2 != nullptr) { \
|
||||
object = std::dynamic_pointer_cast<className>(object2); \
|
||||
if (object == nullptr) { \
|
||||
GALE_CRITICAL("Request object element: '" << uniqueName << "' With the wrong type (dynamic cast error)"); \
|
||||
return nullptr; \
|
||||
} \
|
||||
} \
|
||||
if (object != nullptr) { \
|
||||
return object; \
|
||||
} \
|
||||
object = std::shared_ptr<className>(new className()); \
|
||||
if (object == nullptr) { \
|
||||
EWOL_ERROR("Factory error"); \
|
||||
return nullptr; \
|
||||
} \
|
||||
object->init(uniqueName, std::forward<T>(all)... ); \
|
||||
if (object->objectHasBeenCorectlyInit() == false) { \
|
||||
EWOL_CRITICAL("Object is not correctly init : " << #className ); \
|
||||
} \
|
||||
return object; \
|
||||
}
|
||||
|
||||
namespace ewol {
|
||||
/**
|
||||
* @brief Basic message classes for ewol system
|
||||
@ -181,12 +207,12 @@ namespace ewol {
|
||||
* @breif get the current Object manager.
|
||||
* @return the requested object manager.
|
||||
*/
|
||||
ewol::object::Manager& getObjectManager() const;
|
||||
static ewol::object::Manager& getObjectManager();
|
||||
/**
|
||||
* @brief get the curent the system inteface.
|
||||
* @return current reference on the instance.
|
||||
*/
|
||||
ewol::Context& getContext() const;
|
||||
static ewol::Context& getContext();
|
||||
private:
|
||||
bool m_isResource; //!< enable this when you want to declare this element is auto-remove
|
||||
public:
|
||||
@ -210,7 +236,7 @@ namespace ewol {
|
||||
* @param[in] _name Name of the object
|
||||
* @return the requested object or nullptr
|
||||
*/
|
||||
std::shared_ptr<ewol::Object> getObjectNamed(const std::string& _objectName) const;
|
||||
static std::shared_ptr<ewol::Object> getObjectNamed(const std::string& _objectName);
|
||||
/**
|
||||
* @brief Retrive an object with his name (in the global list)
|
||||
* @param[in] _name Name of the object
|
||||
|
@ -41,22 +41,24 @@ void ewol::resource::Texture::init() {
|
||||
gale::Resource::init();
|
||||
}
|
||||
|
||||
ewol::resource::Texture::Texture() {
|
||||
ewol::resource::Texture::Texture() :
|
||||
m_texId(0),
|
||||
m_endPointSize(1,1),
|
||||
m_loaded(false) {
|
||||
addResourceType("ewol::compositing::Texture");
|
||||
m_loaded = false;
|
||||
m_texId = 0;
|
||||
m_endPointSize.setValue(1.0,1.0);
|
||||
}
|
||||
|
||||
ewol::resource::Texture::~Texture() {
|
||||
removeContext();
|
||||
}
|
||||
#include <egami/wrapperBMP.h>
|
||||
|
||||
void ewol::resource::Texture::updateContext() {
|
||||
if (false == m_loaded) {
|
||||
// Request a new texture at openGl :
|
||||
glGenTextures(1, &m_texId);
|
||||
}
|
||||
EWOL_ERROR("plop : load the image:" << m_name);
|
||||
// in all case we set the texture properties :
|
||||
// TODO : check error ???
|
||||
glBindTexture(GL_TEXTURE_2D, m_texId);
|
||||
@ -70,6 +72,7 @@ void ewol::resource::Texture::updateContext() {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
EWOL_INFO("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << " OGl_Id=" <<m_texId);
|
||||
//egami::storeBMP("~/bbb_image.bmp", m_data);
|
||||
glTexImage2D(GL_TEXTURE_2D, // Target
|
||||
0, // Level
|
||||
GL_RGBA, // Format internal
|
||||
|
@ -16,8 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace resource {
|
||||
class Texture : public gale::resource::Texture {
|
||||
class Texture : public gale::Resource {
|
||||
protected:
|
||||
uint32_t m_texId; //!< openGl textureID.
|
||||
// openGl Context propoerties :
|
||||
egami::Image m_data;
|
||||
// some image are not square == > we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0
|
||||
@ -44,6 +45,12 @@ namespace ewol {
|
||||
void updateContext();
|
||||
void removeContext();
|
||||
void removeContextToLate();
|
||||
const ivec2& getOpenGlSize() const {
|
||||
return m_data.getSize();
|
||||
};
|
||||
uint32_t getRendererId() const {
|
||||
return m_texId;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -73,7 +73,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Windows::getWidgetAtPos(const vec2&
|
||||
}
|
||||
|
||||
void ewol::widget::Windows::sysDraw() {
|
||||
//EWOL_DEBUG("Drow on " << m_size);
|
||||
EWOL_DEBUG("Drow on " << m_size);
|
||||
// set the size of the open GL system
|
||||
gale::openGL::setViewPort(vec2(0,0), m_size);
|
||||
gale::openGL::disable(gale::openGL::flag_dither);
|
||||
@ -121,18 +121,17 @@ void ewol::widget::Windows::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
#ifdef TEST_PERFO_WINDOWS
|
||||
int64_t ___startTime0 = ewol::getTime();
|
||||
#endif
|
||||
|
||||
// clear the screen with transparency ...
|
||||
etk::Color<float> colorBg(0.5, 0.5, 0.5, 0.5);
|
||||
if (m_colorProperty != nullptr) {
|
||||
colorBg = m_colorProperty->get(m_colorBg);
|
||||
}
|
||||
glClearColor(colorBg.r(), colorBg.g(), colorBg.b(), colorBg.a());
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
gale::openGL::clearColor(colorBg);
|
||||
gale::openGL::clear( gale::openGL::clearFlag_colorBuffer
|
||||
| gale::openGL::clearFlag_depthBuffer);
|
||||
#ifdef TEST_PERFO_WINDOWS
|
||||
float ___localTime0 = (float)(ewol::getTime() - ___startTime0) / 1000.0f;
|
||||
EWOL_ERROR(" Windows000 : " << ___localTime0 << "ms ");
|
||||
|
||||
int64_t ___startTime1 = ewol::getTime();
|
||||
#endif
|
||||
//EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId);
|
||||
@ -144,7 +143,6 @@ void ewol::widget::Windows::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
#ifdef TEST_PERFO_WINDOWS
|
||||
float ___localTime1 = (float)(ewol::getTime() - ___startTime1) / 1000.0f;
|
||||
EWOL_ERROR(" Windows111 : " << ___localTime1 << "ms ");
|
||||
|
||||
int64_t ___startTime2 = ewol::getTime();
|
||||
#endif
|
||||
// second display the pop-up
|
||||
|
@ -19,12 +19,12 @@ appl::Windows::Windows() {
|
||||
}
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
setTitle("example 001_HelloWord");
|
||||
setTitle("example 001_HelloWorld");
|
||||
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setLabel("Hello <font color=\"blue\">Word</font>");
|
||||
tmpWidget->setLabel("Hello <font color=\"blue\">World</font>");
|
||||
tmpWidget->setExpand(bvec2(true,true));
|
||||
setSubWidget(tmpWidget);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user