Game Development Reference
In-Depth Information
Figure 5.3
Choose Toolbox Items dialog.
If you press the green play button now an error will appear that says ''No device
or rendering context available.'' This is because the OpenGL control hasn't been
initialized yet.
Open the form in code view and add the following line.
public Form1()
{
InitializeComponent();
simpleOpenGlControl1.InitializeContexts();
}
Run the program and a form will be created with a black screen. That's OpenGL
working with C#—congratulations! The variable _openGLControl reads bet-
ter than simpleOpenGlControl1 ; the refactor tools can be used to rename it.
Full Screen Mode
Most games allow the player to play the game full screen. This is an easy option
to add. Here's the code.
bool _fullscreen ¼ true;
public Form1()
 
Search WWH ::




Custom Search