Texture Flickering Directx9 #937

Closed
opened 2016-12-11 17:34:45 +00:00 by jesuslovesyou234 · 4 comments
jesuslovesyou234 commented 2016-12-11 17:34:45 +00:00 (Migrated from github.com)

Imgui causing textures to flicker in game depending on window position, directx9. CreateStateBlock with D3DSBT_ALL should be saving all the states, it seems like this could be z-fighting?

Any input would be great thanks.

Small Flicker:
Small Flicker
More Flicker:
More Flicker
No Flicker:
No Flicker
TONS of Flicker:
TONS of Flicker

Imgui causing textures to flicker in game depending on window position, directx9. CreateStateBlock with D3DSBT_ALL should be saving all the states, it seems like this could be z-fighting? Any input would be great thanks. Small Flicker: ![Small Flicker](https://gyazo.com/9cf4a8fe4ac419d1206b116d598c8bc6.gif) More Flicker: ![More Flicker](https://i.gyazo.com/3b2f575445f2e522a20806a1310f3777.gif) No Flicker: ![No Flicker](https://i.gyazo.com/35c3536e2969f5e9b21019336c86568b.gif) TONS of Flicker: ![TONS of Flicker](https://i.gyazo.com/6776fbe821e53472de457833df914d35.gif)
skl131313 commented 2016-12-11 19:31:51 +00:00 (Migrated from github.com)

You could use a frame analyser see what's happening when it's flickering. Not sure how many of them still support Directx9 though, I know RenderDoc doesn't at least.

You could use a frame analyser see what's happening when it's flickering. Not sure how many of them still support Directx9 though, I know RenderDoc doesn't at least.
ocornut commented 2016-12-11 19:41:36 +00:00 (Migrated from github.com)

Comment out part of the imgui dx9 renderer to find which line/block is affecting your game.

Comment out part of the imgui dx9 renderer to find which line/block is affecting your game.
jesuslovesyou234 commented 2016-12-12 01:16:01 +00:00 (Migrated from github.com)

Figured it out, the viewport needed to be set. It still flickers if I move the window off screen in the upper left corner, I can live with that though.


// Create viewport
D3DVIEWPORT9 viewport;
viewport.Width = io.DisplaySize.x;
viewport.Height = io.DisplaySize.y;
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
viewport.X = 0.0f;
viewport.Y = 0.0f;

// Set viewport.
g_pd3dDevice->SetViewport(&viewport);


Figured it out, the viewport needed to be set. It still flickers if I move the window off screen in the upper left corner, I can live with that though. *** // Create viewport D3DVIEWPORT9 viewport; viewport.Width = io.DisplaySize.x; viewport.Height = io.DisplaySize.y; viewport.MinZ = 0.0f; viewport.MaxZ = 1.0f; viewport.X = 0.0f; viewport.Y = 0.0f; // Set viewport. g_pd3dDevice->SetViewport(&viewport); ***
ocornut commented 2016-12-19 22:16:02 +00:00 (Migrated from github.com)

I now made the DX9 example code explicitly set (and supposedly restore) the viewport to follow on other examples.

I now made the DX9 example code explicitly set (and supposedly restore) the viewport to follow on other 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#937
No description provided.