Private void the draw () {
GL. The Begin (BeginMode. LineStrip);
GL. Vertex2 (10, r.N ext (200));
GL. Vertex2 (30, r.N ext (200));
GL. Vertex2 (40, r.N ext (200));
GL. Vertex2 (50, r.N ext (200));
GL. End ()
GL. Flush ();
GlControl1. SwapBuffers ();
GlControl1. Invalidate ();
}
Private void button1_Click (object sender, EventArgs e) {
Thread t=new Thread (draw);
t.start();
}
The results, and can't draw images, please grant instruction how to achieve what I want?
Before the program I use GDI + implements a plot pattern:
Public void dispatchTask () {
While (true) {
Int [] datas=getData ();
The UI. The BeginInvoke (datas);//asynchronous UI rendering
FIO. The BeginInvoke (datas);//asynchronous output to a file
Thread.sleep(200);
}
}
The UI now want to switch to OpenGL implementation, but there is a problem, consult everybody
CodePudding user response:
Opengl drawing can only be carried out in the main thread, you can put the data processing, information processing etc. On the other thread