How to Configure openGL in windows

Yashkatara
3 min readAug 18, 2021

--

First of all download a C/C++ Compiler, I am proceeding with Dev-C++

Link : https://sourceforge.net/projects/orwelldevcpp/

Now download freeglut library

Link : https://www.transmissionzero.co.uk/software/freeglut-devel/

Download the freeglut 3.0.0 MiniGW package

Now install dev c compiler

Wait for it to finish

Now open the installed directory of dev c and downloaded library folder side by side

Now copy one by one all the files corresponding freeglut/include/gl to include gl

left one is downloaded directory

and right one is installed directory of dev c

Now same for bin and lib folder

copy paste the .dll file into the C:/windows/system32 directory

Configuration is completed now.

Now open dev

create new project that is console type and paste the program code

For eg

#include<GL/glut.h>

/*void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 200.0, 0.0, 150.0);
}*/

void linesegment(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor4f(1, 1, 0, 0);
glBegin(GL_TRIANGLES);
glVertex2f(0.5, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.5, -0.5);

glEnd();
glFlush();
}

void main(int argc, char **argv)
{
glutInit(&argc, argv); // initialization OpenGL toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);// set display mode
glutInitWindowPosition(50, 100); // set top left window position
glutInitWindowSize(400, 300); // set display window width and height
glutCreateWindow(“An Example OpenGL Program”);//create display window
// init(); // execute inialization procedure
glutDisplayFunc(linesegment); //send graphics to display window
glutMainLoop(); // display everything and wait
// return 0; /* ANSI C requires main to return int. */
}

//Thanks to Prashant Rawat Sir for the Code

IMPORTANT STEP: Now open the project options in upper tab before running the code

click on parameters tab

now add following linker/loader

Now compile and run the program

THANKYOU FOR READING !!

HAVE A NICE DAY

OPENGL CONFIGURED

--

--

Yashkatara
Yashkatara

Written by Yashkatara

CS Engineering Student | CyberSecurity

No responses yet