OpenGL Learning Note one: Environment building

Source: Internet
Author: User

Recent projects are busy, so COCOS2DX's blog has not been updated. Feel good to degenerate say. Recently intends to learn OpenGL, here have done study notes, what is not right or ask all friends to correct out, greatly appreciated. I hope I can keep a blog updated every week .....


Don't say this, let's talk about OpenGL, say Direct3D is not very strong, why I want to learn OpenGL. Because I this person more heart, like cross-platform Dongdong. Portability that's a leverage, not like Direct3D can only play on Windows.


First, OpenGL official website http://www.opengl.org



I first say the environment, I use the compilation environment is vs2012, of course, those dev-c++/broland C + + Builder can also drip, about glut library, swollen say, red Book inside are recommended we use, then I must listen to AH

Download Address:

Http://www.opengl.org/resources/libraries/glut

If not, I also uploaded a Baidu network disk:

Link: http://pan.baidu.com/s/1dD1WDdn Password: 282k


Now let's configure glut for vs.

There'll be a lot of stuff after the decompression.

The first step: we first copy the glut.h to your inclusion directory, direct search gl.h can go into that folder

Second step: Copy the Glut.lib and glut32.lib to the static library, should be under the installation directory of D:\Program Files (x86) \microsoft Visual Studio 11.0\vc\lib

The third step: Finally, the Glut.dll and Glut32.dll copy to C:\Windows\System32 (note, this copy is activated once, otherwise invalid, as to how to activate, please own Baidu. But I like to copy directly to the project debug inside copy to others, hey.


Of course, you can directly in the vs2012 directly configure these paths, see my blog in Cocos2dx, configuration methods are the same


Well to here, glut even if it is done, we build a Win32 console project can be directly to the code, think is not still a little excited ah ...



Let's start by creating a project to see if the wood is successful.

#include <gl/glut.h>

void display ()
{
	glclear (gl_color_buffer_bit);
	GLRECTF (-1,-1, 1, 1);
	Glfinish ();
}

int main (int argc, char* argv[])
{
	glutinit (&ARGC, argv);
	Glutinitdisplaymode (Glut_rgb | Glut_single);
	Glutinitwindowposition (0, 0);
	Glutinitwindowsize (720);
	Glutcreatewindow ("This should be the title bar");
	Glutdisplayfunc (&display);
	Glutmainloop ();
	return 0;
}

First do not explain the role of this code, to see if there is a problem with wood, if you appear such interface, congratulations, Wood has a problem, the environment to build a successful



We study note two to see the meaning of this code ....





Accumulate a little every day, and someday you'll be a great God.

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.