Wireframe channels in custom OpenGL displaymode


I’ve written a custom displaymode that renders and writes a buffer into the viewport through openGL. Everything works fine except the wireframe channels. The selection draws nicely on top of my buffer but as you can see in the video the wireframe is a bit confused. I’m assuming this is a problem with the camera depth frustum in rhino but I’m unsure how to set this.


Hi @oborgstrom,

Can you add some more detail to this? We’ll probably need to see some source code to assist.


– Dale

Hi @dale.

There is a thread here that follows my development a bit:

In short it is based on the RealtimeDisplayMode and uses the DrawOpenGl override to draw a GL texture into the active openGl context. A change queue is implemented to get camera data from Rhino to the renderer and all geometry is loaded through Grasshopper. But what you’re seeing in the video is geometry that also exist in Rhino so it should affect the camera frustum far/near.

Three things that I’m imagining could be wrong:

  • Rhino never updates the camera frustum far/near because it thinks that I’m drawing everything when using the DrawOpenGl.
  • There is something I have to call for Rhino to do this update.
  • I have to update some kind of depth texture in openGl to get the correct overlay of the channels.