image, texture #562

Closed
opened 2016-03-24 02:45:58 +00:00 by streamgao · 4 comments
streamgao commented 2016-03-24 02:45:58 +00:00 (Migrated from github.com)

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!

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!
unpacklo commented 2016-03-24 03:35:28 +00:00 (Migrated from github.com)

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 notifications@github.com 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

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 notifications@github.com 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
ocornut commented 2016-03-24 09:23:03 +00:00 (Migrated from github.com)
Also see https://github.com/ocornut/imgui/issues/561 https://github.com/ocornut/imgui/issues/521 https://github.com/ocornut/imgui/issues/510 https://github.com/ocornut/imgui/issues/497 https://github.com/ocornut/imgui/issues/475 This is a commonly asked question so I am going to try clarifying this in the docs and FAQ.
CrazyJacobJiang commented 2018-05-29 14:20:55 +00:00 (Migrated from github.com)

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

could you give me a example for loading image in Imgui?
ocornut commented 2019-09-20 17:08:06 +00:00 (Migrated from github.com)

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

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
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#562
No description provided.