Skip to content

Commit 0cde01c

Browse files
authored
Update README.md
Added instructions on how to setup opengl(freeglut) in visual studio
1 parent f646779 commit 0cde01c

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Setting up graphics.h in VS Code(C++)
33

4-
1. Download graphics header file. (https://drive.google.com/file/d/16xZBvFXf7yFjxwTpuyevK1KPuLgUeZFh/view)
4+
1. Download graphics header file from [here](https://drive.google.com/file/d/16xZBvFXf7yFjxwTpuyevK1KPuLgUeZFh/view)
55
2. Download and install tdm-gcc 32bit compiler.
66
3. Copy files from include and lib folder from graphics folder file you downloaded in step 1 to include and lib folder of tdm-gcc 32bit.
77
4. Open VS Code and create a new project folder and open C/C++ configuration.
@@ -98,6 +98,57 @@
9898
```
9999
100100
101+
#Setting up OpenGL(freeglut) in Visual Studio
102+
103+
1. Download free glew and glut from [here](http://www.mediafire.com/file/cmlnr0pj0pyha5d/Glew_and_Glut.zip/file)
104+
2. Extract the files in a folder you desire.(you need the folder so never delete it unless you donot want to do opengl anymore)
105+
3. Open Visual Studio and create a C++ solution/project.
106+
4. Go to the properties of your project.
107+
![image](https://user-images.githubusercontent.com/55276059/156544423-93256c2f-c779-41cb-a2e7-0793a4879032.png)
108+
5. Inside properties go to C/C++ and in additional include directories include the include folders from the files you dowloaded before.
109+
![image](https://user-images.githubusercontent.com/55276059/156544972-aa1594c0-e7db-455a-a654-04335f869573.png)
110+
6. Go to general of linker section and in additional library directories include the lib folders from the files you downloaded before.
111+
![image](https://user-images.githubusercontent.com/55276059/156545285-c22c1b0b-a163-4b36-857e-bafcabc938ff.png)
112+
7. In the input of linker section add following in additional dependencies.
113+
-freeglut.lib
114+
-glew32.lib
115+
![image](https://user-images.githubusercontent.com/55276059/156545541-ef37ab0a-5807-47d0-ba1b-a9041cf4d20e.png)
116+
8. Copy and paste following files you downloaded before in System32 folder.
117+
![image](https://user-images.githubusercontent.com/55276059/156545796-6eed6463-563d-486c-9da9-97553c3a387c.png)
118+
9. Now copy the code and build your project and run it, then you are good to go.
119+
```
120+
#include<Gl/glut.h>
121+
122+
void display() {
123+
124+
glClear(GL_COLOR_BUFFER_BIT);
125+
126+
glBegin(GL_POLYGON);
127+
glVertex3f(-0.6, -0.75, 0.5);
128+
glVertex3f(0.6, -0.75, 0);
129+
glVertex3f(0, 0.75, 0);
130+
131+
glEnd();
132+
133+
glFlush();
134+
}
135+
136+
int main(int argc, char** argv) {
137+
138+
glutInit(&argc, argv);
139+
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
140+
141+
142+
glutInitWindowPosition(80, 80);
143+
glutInitWindowSize(400, 300);
144+
glutCreateWindow("A Simple Triangle");
145+
146+
glutDisplayFunc(display);
147+
glutMainLoop();
148+
}
149+
```
150+
151+
101152
102153
103154

0 commit comments

Comments
 (0)