Search Projects

Thursday, December 31, 2015

How to setup OpenGL in CodeBlocks

First of all download and install the CodeBlock on your computer from the official website
After downloading this setup install it on the computer.
Now you have to configure it for the opengl development.
First of all download the freeglut libraries,headers,and system files from the link given below

After downloading this folder it should contain three folders like as shown

Now you have to copy these all three folders and paste it to the given path C:\Program Files (x86)\CodeBlocks\MinGW as shown

It will ask for the either replacing the existing files or not you have to select ok for merging the files with the same name.
Now 50% work here is done Now copy the dll file from the downloaded folder in the bin folder as shown

Paste the above dll file to the following path C:\Windows as shown

Now you have to change the configuration files because first they are set for the glut32 and now we have to change them to freeglut libraries
Open notepad with administrator previledges as shown

Go to File->Open and select the path as given C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\glut as shown P1CCwizardglut
Click on the script and press OK for changing the content inside the file and change the content glut32 to freeglut as shown. Find once more if glut32 is present or not if present then change that also to freeglut.

Again open an another file in the notepad open with administrator previledges.Go to the path Go to File->Open and select the path as given C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates and open the filenamed cbp and find the term “glut32” and replace it with “freeglut” after the final changes it should look like as shown

Now everything is done. Open CodeBlock and open a new Project and select GlutProject after giving it a project name press next now you have to give its path name as C:\Program Files (x86)\CodeBlocks\MinGW as shown

You will get a default opengl code now just press compile and run button that will give you following window as shown

No comments:

Post a Comment