Saturday, August 14, 2021

Up Vector Solution

 



Stl reader utilising the up vector solution. Written using gtkmm libraries and egl in c++linux.

#define GL_GLEXT_PROTOTYPES


#include <Imath/ImathVec.h>
#include <math.h>
#include <gtkmm.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <EGL/egl.h>
#include <GL/gl.h>
#include <gdk/gdkx.h>

#include <GLFW/glfw3.h>
#include <GL/glu.h>       
#include <GL/glext.h>



Buffer object stores the stl file in a gl buffer.

class Buffer{
  public:
  
    Buffer(){};
Buffer(char* );
~Buffer();
void draw();
int scale;
int frame;
float* vertices;
int NUM_VERTICES;
float move_x;
float move_y;
float move_z;
char *file_name;
private:
GLuint bufferID;
float delta;
std::vector<triangle> facet;        // define a vector object (container) called "facet" of type "triangle"
     double x_min, x_max, delta_x;       // geometry extents along X
    double y_min, y_max, delta_y;       // geometry extents along Y
double z_min, z_max, delta_z;       // geometry extents along Z
float rotate_x = 0.0, drot_x = 0.0;
float rotate_y = 0.0, drot_y = 0.0;
float rotate_z = 0.0, drot_z = 0.0;
};