B
B
bslovegood2020-11-30 12:52:27
OpenGL
bslovegood, 2020-11-30 12:52:27

C# How to work in windows forms with OpenGL?

I have a program (OpenGL draws a ship) which I wrote in the console application, but I needed to call it in WindowsForms by a button. For the program, I created a class, where everything used to be in Main, I wrote it into the constructor, and where the click of the button creates this class. The problem in general is that when I close the window that appears as a consequence of the class, it also closes the form. How can I make the form not close?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-11-30
@bslovegood

1. You can not write some code that is not responsible for initialization in the constructor.
2. https://www.nuget.org/packages/OpenTK.GLControl/
3. It is impossible to understand the reason for this behavior without code. Here, for example, I wrote the same thing as you described, but in the "written to the constructor" step, I wrote my code, which does not have your error => I have no problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question