Search Projects

Thursday, December 31, 2015

How to setup OpenGL in CodeBlocks

SETTING UP OPENGL IN CODEBLOCK
First of all download and install the CodeBlock on your computer from the official website http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12mingw-setup-TDM-GCC-481.exe/download
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
http://www.mediafire.com/download/b4s0y548eobb5a0/codeblock_freeglut.rar

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

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

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
 P1Ccfreeglut.dll

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

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
 P1CCnotepad

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.
 p1CCglut32tofreeglut

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
 P1CCtemplatechange

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
 P1CCpath

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