NogginBops / ImGui.NET_OpenTK_Sample

A sample project showing an ImGui (using ImGui.NET) renderer for OpenTK in C#
106 stars 27 forks source link

imgui boxes disappearing or flickering when clicking on them #14

Open adamdeere opened 3 years ago

adamdeere commented 3 years ago

as in the description, when clicking on the boxes they seem to disappear. or flicker. or both. or the text goes blurry. theres no way of telling what is actually going on with openTK

NogginBops commented 3 years ago

Hi! Can you please include a screenshot of what you are seeing?

It would also be great to know more about what code you are running:

If possible it would be great if you where you share the code that you use for rendering outside the code included in this repo (if any).

adamdeere commented 3 years ago

adam deere has shared a OneDrive file with you. To view it, click the link below. https://1drv.ms/u/s!AoIMb5N6FsgKg4dUpmmE-V3tE2X1vA [https://r1.res.office365.com/owa/prem/images/dc-mpg_20.png]https://1drv.ms/u/s!AoIMb5N6FsgKg4dUpmmE-V3tE2X1vA OpenTK Window OpenGL Version 4.5.0 - Build 27.20.100.8783 2021-02-25 15-42-50.mp4https://1drv.ms/u/s!AoIMb5N6FsgKg4dUpmmE-V3tE2X1vA

Hi Julius

To answer your questions, im have downloaded a zip from the branch openTK4.0 (im assuming that its the main branch) and I have added no additional dependences or rendering code than what's already in the project. My gpu is a gtx 1060 with NVIDEA drivers. I have also attached a short video on what's going on. I can't seem to recreate any of the other errors (such as blurry text and background flickering that looks very much like Z fighting). Couldnt hazard a guess at where things might be going wrong (at least on my end) but going to have a play around now to see if I can get it working.


From: Julius Häger notifications@github.com Sent: 24 February 2021 04:19 To: NogginBops/ImGui.NET_OpenTK_Sample ImGui.NET_OpenTK_Sample@noreply.github.com Cc: adamdeere adam.deere@hotmail.com; Author author@noreply.github.com Subject: Re: [NogginBops/ImGui.NET_OpenTK_Sample] imgui boxes disappearing or flickering when clicking on them (#14)

Hi! Can you please include a screenshot of what you are seeing?

It would also be great to know more about what code you are running:

If possible it would be great if you where you share the code that you use for rendering outside the code included in this repo (if any).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/NogginBops/ImGui.NET_OpenTK_Sample/issues/14#issuecomment-784744568, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2T3JR6UZKEFUWVGKBKH3TAR447ANCNFSM4YDROAVA.

NogginBops commented 3 years ago

That's a weird issue. Are there any printouts to the console?

If you can I would appreciate if you could create a RenderDoc capture with two captures, one with the window showing and one with the window when it has disappeared.

You basically open the .exe file in RenderDoc and use F12 to take a capture. So if you could do that and upload it here I can probably diagnose this issue. Here is more info on how to make a capture: https://renderdoc.org/docs/how/how_capture_frame.html

adamdeere commented 3 years ago

its about to get a hell of a lot weirder

I have just tried to do the requested render docs but when I launch from RenderDoc it works as it should. There was a few z issues in the over lay menus but when I took a capture it worked. yet when I eun the project through either visual studio or directly opening up the .exe file im back to the original issue. The only print outs are the vertex changed things. As there is very little documentation of this, im a bit stuck on where the issue might actually be

Adam


From: Julius Häger notifications@github.com Sent: 25 February 2021 19:12 To: NogginBops/ImGui.NET_OpenTK_Sample ImGui.NET_OpenTK_Sample@noreply.github.com Cc: adamdeere adam.deere@hotmail.com; Author author@noreply.github.com Subject: Re: [NogginBops/ImGui.NET_OpenTK_Sample] imgui boxes disappearing or flickering when clicking on them (#14)

That's a weird issue. Are there any printouts to the console?

If you can I would appreciate if you could create a RenderDochttps://renderdoc.org capture with two captures, one with the window showing and one with the window when it has disappeared.

You basically open the .exe file in RenderDoc and use F12 to take a capture. So if you could do that and upload it here I can probably diagnose this issue. Here is more info on how to make a capture: https://renderdoc.org/docs/how/how_capture_frame.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/NogginBops/ImGui.NET_OpenTK_Sample/issues/14#issuecomment-786136598, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2T3MUGAMQCMB7IMMIAY3TA2OKDANCNFSM4YDROAVA.

NogginBops commented 3 years ago

I would still appreciate a renderdoc capture as it might be able to tell me something about the issue. If you could send me a capture taken with these settings I would greatly appreciate it. image

adamdeere commented 3 years ago

sorry im so late. been trying everything to see if i can solve the problem but without luck. When I have ported to a fresh project, the render docs say that the vertex shader isnt bound. Could it be something in the latest openTK and .Net 5.0 not playing nicely together?


From: Julius Häger notifications@github.com Sent: 25 February 2021 20:24 To: NogginBops/ImGui.NET_OpenTK_Sample ImGui.NET_OpenTK_Sample@noreply.github.com Cc: adamdeere adam.deere@hotmail.com; Author author@noreply.github.com Subject: Re: [NogginBops/ImGui.NET_OpenTK_Sample] imgui boxes disappearing or flickering when clicking on them (#14)

I would still appreciate a renderdoc capture as it might be able to tell me something about the issue. If you could send me a capture taken with these settings I would greatly appreciate it. [image]https://user-images.githubusercontent.com/3778357/109212425-cd2a0f80-77af-11eb-8edc-fb0af599b589.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/NogginBops/ImGui.NET_OpenTK_Sample/issues/14#issuecomment-786178789, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2T3JGCDKSCAKPWP7TV2DTA2WYTANCNFSM4YDROAVA.

NogginBops commented 3 years ago

No worries.

The no vertex shader error sounds suspicious. If you could send me that capture I could take a look. I'm pretty confident it will help me find the error.

adamdeere commented 3 years ago

Yeah. Confused the hell out of me. Have also been having a lot of trouble with my mouse crashing the app when entering the widows (memory access violation) could that have anything to do with it? Ill send you the capture when I get home from work later


From: Julius Häger notifications@github.com Sent: 26 February 2021 06:22 To: NogginBops/ImGui.NET_OpenTK_Sample ImGui.NET_OpenTK_Sample@noreply.github.com Cc: adamdeere adam.deere@hotmail.com; Author author@noreply.github.com Subject: Re: [NogginBops/ImGui.NET_OpenTK_Sample] imgui boxes disappearing or flickering when clicking on them (#14)

No worries.

The no vertex shader error sounds suspicious. If you could send me that capture I could take a look. I'm pretty confident it will help me find the error.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/NogginBops/ImGui.NET_OpenTK_Sample/issues/14#issuecomment-786440393, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2T3PW5PTP2CBRUPH4S53TA443TANCNFSM4YDROAVA.

adamdeere commented 3 years ago

im starting to think that this may be a problem on my machine. The code I ported was a direct lift from the project so maybe it has something to do with .net 5 or something. Maybe it has something to do with setting up VS to x86 or something. This one is really doing my head in as there are actually no glaringly obvious problems with any of the code in question


From: Julius Häger notifications@github.com Sent: 26 February 2021 06:22 To: NogginBops/ImGui.NET_OpenTK_Sample ImGui.NET_OpenTK_Sample@noreply.github.com Cc: adamdeere adam.deere@hotmail.com; Author author@noreply.github.com Subject: Re: [NogginBops/ImGui.NET_OpenTK_Sample] imgui boxes disappearing or flickering when clicking on them (#14)

No worries.

The no vertex shader error sounds suspicious. If you could send me that capture I could take a look. I'm pretty confident it will help me find the error.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/NogginBops/ImGui.NET_OpenTK_Sample/issues/14#issuecomment-786440393, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2T3PW5PTP2CBRUPH4S53TA443TANCNFSM4YDROAVA.

BarisUckardes commented 3 years ago

Suffering from this issue too, no solution yet ?

BarisUckardes commented 3 years ago

Here's my scenario, at first everything looks good.No flickering no disappearing.When i my mouse overlays an dropbox icon it starts to flicker.

+This is the screenshot before i hover my mouse onto dropbox of the ImGui.Begin() window. image

+This is the screenshot after i hovered my mouse onto dropbox of the ImGui.Begin() window image

if you look at the top left corner of the second screenshot you can see some triangle deforming thing(y).

Further details->

+I do not use GameWindow's own Update,Render overrides.Im annoyed by the idea of a window controls all my game loop so i abstracted my Window class, thus it means i dont use the value of FrameEventArgs.time to update ImGuiController.The custom delta time value is currently fixed to 1f/60f even though my engine editor gets 900fps(1f/900f). BUT i downloaded your opengl 4.0 branch and still having the same issue so it means it has nothing to do with my custom input time.

+Downloaded opengl 3.3 sample code of yours and it works out of the box as intended.

I will try to find out what's different in opengl 3.3 demo and work from there and i plan to update my journey here if thats okey ?

BarisUckardes commented 3 years ago

I managed to solve this issue on my side.

What i did is simply copying all method bodies inopengl 3.3 ImGuiController,Shader,Texture andUtil classes to opengl 4.0's ImGuiController,Shader,Texture andUtil method bodies.

However i excluded the SetKeyMappings because it seems OpenTK.Input uses whole new kind of enums for the Key so SetKeyMappings method body is still opengl 4.0.

Conclusion->

Now i can fully use ImGui.Net with OpenTK without a problem (so far). It seems problem caused byGL.NamedBufferData() and i dont intend to dwell on this matter because extra performance gain from GL.NamedBufferData is actually is trivial when it comes to UI,Editor and etc

HopingCoding commented 3 years ago

I have exactly the same issue as described here. However I can isolate it to happen only on the integrated Intel HD 530 GPU of my laptop. If I switch to the dedicated Nvidia GPU on the same laptop, there is no flickering whatsoever.

NogginBops commented 3 years ago

Yeah this is related to using glNamedBufferData on some intel cards. I've not looked much further into it as the opengl 3.3 branch fixes this issue. At some point I can look into why it's not working further, the solution is likely to stop using glNamedBufferData and just bind buffers and use glBufferData, but I would like to avoid that if possible.