So after several months of research, I finally got a way to draw an image.
IDirect3DTexture9* byteImage = nullptr;
LPCTSTR pszPic = "light.jpg";
D3DXCreateTextureFromFileExA(pDevice, pszPic, 400, 400, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &byteImage);
ImGui::Image(byteImage, ImVec2(100, 100));
and it's showing a white image
I'm not really a Windows D3D specialist, but reading https://msdn.microsoft.com/en-us/library/windows/desktop/bb172802(v=vs.85).aspx the remarks describe cases depending on return values.
Do you check what D3DXCreateTextureFromFileExA() returns ?
Second question : why D3DFMT_UNKNOW ? (reading this help page : https://msdn.microsoft.com/en-us/library/windows/desktop/bb172878(v=vs.85).aspx)
First question answer: No I don't check the return as you can see from the code
Second question answer: If I put D3DXIFF_JPG to the format it would give out an incompatible format error
and yes I'm including D3dx9tex.h
Or maybe i can convert it to .dds(from outside of the code) and then draw it
its says on the error it cant convert argument 7 from _d3dximage_fileformat to d3dformat
Well the first thing you need to do is check that return value for failure, and select a texture format. The format is GPU side format, not on-disk format, JPG doesn鈥檛 makes sense here. Your GPU format will be something like RGBA8.
Please don鈥檛 treat this issue tracker as a live chat and try to make longer fully informed answers rather than four one liners in a row like you did (edit they were removed now). Some people are receiving emails for each of your posts.
You can use imgui Metrics window to look at the draw calls emitted, find the draw call that refer to your texture, use a debugger to step through the render loop to see if everything is right.
So then I should convert my jpg to dds and then for the format D3DFMT_MULTI2_ARGB8?
I haven鈥檛 used DX9 in a long time but there must be one million internet tutorial on loading textures. I believe those functions can perfectly load a JPG and convert it to a raw format.
So, I tried that in the off-chance that there would be any complication, and it worked flawlessly on my first try:
// Load a texture
LPDIRECT3DTEXTURE9 my_texture = NULL;
HRESULT res = D3DXCreateTextureFromFileA(g_pd3dDevice, "../../test.jpg", &my_texture);
IM_ASSERT(res == 0);
IM_ASSERT(my_texture != NULL);
// Retrieve texture info
D3DSURFACE_DESC my_texture_desc;
res = my_texture->GetLevelDesc(0, &my_texture_desc);
IM_ASSERT(res == 0);
ImGui::Begin("Test #1571");
ImGui::Text("Someone here is lazy!");
ImVec2 uv_min(0.0f, 0.0f);
ImVec2 uv_max(1.0f, 1.0f);
ImGui::Image(my_texture, ImVec2((float)my_texture_desc.Width, (float)my_texture_desc.Height), uv_min, uv_max);
ImGui::End();

And there's the test JPG file:

The next thing you will have to learn are texture coordinates. Note that none of this has to do with dear imgui and you have _already_ asked the same thing in the past (#1493) and I gave you the same answer. I am closing this now. Please don't ask D3D9 related questions here.
I'm so sorry for wasting your time I don't know how d3d9 and such works
Thank you
I understand it's not easy, programming is hard. But here is just not the place to ask about D3D9 else I'll be fixing everyone's codebase. Good luck!