GLWpfControl icon indicating copy to clipboard operation
GLWpfControl copied to clipboard

Flickering and No display, in the Intel HD Graphics

Open tictac1234 opened this issue 3 years ago • 12 comments

Flickering occurs in the Example program.

This is my environment ↓ キャプチャ2

Black flicker, After that nothing is displayed... B

At first the graphics appear fine, but while resizing the window by dragging, there is a black flicker, After that it turns black and nothing appears. (I have not rewritten anything in the program.)

My image is that the buffer is running out of write space.

As long as you have time, I would appreciate your investigation. Thank you.

tictac1234 avatar May 30 '22 04:05 tictac1234

I had a similar issue. Only getting black screen in the control, but no flickering on resize. I have Intel UHD Graphics 620 and NVIDIA GeForce MX 130. I usually disable NVIDIA card to conserve battery power while I work. When I enabled the card it works fine. GameWindow (without using GLWpfControl) however works perfectly fine while my NVIDIA card is disabled.

lrjohn avatar Jul 22 '22 01:07 lrjohn

I have tested the example on many different graphics chips. I have found that it does not work (black screen) on: Intel HD Graphics 400 Intel HD Graphics 4400

I does however work on these: Intel HD Graphics 520 Intel HD Graphics 620

clbsoft avatar Jul 28 '22 18:07 clbsoft

I'm experiencing a similar issue. On Intel HD Graphics 620, some meshes are flickering very fast while it calms down when triggering some events (don't know if it is related) like clicking on the control, moving the camera with the mouse, etc. On Intel UHD Graphics 630, it starts with a black screen but comes back when resizing the window, the control starts blocking if no events are triggered but you can have a chance to get it back by clicking everywhere, the control is frozen when clicking and dragging. I tested the same program on both cards with an OpenTK GameWindow and it works fine.

NB : The WPF control works fine on a laptop GTX 1060

pjdevs avatar Aug 12 '22 14:08 pjdevs

Similar issue. When using Intel Xe graphics, the ExampleScene using OpenGL 2.1 is OK. However, once I switch to OpenGL 3.3+, the fragment shader seems useless. Also, when applying my own shaders (texture mapping), only getting black screen. NV card works fine.

My triangle code is as below, the color should be rgb(1.0f, 0.8f, 0.6f), but it shows white.

GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
float[] vertices = {
    -0.5f, -0.9f, 0.0f,
     0.5f, -0.5f, 0.0f,
     0.0f,  0.5f, 0.0f
};

int VAO = GL.GenVertexArray();
int VBO = GL.GenBuffer();

// VAO Binding
GL.BindVertexArray(VAO);

// VBO Binding & vertices to GPU Buffer
GL.BindBuffer(BufferTarget.ArrayBuffer, VBO);
GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * 9, vertices, BufferUsageHint.StaticDraw);

// VBO Binding & vertices to GPU Buffer
GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 3 * sizeof(float), 0);
GL.EnableVertexAttribArray(0);

// Vertex Shader
string vertexShaderSource = "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nvoid main()\n{\n    gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n}";
int vertexShader = GL.CreateShader(ShaderType.VertexShader);
GL.ShaderSource(vertexShader, vertexShaderSource);

// Fragment Shader
string fragmentShaderSource = "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n    FragColor = vec4(1.0f, 0.8f, 0.6f, 1.0f);\n} ";
int fragmentShader = GL.CreateShader(ShaderType.FragmentShader);
GL.ShaderSource(fragmentShader, fragmentShaderSource);

// Attach Shader to Program
int shaderProgram = GL.CreateProgram();
GL.AttachShader(shaderProgram, vertexShader);
GL.AttachShader(shaderProgram, fragmentShader);
GL.LinkProgram(shaderProgram);
GL.UseProgram(shaderProgram);

// Draw Triangle
GL.DrawArrays(PrimitiveType.Triangles, 0, 3);

// Clear Buffers
GL.DeleteVertexArray(VAO);
GL.DeleteBuffer(VBO);
GL.DeleteProgram(shaderProgram);
image

Sicheng-Wei avatar Dec 13 '22 14:12 Sicheng-Wei

@Sicheng-Wei You forgot to call glCompileShader after glShaderSource. There is a feature called OpenGL Debug Output which would have told you abot this error.

BoyBaykiller avatar Dec 17 '22 03:12 BoyBaykiller

Thank you everyone for the validation. But is there any idea to fix this problem...?

tictac1234 avatar Dec 17 '22 06:12 tictac1234

@BoyBaykiller Thanks a lot, it actually solves my problem. It's my code's bug. I will figure out more about debug output problems.

Sicheng-Wei avatar Dec 18 '22 20:12 Sicheng-Wei

I had a flickering issue when using OpenGL versions 3.2, 3.3 with different Intel graphics cards (Intel UHD, Intel Iris Plus, Intel Iris Xe). But with OpenGL 3.0 everything worked fine. I didn't even change the shader code, I just ran GlWpfControl with the new OpenGL version settings. Also everything is working when some not existing OpenGl official version is set, like v3.6. I suppose it's a graphics card driver issue.

IscanderAbdullah avatar Jun 22 '23 13:06 IscanderAbdullah

I'm also experiencing this issue with Intel UHD Graphics on my machine. I've tested this on a different machine with an RTX 3080 and the issue does not persist.

I think some further investigation is required.

mathew-odwyer avatar Apr 17 '24 06:04 mathew-odwyer

A bit of digging:

I updated my drivers, the issue still persisted. I ran the example project and rendering was fine. I then changed the ContextProfile from Core to Compatability - and it works for me.

mathew-odwyer avatar Apr 17 '24 07:04 mathew-odwyer

Interesting! The specification for NV_DX_interop does say "OpenGL 2.1 is required." so I guess that could be interpreted as a need for a compatibility context. My guess is that this is a intel driver limitation, maybe some flag or codepath in the driver isn't being taken when not in compatibility mode.

Maybe we should open an issue on the intel driver issue tracker to see if this is intentional.

NogginBops avatar Apr 17 '24 09:04 NogginBops