Skip to content

Instantly share code, notes, and snippets.

@Vbitz
Created February 9, 2012 03:28
Show Gist options
  • Select an option

  • Save Vbitz/1777025 to your computer and use it in GitHub Desktop.

Select an option

Save Vbitz/1777025 to your computer and use it in GitHub Desktop.
//
// main.cpp
// VoxalEditor
//
// Created by Vbitz on 9/02/12.
// Copyright (c) 2012 Vbitz. All rights reserved.
//
#include "stdheader.h"
#include "main.h"
Cube testingCube(0,0,0);
void ChangeSize(int w, int h)
{
openGL::glViewport(0, 0, w, h);
}
void RenderScene()
{
openGL::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
testingCube.Draw();
openGL::glBegin(GL_TRIANGLES);
openGL::glVertex3f(0, 0, 0);
openGL::glVertex3f(1, 0, 0);
openGL::glVertex3f(1, 1, 0);
openGL::glEnd();
openGL::glutSwapBuffers();
}
void SetupRC()
{
openGL::gluLookAt(5.0, 5.0, -5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
openGL::glClearColor(0.0, 0.0, 0.0, 1.0);
}
int main (int argc, char * argv[])
{
openGL::glutInit(&argc, argv);
openGL::glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
openGL::glutInitWindowSize(800, 600);
openGL::glutCreateWindow("Voxal Editor");
openGL::glutReshapeFunc(ChangeSize);
openGL::glutDisplayFunc(RenderScene);
SetupRC();
openGL::glutMainLoop();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment