ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Using OpenGL with VB.NET
Subject:   Forms
Date:   2003-05-07 03:17:34
From:   anonymous2
Response to: Traps

Sure, you can create 2 Forms but you must be very carefull that the actual OpenGL calls are being done on the thread of the form with the OpenGL view. To do this follow the following procedures:


1. create functions on the view window that do the OpenGL calls


2. instead of calling these functions DIRECTLY from within the control window you should use the Invoke function from the view windows. (Look in the MSDN-help on Form.Invoke) This way the view form's thread will call the function!


Just a remark: I'm not to keen about scattering OpenGL functions thoughout my application. I prefer the Model-View-Controller design pattern. So I created a Renderer class that is called by the view window which does all the OpenGL work based upon data that describes the state of the models I want to show. The control window just changes that state. I really prefer OO programming AND design...


Hope this helps.


Regards,


Erno