For this tutorial, refer to "OpenGL getting started tutorial".
Use the development environment vc6.0. The following files are required for OpenGL development:
Gl. h Glu. h Glaux. h
Opengl32.lib glu32.lib Glaux. Lib
Opengl32.dll glu32.dll
The above files are installed in vc6.0 and have been installed in the system. The 3 *. H files are stored in c: \ Program Files \ Microsoft Visual Studio \ vc98 \ include \ GL.
In the c: \ Program Files \ Microsoft Visual Studio \ vc98 \ lib directory, the two DLL files are stored in
C: \ windows \ system32 directory. The above directory is the default installation path when installing the software.
Installation path, and you can find the corresponding file in the corresponding directory.
If you are using vs2008 without adding a description file, you can download the file here, and extract the files from msopengl.exe.
To find the corresponding download. Here is a reference.
After the http://download.csdn.net/detail/zhuce0001/5606249 download is complete, you need to extract the above file and put it in the corresponding directory.
(Note: The above statement is a bit incorrect. OpenGL is also provided in vs2008. There are only six of the eight files mentioned above, and Glaux. h and Glaux. Lib are missing,
The paths of the six files are as follows:
Gl. h Glu. h c: \ Program Files \ microsoft sdks \ windows \ v6.0a \ include \ GL
Glu32.lib opengl32.lib c: \ Program Files \ microsoft sdks \ windows \ v6.0a \ Lib
Glu32.dll opengl32.dll c: \ windows \ system32
)
In addition, you can also use glut for OpenGL development. For convenience of development, glut is used here.
The configuration method is as follows: Download the glut package from the Internet. You can search for "gludlls37beta" on Baidu or search for glut in the above section.
Decompress the package to obtain the following files and place them in the corresponding directory.
Place glut. h In c: \ Program Files \ Microsoft Visual Studio \ vc98 \ include \ GL
Place glut. Lib in c: \ Program Files \ Microsoft Visual Studio \ vc98 \ Lib
Place glut. dll glu32.dll to c: \ windows \ system32
So far, the environment has been set up (if you are using vs2003/2005/2008, please find a method to set up the environment on the internet). Below is
The test environment is successfully set up. Create a console in VCProgram,CodeAs follows:
// The GL program must contain <Gl/GL. h> and <Gl/Glu. h>, but <Gl/glut> already exists. # include <Gl/glut. h> // The function starting with GL is the standard OpenGL function void mydisplay (void) {// clear the color glclear (gl_color_buffer_bit); // draw a rectangle, the parameters are the coordinates in the upper left corner and the lower right corner. glrectf (-0.5f,-0.5f, 0.5f, and 0.5f); // refresh the buffer and display glflush () immediately ();} // All functions starting with glut are the int main (INT argc, char * argv []) functions provided by the glut toolkit {// glut initialization, fixed format, as you can see, you can copy it to the map (& argc, argv); // display mode: Use the RGB color (and the Map Index, use the index color) // single buffer (and the map double, double buffer) gluinitdisplaymode (glu_rgb | glu_single); // The Position of the upper-left corner of the window (100,100); // The window size is gluinitwindowsize (400,400); // create a window. The parameter is the title of the window, after being created, you must call the glumainloop function to display the glucreatewindow ("first OpenGL program"); // callback function, that is, the glut calls the function to which the parameter points to plot the fig (mydisplay ); // message loop ();}