A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
create new visual studio c++ project named TestOpenGL. checked that under properties vcpkg:
- use vcpkg was enabled
- use vcpkg manifest was enabled
in the vs powershell terminal (be sure the working folder is the project folder):
> vcpkg integrate install
> vcpkg new --application
> vcpkg add port freeglut
then replace TestOpenGL.cpp text with:
#include <GL/freeglut.h>
void display() {
glClear(GL_COLOR_BUFFER_BIT); // Clear the window
// Draw a white triangle
glBegin(GL_TRIANGLES);
glVertex2f(0.0f, 0.5f);
glVertex2f(-0.5f, -0.5f);
glVertex2f(0.5f, -0.5f);
glEnd();
glFlush(); // Render now
}
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("FreeGLUT Triangle");
glutDisplayFunc(display); // Register the display callback
glutMainLoop(); // Enter the event loop
return 0;
}
then rebuild & run