Imgui: ImGui Directx 9 hook EndScene

Created on 4 May 2017  路  2Comments  路  Source: ocornut/imgui

Ok so im trying to use Im gui on a hook in EndScene, i can assure that lpdevice is the real draw device and the hook is correct, but i cant draw with imgui, so i guess im doing a mistake with the use of the header. Can someone give me a little bit of help?
`

pragma once

include

include

include "imgui_impl_dx9.h"

HMODULE hmodule;

LPDIRECT3DDEVICE9 lpdevice = 0;

HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 lpDevice)
{
ImGui_ImplDX9_NewFrame();
ImGui::Text("Hello World");

return OriginalEndScene(lpdevice);

}

void mainz()
{
DX9Hook::EnableVmtHookWithDetour(&lpdevice, hkEndScene);
D3DDEVICE_CREATION_PARAMETERS cParam;
lpdevice->GetCreationParameters(&cParam);
ImGui_ImplDX9_Init(cParam.hFocusWindow, lpdevice);
}

bool WINAPI DllMain(HINSTANCE hinstdll, DWORD fdwReason, LPVOID lpReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
hmodule = hinstdll;
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)mainz, 0, 0, 0);
break;
}
return true;
}
`

Most helpful comment

You missed ImGui::Render(). It should be last ImGui function called in frame.

All 2 comments

You missed ImGui::Render(). It should be last ImGui function called in frame.

thanks thedmd, i'm feeling like an idiot right now lmao.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GrammarLord picture GrammarLord  路  3Comments

SlNPacifist picture SlNPacifist  路  3Comments

namuda picture namuda  路  3Comments

mnemode2 picture mnemode2  路  3Comments

ILoveImgui picture ILoveImgui  路  3Comments