Preparation for OpenGL development in Windows

Source: Internet
Author: User
I was going to write some introductory and conceptual articles on OpenGL. Who knows that work is getting very busy at once, and people become lazy... but at last they have some free time on the Spring Festival holiday. Let's continue with the unfinished business. What is required for OpenGL development in Windows: If you use vs to develop OpenGL, first check whether there is a GL folder under VC/include/In the vs directory. If yes, you don't need anything. If you do not have this directory, you need to create it yourself and find GL from the Internet. H and Glu. h. Put the two header files in this directory and find GL at the same time. DLL, Glu. DLL files can be stored in Windows/system32/or in the same directory as the EXE files compiled by the project. In addition, if you want to simplify some function calls related to hardware and platform, you can find glut. h and glut. DLL to put them in the preceding two directories. Then, you can create a blank project in Vs and add VC/include/GL to the header file reference path. Copy the following code to draw a white square. Code 1 # include <glut. h>
2 void mydisplay (void)
3 {
4 glclear (gl_color_buffer_bit );
5 glcolor3f (1.0f, 1.0f, 1.0f );
6 glrectf (-0.5f,-0.5f, 0.5f, 0.5f );
7 glflush ();
8}
9 int main (INT argc, char * argv [])
10 {
11 gluinit (& argc, argv );
12 gluinitdisplaymode (glu_rgb | glu_single );
13 maid (100,100 );
14 gluinitwindowsize (500,500 );
15 fig ("sample ");
16 gludisplayfunc (& mydisplay );
17 glumainloop ();
18 return 0;
19}

 

Here, GL starts with the basic functions implemented by OpenGL, and glut starts with the function of the glut tool library. Function implementations starting with GL are platform-independent, while glut is implemented on different platforms. The functions of each function in the code will be explained in future articles.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.