Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <GL/glew.h>
- #include <GL/freeglut.h>
- using namespace std;
- #define WINDOW_TITLE "Modern OpenGL"
- int WindowWidth = 800, WindowHeight = 600;
- void UInitialize(int, char*[]);
- void UInitWindow(int, char*[]);
- void UResizeWindow(int, int);
- void URenderGraphics(void);
- int main(int argc, char* argv[]){
- UInitialize(argc, argv);
- glutMainLoop();
- exit(EXIT_SUCCESS);
- }
- void UInitialize(int argc, char* argv[]){
- GLenum GlewInitResult;
- UInitWindow(argc, argv);
- GlewInitResult = glewInit();
- if (GLEW_OK != GlewInitResult){
- fprintf(stderr, "ERROR: %s\n", glewGetErrorString(GlewInitResult));
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "INFO: OpenGL Version: %s\n", glGetString(GL_VERSION));
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- }
- void UinitWindow(int argc, char* argv[]){
- glutInit(&argc, argv);
- glutInitWindowSize(WindowWidth, WindowHeight);
- glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
- glutCreateWindow(WINDOW_TITLE);
- glutReshapeFunc(UResizeWindow);
- glutDisplayFunc(URenderGraphics);
- }
- void UResizeWindow(int Width, int Height){
- glViewport(0, 0, Width, Height);
- }
- void URenderGraphics(void){
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glutSwapBuffers();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement