Closed riegaz closed 6 years ago
Do you use OpenGL.Net.Objects via nuget? If so, remove nuget package, and compile the OpenGL.Net.Objects from the current master.
Thanks, that did the job!
I'd like to note that you are constructing a new GL context, while the WinForms control already creates it.
You're actually sharing resources with wglShareLists
with the GL control.
If you didn't intend this behavior, use the other constructor that simply wrap the GL context handle.
I can't find the other constructor that takes the GL context only. How is it called?
Sorry, my fault for not recognizing e.RenderContext type: you're calling the right override. Cheers.
Thanks!
I'm running into a problem here:
protected override KeyValuePair<SceneGraphSorter, List<SceneObjectBatch>>[] Split(List<SceneObjectBatch> objects)
The object's property Program is null for me which leads to an exception while this is executed:
if (programLists.TryGetValue(objectBatch.Program, out programList))
Am I doing something wrong?
When Program is null, it means that your drawing using the fixed pipeline, which is quite odd nowadays.
Never tried using fixed pipeline, indeed I need to setup a special key value for sorting objectsnusing the fixed pipeline (good catch).
Assign a shader program to your geometry, or disable state sorting when defining the scene graph.
I just tried to run the HelloObjects example within WPF. I just copied the code. Now I removed state sorting. Now I run into another problem.
System.MissingMethodException: 'Method not found: 'Void OpenGL.Gl.BufferStorage(OpenGL.BufferTarget, UInt32, IntPtr, OpenGL.MapBufferUsageMask)'.' I tried to get OpenGL.NET via master instead of nuget but then I get an enumeration error in opengl.
Do you have any idea?
Enumeration error occurs when I try to run HelloObjects_net461 from the master as well.
I get a flawless executaion of HelloObjects on my machine. Can you put here some details about the exception?
I suggest to work exclusively on master,since current sources may be misaligned wrt the nuget compiled library.
Do you need further information?
Stack trace?
As I suspected.
The exception is user-handled, and you should continue debugging ignoring exceptions in that cases. I suggest to configure your debbugger to avoid breaks on user-handled exceptions (just to avoid annoying debugger breaks).
What's happening? Well, at initialization time, the library get all the implementation limits. So the GL driver has hard time to support all those GL limits. Most driver has at least one limit not supported, even if it should (as GL specification says).
Thanks for your detailed explanation. One more question, it is not related at all. I'm new to opengl and calling GL.Frustum with certain values raises an exception:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
For example:
Gl.Frustum(-5,5,-5,5,1,1000);
Could you explain why in just one sentence?
Read the first paragraph of https://github.com/luca-piccioni/OpenGL.Net/wiki/GL-%5C-Common-mistakes.
This issue is very specific to this project, since it merge in a single API desktop and mobile standard.
In one sentence: wrong overload. Use the one with double-precision floating-point arguments.
How to use OpenGL.Net.Objects in a WPF application?
I get an error when calling:
_Context = new GraphicsContext(e.DeviceContext, e.RenderContext);
e in the WPF example comes from GlControlEventArgs instead of GLSurfaceViewEventArgs.Calling
VertexArrays.CreateSphere(1f, 5, 5);
results in an exception:I would like to take advantage of the sphere and font objects.