How To Install Opengl Windows 10
Setting Upwardly OpenGL for Windows
OpenGL( Open Graphics Library) is a cantankerous-platform and cross-language Awarding Programming Interface (API) for rendering the graphics in the computer system. It covers wide range of dimensions from 2d-3D.
Writing the code and being artistic is one part, but it becomes so irritating and annoying when we cannot initially setup the OpenGL API in Windows OS. Linux system has simpler method for installing it with less than two lines of lawmaking or so.
In this tutorial, we will dissect the trouble of setting up the OpenGL in Windows Bone. For that we are using a command line interface for initial configuration and code blocks IDE for running the OpenGL plan.
So let'south get started!
1. Install and Setup MSYS
Head over to this link https://www.msys2.org/ and download the mysy2 installer. From there you can download the consummate programme.
2. Open MSYS2
Search for MSYS2 in search box and open it. You will get a Control Prompt-like UI as:
3. Install Pacman in the MSYS2
Hit the beneath command in your brand new MSYS2 CLI
$ pacman -Syu
iii. Install MinGW package via CLI
After Pacman is installed you volition be able to use Pacman manager to install the MinGW package easily with the control below
$ pacman -S mingw-w64-x86_64-toolchain
4. Install Freeglut
Striking the beneath command to install freeglut
$ pacman -Southward mingw-w64-x86_64-freeglut
five. Install Glew
Now install glew with the following command
$ pacman -S mingw-w64-x86_64-glew
6. Download Code Blocks
Here you take to be super careful on how to download the specific version of code blocks.
Since we have already set MinGW parcel we don't need code block with mingw setup so install unproblematic code block without mingw-setup as shown below :
Head over to this link http://www.codeblocks.org/downloads and download the binary release of code blocks as shown below:
7. Set up upwardly the compiler in Code Blocks
After you are done with the installation of the lawmaking blocks, we take to do some compiler configuration in it.
Click on Settings > Compiler > Global Compiler Settings
Nether Toolchain Executables Tab there is Compiler's Installation Directory
You have to replace that with the mingw64 which resides inside the msys64 in the Local Deejay C which is C:\msys64\mingw64 as shown in the below figure:
Afterward setting up the path in Toolchain executables now Click on the Linker Settings Tab. In the Right Portion, at that place is Other linker options where you have to add the post-obit command.
-lfreeglut -lglew32 -lopengl32
Later adding it, the tab looks like as :
All done. Now you lot tin can create a new project for creating your OpenGL program. But before that we have to get some footing idea to commencement a projection for OpenGL programme in code blocks.
8. Creating a OpenGL program
Click on File > New > Projection
Now a New From Template Tab pops out in which you have to select Console Application and Click Go every bit illustrated below:
Now a panel application tab pops out as
Click on Next.
At present there will be given an option for C and C++. Cull the language in which you lot are going to write the programme. For now we are choosing C++ language equally :
After selecting the language, click Side by side
Now give a project title and click on Next every bit
Finally click on Stop
Now our IDE starts and a sample Hello World Program is given under Sources > main.cpp file. Build and Run information technology and check the Setup runs successfully.
Cheque your OpenGL programs in the same file primary.cpp by replacing the howdy world program with the following sample lawmaking :
#include <GL/glut.h> void displayMe(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.v, 0.0, 0.0);
glVertex3f(0.5, 0.5, 0.0);
glVertex3f(0.0, 0.5, 0.0);
glEnd();
glFlush();
} int primary(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(300, 300);
glutInitWindowPosition(100, 100);
glutCreateWindow("SAMPLE Test");
glutDisplayFunc(displayMe);
glutMainLoop();
return 0;
}
After build and run you will go a pop up as :
Congrats! All set y'all are ready to go!
Source: https://medium.com/swlh/setting-opengl-for-windows-d0b45062caf
Posted by: cooperfaidle.blogspot.com
0 Response to "How To Install Opengl Windows 10"
Post a Comment