Hello GuyZ,
Welcome to _TERMINAL_CODERS_. Here I'm going to tell you how start OpenGL project in Visual Studio.
Step 1: Create a new project.
Step 2: Open NuGet Package Manager
Step 3: Search "Nupengl" in "Browse" Tab
Step 4: Install "Nupengl" for our project
Step 5: Create a C++ source file
Step 6: OpenGL Code to draw line.
Hope you understand the steps... :) Please share the post with your friends... Help us to grow...
Welcome to _TERMINAL_CODERS_. Here I'm going to tell you how start OpenGL project in Visual Studio.
Step 1: Create a new project.
Step 2: Open NuGet Package Manager
Step 3: Search "Nupengl" in "Browse" Tab
Step 4: Install "Nupengl" for our project
Step 5: Create a C++ source file
Step 6: OpenGL Code to draw line.
#include <gl/glut.h>
#include <Windows.h>
/*
Coded By (C) Ajith Kp (C) (R) _TERMINAL_CODERS_ (R)
*/
void line() {
glColor3f(1.0, 0.0, 0.0);
glLineWidth(5.0);
glBegin(GL_LINES);
glVertex2d(50, 50);
glVertex2d(450, 450);
glEnd();
glFlush();
}
int main(int argc, char ** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("Line Draw OpenGL");
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
gluOrtho2D(0, 500, 0, 500);
glMatrixMode(GL_PROJECTION);
glViewport(0, 0, 500, 500);
glutDisplayFunc(line);
glutMainLoop();
return 0;
}
Hope you understand the steps... :) Please share the post with your friends... Help us to grow...





