Imgui: image, texture

Created on 24 Mar 2016  Â·  4Comments  Â·  Source: ocornut/imgui

Hi,

Sorry for some beginner questions.
Can you provide any short examples for loading a image in IMGUI?

i.e. .... img = ... loadimage('.....');
texture = /////
tex_id = ...
ImGui::Image(tex_id,....)

What type is ImTextureID, is it possible to get from a gl::Texture2dRef or ?

Thanks!

Most helpful comment

could you give me a example for loading image in Imgui?

All 4 comments

imgui isn't an image library. It is up to you to have the raw texture data
already uploaded to the GPU and ready to use for imgui to reference. You
should find another library or write your own code to get texture data into
memory and upload to DirectX or OpenGL.

The imgui.h header has type of ImTextureID, which is void *. It's simply a
type agnostic way of passing around texture references until it hits your
renderer to use. Type cast it to the type you expect for the rendering
backend that you have.

On Wed, Mar 23, 2016 at 9:46 PM, Stream [email protected] wrote:

Hi,

Sorry for some beginner questions.
Can you provide any short examples for loading a image in IMGUI?

i.e. .... img = ... loadimage('.....');
texture = /////
tex_id = ...
ImGui::Image(tex_id,....)

What type is ImTextureID, is it possible to get from a gl::Texture2dRef or
?

Thanks!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/ocornut/imgui/issues/562

could you give me a example for loading image in Imgui?

I have now written a tutorial to cover image file loading for common graphics API:
https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mnemode2 picture mnemode2  Â·  3Comments

NPatch picture NPatch  Â·  3Comments

bizehao picture bizehao  Â·  3Comments

Folling picture Folling  Â·  3Comments

BlackWatersInc picture BlackWatersInc  Â·  3Comments