Flickering and No display, in the Intel HD Graphics
Flickering occurs in the Example program.
This is my environment ↓
Black flicker, After that nothing is displayed...
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.
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.
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
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
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);
@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.
Thank you everyone for the validation. But is there any idea to fix this problem...?
@BoyBaykiller Thanks a lot, it actually solves my problem. It's my code's bug. I will figure out more about debug output problems.
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.
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.
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.
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.