Women in Technology

Hear us Roar



Article:
  Using OpenGL with VB.NET
Subject:   Traps
Date:   2003-05-06 20:28:59
From:   anonymous2
Response to: Traps

>all the WIndow Form Code must be called on the original (Form Creating) thread


is this why I can't create 2 forms in Sub Main(), one a docked GL viewport and the other a panel of controls for it? if so, any tips? I want to create an MDI app with one form class a fully-docked GL renderer of the data being manipulated in the other forms...?


Total GL newbie here, not too good with Forms and threading either but I'll learn and that's the idea here.


thanks!

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Forms
    2003-05-07 03:17:34  anonymous2 [View]

    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