Skip to content

Instantly share code, notes, and snippets.

@grpnpraveen
Created March 5, 2023 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grpnpraveen/3c12131ee80c1a6b65c760da83d1350b to your computer and use it in GitHub Desktop.
Save grpnpraveen/3c12131ee80c1a6b65c760da83d1350b to your computer and use it in GitHub Desktop.
Sample GL code
#include<GL/glew.h>
#include <GLFW/glfw3.h>
//for input and output
#include<iostream>
#include<stdlib.h>
#include<Windows.h>
#include<conio.h>
using namespace std;
#include<fstream>
#include<string>
#include<sstream>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "OpenGL", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
int x = 1;
while(x)
{
if (_kbhit())
{
switch (_getch())
{
case 's':
x = 0; // closes the window if 's' is pressed
break;
}
}
}
glfwTerminate();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment