Commit 645f3a6d authored by w4t's avatar w4t

Fix AddImage calls

parent 7a8e1c40
...@@ -808,18 +808,34 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<ofVec4f>& values, ...@@ -808,18 +808,34 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<ofVec4f>& values,
} }
//-------------------------------------------------------------- //--------------------------------------------------------------
void ofxImGui::AddImage(ofBaseHasTexture& hasTexture, const ofVec2f& size) void ofxImGui::AddImage(const ofBaseHasTexture& hasTexture, const ofVec2f& size)
{ {
ofxImGui::AddImage(hasTexture.getTexture(), size); ofxImGui::AddImage(hasTexture.getTexture(), size);
} }
//-------------------------------------------------------------- //--------------------------------------------------------------
void ofxImGui::AddImage(ofTexture& texture, const ofVec2f& size) void ofxImGui::AddImage(const ofTexture& texture, const ofVec2f& size)
{ {
ImTextureID textureID = GetImTextureID(texture); ImTextureID textureID = GetImTextureID(texture);
ImGui::Image(textureID, size); ImGui::Image(textureID, size);
} }
#if OF_VERSION_MINOR >= 10
//--------------------------------------------------------------
void ofxImGui::AddImage(const ofBaseHasTexture& hasTexture, const glm::vec2& size)
{
ofxImGui::AddImage(hasTexture.getTexture(), size);
}
//--------------------------------------------------------------
void ofxImGui::AddImage(const ofTexture& texture, const glm::vec2& size)
{
ImTextureID textureID = GetImTextureID(texture);
ImGui::Image(textureID, size);
}
#endif
//-------------------------------------------------------------- //--------------------------------------------------------------
static auto vector_getter = [](void* vec, int idx, const char** out_text) static auto vector_getter = [](void* vec, int idx, const char** out_text)
{ {
......
...@@ -178,16 +178,20 @@ namespace ofxImGui ...@@ -178,16 +178,20 @@ namespace ofxImGui
template<typename DataType> template<typename DataType>
bool AddValues(const std::string& name, std::vector<DataType>& values, DataType minValue, DataType maxValue); bool AddValues(const std::string& name, std::vector<DataType>& values, DataType minValue, DataType maxValue);
void AddImage(ofBaseHasTexture& hasTexture, const ofVec2f& size); void AddImage(const ofBaseHasTexture& hasTexture, const ofVec2f& size);
void AddImage(ofTexture& texture, const ofVec2f& size); void AddImage(const ofTexture& texture, const ofVec2f& size);
#if OF_VERSION_MINOR >= 10
void AddImage(const ofBaseHasTexture& hasTexture, const glm::vec2& size);
void AddImage(const ofTexture& texture, const glm::vec2& size);
#endif
} }
static ImTextureID GetImTextureID(ofTexture& texture) static ImTextureID GetImTextureID(const ofTexture& texture)
{ {
return (ImTextureID)(uintptr_t)texture.texData.textureID; return (ImTextureID)(uintptr_t)texture.texData.textureID;
} }
static ImTextureID GetImTextureID(ofBaseHasTexture& hasTexture) static ImTextureID GetImTextureID(const ofBaseHasTexture& hasTexture)
{ {
return GetImTextureID(hasTexture.getTexture()); return GetImTextureID(hasTexture.getTexture());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment