Loading of a OFF ASCII file
Only supports triangles Not textured yet Supports scaling and rotation of the model
This commit is contained in:
parent
82f359b656
commit
9e1b72476c
9 changed files with 31419 additions and 4 deletions
11
src/main.cpp
11
src/main.cpp
|
@ -2,11 +2,13 @@
|
|||
#include "GL/gl.h"
|
||||
|
||||
#include "displayers.h"
|
||||
#include "Texture.h"
|
||||
#include "DataHandling/Texture.h"
|
||||
#include "DataHandling/Model3D.h"
|
||||
|
||||
|
||||
volatile unsigned long long int timer_ticks = 0;
|
||||
static Texture tree_texture;
|
||||
static Model3D raptor;
|
||||
|
||||
void display()
|
||||
{
|
||||
|
@ -31,6 +33,8 @@ void display()
|
|||
|
||||
display_tree(0,-5,0,3,5,tree_texture);
|
||||
|
||||
raptor.draw_model();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
@ -67,9 +71,14 @@ int main(int argc, char** argv)
|
|||
// Load and generate tree texture
|
||||
tree_texture.load_rgba_tga("resources/arbre.tga","resources/arbre_masque.tga");
|
||||
glGenTextures(1,tree_texture.opengl_id);
|
||||
// TODO : Put in the Texture class
|
||||
glBindTexture(GL_TEXTURE_2D,tree_texture.opengl_id[0]);
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA8,tree_texture.width,tree_texture.height,GL_RGBA,GL_UNSIGNED_BYTE,tree_texture.image_data);
|
||||
|
||||
raptor.load_ascii_off_file("resources/RAPTOR.off");
|
||||
raptor.set_scaling(0.01,0.01,0.01);
|
||||
raptor.set_rotation(-90,1,0,0);
|
||||
|
||||
glViewport(0,0,glutGet(GLUT_WINDOW_WIDTH),glutGet(GLUT_WINDOW_HEIGHT));
|
||||
|
||||
glutIdleFunc(display);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue