Open burdoto opened 2 years ago
I have the exact same problem. It looks like none of gl.Draw ( <- Elements, Arrays etc) functions have any effect. I've already checked the VAOs, VBOs and textures. Tested using WPF, TargetFramework: net8.0-windows
I've also noticed that OpenGL generates InvalidOperation error before each draw call. Suppose this method is called each time OpenGLDraw event is raised for OpenGLControl.
private void DicomGLViewer_OpenGLDraw(object sender, OpenGLRoutedEventArgs args)
{
if (GL is not null) OpenGLHelpers.ThrowIfGLError(GL);
//while (gl.GetErrorCode() is not ErrorCode.NoError);
GL?.Clear(OpenGL.GL_COLOR_BUFFER_BIT);
glState?.DrawVertices(CurrentDepth);
}
And ThrowIfGLError looks like this:
public static class OpenGLHelpers
{
...
public static void ThrowIfGLError(OpenGL gl)
{
var error = gl.GetErrorCode();
switch (error)
{
case ErrorCode.NoError:
break;
case (var other):
throw new Exception(gl.GetErrorDescription(Convert.ToUInt32(other)));
}
}
}
It throws with 'Invalid Operation' OpenGL error So this error occurs before doing anything.
My opengl initialization (after OpenGLInitialized event) doesn't produce any errors, so this is quite strange.
Hello, I'm already sure I'm doing something stupidly wrong, but this is extremely frustrating since I cannot locate the issue.
Basically I'm trying to draw ANYTHING using this
Draw()
method:But I'm only ever getting a black screen (with the FPS counter working fine). I've tried comparing my code to this sample, but I really cannot find the problem.
As you can see from the code, I have already made desperate, frustrated attempts to draw large cirlces ANYWHERE, with no success whatsoever. What am I missing?