Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Window.hpp>
- #include <SFML/OpenGL.hpp>
- #include <iostream>
- #include "chunk.h"
- void InitializeGL(){
- glClearDepth(1.0);
- glClearColor(0.6, 0.7, 0.8, 0.0); //COLOR OF SKY
- glEnable(GL_DEPTH_TEST);
- glDepthMask(GL_TRUE);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(90.0, 1.0, 1.0, 300.0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- int main()
- {
- sf::Window window(sf::VideoMode(800, 800), "OpenGL", sf::Style::Default, sf::ContextSettings(32,8,4,3,0));
- window.setVerticalSyncEnabled(true);
- window.setActive(true);
- InitializeGL();
- bool running = true;
- while (running)
- {
- sf::Event event;
- while (window.pollEvent(event))
- {
- if (event.type == sf::Event::Closed)
- {
- // end the program
- running = false;
- }
- else if (event.type == sf::Event::Resized)
- {
- glViewport(0, 0, event.size.width, event.size.height);
- }
- }
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(5, 3, 6, 0, 0, 0, 0, 1, 0);
- // draw...
- Chunk chunk1(0,0,0);
- chunk1.CreateMesh();
- // end the current frame (internally swaps the front and back buffers)
- window.display();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement