ImGuiDemo AccesViolation

#1

Hello
I simply use ImGui::ShowTestWindow() without any aditional code and I get this AccesViolation. What can I doing wrong?

0 Likes

#2

You are probably not creating an imgui context, not calling NewFrame() etc.
Check the examples/ app.

0 Likes

#3

Thanks, so I have that code. How can i display for example MainMenuBar?

    int main(){
    IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();

// Build atlas
unsigned char* tex_pixels = NULL;
int tex_w, tex_h;
io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);

for (int n = 0; n < 50000000; n++)
{
	printf("NewFrame() %d\n", n);
	io.DisplaySize = ImVec2(1920, 1080);
	io.DeltaTime = 1.0f / 60.0f;
	ImGui::NewFrame();

	static float f = 0.0f;
	ImGui::Text("Hello, world!");
	ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
	ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
	ImGui::ShowDemoWindow(nullptr);
	ImGui::Render();
}

printf("DestroyContext()\n");
ImGui::DestroyContext();
system("pause");
return 0;
0 Likes

#4

Use the demo window and read its code to learn to do anything.

0 Likes