itaibh

Using OpenGL on Dynamic Layer in .Net (C#)

Discussion created by itaibh on Feb 20, 2012
Latest reply on Feb 20, 2012 by itaibh
I'm trying to draw elements using OpenGL when the dynamic layer is active (on the DrawDynamicLayer method). Using GLIntercept I could see that the OpenGL context is not initialized when that method is called, despite what the documentation says. It does get created at some point, but not right away.
What can I do to make sure it is initialized before I start drawing anything?

The issue I'm really trying to solve is an AccessViolationException that sometimes occurs when I try to draw polylines using the code below. It usually happens when I've zoomed in too much, but not to anything unacceptable. It also occurs if I try to manually clip the polygon before drawing it so all points fit roughly in the screen limits (i.e. no point is too far).

The polyline drawing code:
GL.glBegin(GL.GL_LINE_STRIP);
foreach (tagPOINT p in points)
    GL.glVertex2f(p.x, p.y);
GL.glEnd();


That made me use GLIntercept to see the data being passed to OpenGL, and GLIntercept showed me that the context is not initialized. So, any ideas about each of the problems?

Outcomes