[DEV] add an api to set texture in compsiting::Image ==> need to rework this API
This commit is contained in:
parent
eac0a5828c
commit
bd0c899654
@ -75,7 +75,8 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( m_resource == nullptr
|
if ( m_resource == nullptr
|
||||||
&& m_resourceDF == nullptr) {
|
&& m_resourceDF == nullptr
|
||||||
|
&& m_resourceImage == nullptr) {
|
||||||
// this is a normale case ... the user can choice to have no image ...
|
// this is a normale case ... the user can choice to have no image ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,7 +95,9 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
|
|||||||
m_GLprogram->use();
|
m_GLprogram->use();
|
||||||
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
|
||||||
// TextureID
|
// TextureID
|
||||||
if (m_resource != nullptr) {
|
if (m_resourceImage != nullptr) {
|
||||||
|
m_GLprogram->setTexture0(m_GLtexID, m_resourceImage->getRendererId());
|
||||||
|
} else if (m_resource != nullptr) {
|
||||||
if (m_distanceFieldMode == true) {
|
if (m_distanceFieldMode == true) {
|
||||||
EWOL_ERROR("FONT type error Request distance field and display normal ...");
|
EWOL_ERROR("FONT type error Request distance field and display normal ...");
|
||||||
}
|
}
|
||||||
@ -274,10 +277,12 @@ void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2
|
|||||||
}
|
}
|
||||||
ememory::SharedPtr<ewol::resource::TextureFile> resource = m_resource;
|
ememory::SharedPtr<ewol::resource::TextureFile> resource = m_resource;
|
||||||
ememory::SharedPtr<ewol::resource::ImageDF> resourceDF = m_resourceDF;
|
ememory::SharedPtr<ewol::resource::ImageDF> resourceDF = m_resourceDF;
|
||||||
|
ememory::SharedPtr<ewol::resource::Texture> resourceTex = m_resourceImage;
|
||||||
m_filename = _newFile;
|
m_filename = _newFile;
|
||||||
m_requestSize = _size;
|
m_requestSize = _size;
|
||||||
m_resource.reset();
|
m_resource.reset();
|
||||||
m_resourceDF.reset();
|
m_resourceDF.reset();
|
||||||
|
m_resourceImage.reset();
|
||||||
ivec2 tmpSize(_size.x(),_size.y());
|
ivec2 tmpSize(_size.x(),_size.y());
|
||||||
// note that no image can be loaded...
|
// note that no image can be loaded...
|
||||||
if (_newFile != "") {
|
if (_newFile != "") {
|
||||||
@ -304,8 +309,20 @@ void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2
|
|||||||
EWOL_WARNING("Retrive previous resource (DF)");
|
EWOL_WARNING("Retrive previous resource (DF)");
|
||||||
m_resourceDF = resourceDF;
|
m_resourceDF = resourceDF;
|
||||||
}
|
}
|
||||||
|
if (resourceTex != nullptr) {
|
||||||
|
EWOL_WARNING("Retrive previous resource (image)");
|
||||||
|
m_resourceImage = resourceTex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void ewol::compositing::Image::setSource(egami::Image _image) {
|
||||||
|
clear();
|
||||||
|
m_filename = "direct image BUFFER";
|
||||||
|
m_requestSize = _image.getSize();
|
||||||
|
m_resourceImage = ewol::resource::Texture::create();
|
||||||
|
m_resourceImage->get() = _image;
|
||||||
|
m_resourceImage->flush();
|
||||||
|
}
|
||||||
|
|
||||||
bool ewol::compositing::Image::hasSources() {
|
bool ewol::compositing::Image::hasSources() {
|
||||||
return m_resource != nullptr
|
return m_resource != nullptr
|
||||||
|
@ -36,6 +36,7 @@ namespace ewol {
|
|||||||
private:
|
private:
|
||||||
bool m_distanceFieldMode; //!< select distance field mode
|
bool m_distanceFieldMode; //!< select distance field mode
|
||||||
ememory::SharedPtr<ewol::resource::TextureFile> m_resource; //!< texture resources
|
ememory::SharedPtr<ewol::resource::TextureFile> m_resource; //!< texture resources
|
||||||
|
ememory::SharedPtr<ewol::resource::Texture> m_resourceImage; //!< texture resources
|
||||||
ememory::SharedPtr<ewol::resource::ImageDF> m_resourceDF; //!< texture resources
|
ememory::SharedPtr<ewol::resource::ImageDF> m_resourceDF; //!< texture resources
|
||||||
static const int32_t m_vboIdCoord;
|
static const int32_t m_vboIdCoord;
|
||||||
static const int32_t m_vboIdCoordTex;
|
static const int32_t m_vboIdCoordTex;
|
||||||
@ -162,6 +163,7 @@ namespace ewol {
|
|||||||
setSource(_newFile, vec2(_size,_size));
|
setSource(_newFile, vec2(_size,_size));
|
||||||
};
|
};
|
||||||
void setSource(const std::string& _newFile, const vec2& _size);
|
void setSource(const std::string& _newFile, const vec2& _size);
|
||||||
|
void setSource(egami::Image _image);
|
||||||
/**
|
/**
|
||||||
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
||||||
* @return the validity od the resources.
|
* @return the validity od the resources.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user