1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#include "stdafx.h"
#include "SFML\OpenGL.hpp"
#include "Window.hpp"
#include "RenderBlock.hpp"
int Render::RenderBlock(double x, double y, double z, int Time){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glTranslatef(Time/-250, 50.f, -500.f);
//glRotatef(Time / 10, 1.f, 0.f, 0.f);
//glRotatef(Time / 30, 0.f, 1.f, 0.f);
//glRotatef(Time / 10, 0.f, 0.f, 1.f);
glBegin(GL_QUADS);
glRotatef(6, 1.f, 0.f, 0.f);
glColor3f(1.f, 0.f, 0.f);
glVertex3f((-50.f)+50*x, (-50.f)+50*y, (-50.f)+50*z);
glVertex3f((-50.f)+50*x, (50.f)+50*y, (-50.f)+50*z);
glVertex3f(( 50.f)+50*x, (50.f)+50*y, (-50.f)+50*z);
glVertex3f(( 50.f)+50*x, (-50.f)+50*y, (-50.f)+50*z);
glColor3f(1.f, 0.f, 0.f);
glVertex3f((-50.f)+50*x, (-50.f)+50*y, (50.f)+50*z);
glVertex3f((-50.f)+50*x, (50.f)+50*y, (50.f)+50*z);
glVertex3f(( 50.f)+50*x, (50.f)+50*y, (50.f)+50*z);
glVertex3f(( 50.f)+50*x, (-50.f)+50*y, (50.f)+50*z);
glColor3f(0.f, 1.f, 0.f);
glVertex3f((-50.f)+50*x, (-50.f)+50*y, (-50.f)+50*z);
glVertex3f((-50.f)+50*x, (50.f)+50*y, (-50.f)+50*z);
glVertex3f((-50.f)+50*x, (50.f)+50*y, (50.f)+50*z);
glVertex3f((-50.f)+50*x, (-50.f)+50*y, (50.f)+50*z);
glColor3f(0.f, 1.f, 0.f);
glVertex3f((50.f)+50*x, (-50.f)+50*y, (-50.f)+50*z);
glVertex3f((50.f)+50*x, (50.f)+50*y, (-50.f)+50*z);
glVertex3f((50.f)+50*x, (50.f)+50*y, (50.f)+50*z);
glVertex3f((50.f)+50*x, (-50.f)+50*y, (50.f)+50*z);
glColor3f(0.f, 0.f, 1.f);
glVertex3f((-50.f)+50*x, (-50.f)+50*y, (50.f)+50*z);
glVertex3f((-50.f)+50*x, (-50.f)+50*y, (-50.f)+50*z);
glVertex3f(( 50.f)+50*x, (-50.f)+50*y, (-50.f)+50*z);
glVertex3f(( 50.f)+50*x, (-50.f)+50*y, (50.f)+50*z);
glColor3f(0.f, 0.f, 1.f);
glVertex3f((-50.f)+50*x, (50.f)+50*y, (50.f)+50*z);
glVertex3f((-50.f)+50*x, (50.f)+50*y, (-50.f)+50*z);
glVertex3f(( 50.f)+50*x, (50.f)+50*y, (-50.f)+50*z);
glVertex3f(( 50.f)+50*x, (50.f)+50*y, (50.f)+50*z);
glEnd();
Render_Window.Display();
return 0;
}
int Render::GlPresets(){
// Set the color and depth clear values
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
return 0;
}
|