Skip to content

Commit

Permalink
move opengl functions to separate directories, lots of new templates
Browse files Browse the repository at this point in the history
  • Loading branch information
alecjacobson committed Jul 30, 2015
1 parent fd508ff commit 577624e
Show file tree
Hide file tree
Showing 176 changed files with 2,895 additions and 2,771 deletions.
6 changes: 3 additions & 3 deletions examples/Makefile.conf
Expand Up @@ -18,7 +18,7 @@ CFLAGS += -std=c++11
ifeq ($(UNAME), Linux)
DEFAULT_PREFIX=/usr/local/
else
DEFAULT_PREFIX=/opt/local/
DEFAULT_PREFIX=/usr/local/
# I guess arch only works in Mac OSX
AFLAGS+=-arch x86_64 -m64 -march=corei7-avx
endif
Expand Down Expand Up @@ -66,7 +66,7 @@ ifeq ($(IGL_USERNAME),ajx)
#AFLAGS = -m64 -march="corei7-avx"
# msse4.2 is necessary for me to get embree to compile correctly
AFLAGS=-m64 -msse4.2
OPENMP=-fopenmp
#OPENMP=-fopenmp
EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
#EIGEN3_INC=-I/Users/ajx/Documents/eigen -I/Users/ajx/Documents/eigen/unsupported
endif
Expand Down Expand Up @@ -246,7 +246,7 @@ endif

ifdef LIBIGL_USE_STATIC_LIBRARY
CFLAGS += -DIGL_STATIC_LIBRARY
LIBIGL_LIB=-L$(LIBIGL)/lib -ligl
LIBIGL_LIB=-L$(LIBIGL)/lib -ligl -liglopengl2 -liglopengl
endif

OPTFLAGS+=-O3 -DNDEBUG $(OPENMP)
16 changes: 8 additions & 8 deletions examples/ambient-occlusion/example.cpp
@@ -1,11 +1,11 @@
#include <igl/OpenGL_convenience.h>
#include <igl/opengl/OpenGL_convenience.h>
#include <igl/per_face_normals.h>
#include <igl/per_vertex_normals.h>
#include <igl/normalize_row_lengths.h>
#include <igl/draw_mesh.h>
#include <igl/draw_floor.h>
#include <igl/opengl2/draw_mesh.h>
#include <igl/opengl2/draw_floor.h>
#include <igl/quat_to_mat.h>
#include <igl/report_gl_error.h>
#include <igl/opengl/report_gl_error.h>
#include <igl/readOBJ.h>
#include <igl/readDMAT.h>
#include <igl/readOFF.h>
Expand Down Expand Up @@ -76,7 +76,7 @@ void reshape(int width,int height)
TwWindowSize(width, height);
}

// Set up projection and model view of scene
// Set up igl::opengl2::projection and model view of scene
void push_scene()
{
using namespace igl;
Expand Down Expand Up @@ -204,7 +204,7 @@ void display()
// Draw the model
// Set material properties
glEnable(GL_COLOR_MATERIAL);
draw_mesh(V,F,N,C);
igl::opengl2::draw_mesh(V,F,N,C);

pop_object();

Expand All @@ -215,12 +215,12 @@ void display()
glTranslated(0,floor_offset,0);
const float GREY[4] = {0.5,0.5,0.6,1.0};
const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
draw_floor(GREY,DARK_GREY);
igl::opengl2::draw_floor(GREY,DARK_GREY);
glPopMatrix();

pop_scene();

report_gl_error();
igl::opengl::report_gl_error();

TwDraw();
glutSwapBuffers();
Expand Down
1 change: 0 additions & 1 deletion examples/arap/Makefile
Expand Up @@ -2,7 +2,6 @@

# Shared flags etc.
include ../Makefile.conf
LIBIGL_LIB+=-liglsvd3x3

all: example

Expand Down
14 changes: 7 additions & 7 deletions examples/arap/example.cpp
@@ -1,12 +1,12 @@
#include <igl/Camera.h>
#include <igl/OpenGL_convenience.h>
#include <igl/opengl/OpenGL_convenience.h>
#include <igl/PI.h>
#include <igl/STR.h>
#include <igl/arap.h>
#include <igl/barycenter.h>
#include <igl/cotmatrix.h>
#include <igl/draw_floor.h>
#include <igl/draw_mesh.h>
#include <igl/opengl2/draw_floor.h>
#include <igl/opengl2/draw_mesh.h>
#include <igl/get_seconds.h>
#include <igl/harmonic.h>
#include <igl/invert_diag.h>
Expand All @@ -27,7 +27,7 @@
#include <igl/readOBJ.h>
#include <igl/readOFF.h>
#include <igl/readWRL.h>
#include <igl/report_gl_error.h>
#include <igl/opengl/report_gl_error.h>
#include <igl/snap_to_canonical_view_quat.h>
#include <igl/snap_to_fixed_up.h>
#include <igl/trackball.h>
Expand Down Expand Up @@ -420,7 +420,7 @@ void display()
//glMaterialf (GL_BACK, GL_SHININESS, 128);
glEnable(GL_COLOR_MATERIAL);

draw_mesh(U,F,N,C);
igl::opengl2::draw_mesh(U,F,N,C);
glDisable(GL_COLOR_MATERIAL);

pop_object();
Expand All @@ -435,12 +435,12 @@ void display()
//const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};

//draw_floor(GREY,DARK_GREY);
draw_floor();
igl::opengl2::draw_floor();
glPopMatrix();

pop_scene();

report_gl_error();
igl::opengl::report_gl_error();

TwDraw();
glutSwapBuffers();
Expand Down
32 changes: 16 additions & 16 deletions examples/beach-balls/BeachBall.cpp
@@ -1,11 +1,11 @@
#include "BeachBall.h"


#include <igl/draw_beach_ball.h>
#include <igl/opengl2/draw_beach_ball.h>
#include <igl/quat_to_mat.h>
#include <igl/unproject_to_zero_plane.h>
#include <igl/unproject.h>
#include <igl/project.h>
#include <igl/opengl2/unproject_to_zero_plane.h>
#include <igl/opengl2/unproject.h>
#include <igl/opengl2/project.h>
#include <igl/quat_mult.h>
#include <igl/quat_conjugate.h>
#include <igl/trackball.h>
Expand Down Expand Up @@ -76,7 +76,7 @@ void BeachBall::draw()
glPushMatrix();
glScaled(radius,radius,radius);
// draw oriented glyph
draw_beach_ball();
igl::opengl2::draw_beach_ball();
// Pop scale
glPopMatrix();
// Reset lighting
Expand All @@ -93,8 +93,8 @@ bool BeachBall::in(const int x,const int y) const
push();
// Now origin is center of object
double obj[3];
// Check if unprojected screen point is nearby
unproject_to_zero_plane(x,y, &obj[0], &obj[1], &obj[2]);
// Check if igl::opengl2::unprojected screen point is nearby
igl::opengl2::unproject_to_zero_plane(x,y, &obj[0], &obj[1], &obj[2]);
bool near = (obj[0]*obj[0] + obj[1]*obj[1] + obj[2]*obj[2])<radius*radius;
pop();
popmv();
Expand Down Expand Up @@ -136,7 +136,7 @@ bool BeachBall::drag(const int x,const int y)
pushmv();
push();
double origin[3];
project(0,0,0,&origin[0],&origin[1],&origin[2]);
igl::opengl2::project(0,0,0,&origin[0],&origin[1],&origin[2]);
pop();
popmv();
double rot[4];
Expand Down Expand Up @@ -193,20 +193,20 @@ bool BeachBall::drag(const int x,const int y)
}else
{
// We want that origin follows mouse move. First define plane we
// projecteing screen mouse movement to as perpendicular plan passing
// igl::opengl2::projecteing screen mouse movement to as perpendicular plan passing
// through this origin.
pushmv();
// down_t projected to screen to get depth value
// down_t igl::opengl2::projected to screen to get depth value
double p[3];
project(down_t[0],down_t[1],down_t[2],&p[0],&p[1],&p[2]);
// unprojected down_x,down_y with down_t depth
igl::opengl2::project(down_t[0],down_t[1],down_t[2],&p[0],&p[1],&p[2]);
// igl::opengl2::unprojected down_x,down_y with down_t depth
double du[3];
unproject(down_x,down_y,p[2],&du[0],&du[1],&du[2]);
// unprojected x,y with down_t depth
igl::opengl2::unproject(down_x,down_y,p[2],&du[0],&du[1],&du[2]);
// igl::opengl2::unprojected x,y with down_t depth
double u[3];
unproject(x,y,p[2],&u[0], &u[1], &u[2]);
igl::opengl2::unproject(x,y,p[2],&u[0], &u[1], &u[2]);
popmv();
// Then move this origin according to project mouse displacment
// Then move this origin according to igl::opengl2::project mouse displacment
t[0] = down_t[0] + (u[0]-du[0]);
t[1] = down_t[1] + (u[1]-du[1]);
t[2] = down_t[2] + (u[2]-du[2]);
Expand Down
4 changes: 2 additions & 2 deletions examples/beach-balls/example.cpp
@@ -1,7 +1,7 @@
#include "BeachBall.h"

#include <igl/quat_to_mat.h>
#include <igl/report_gl_error.h>
#include <igl/opengl/report_gl_error.h>
#include <igl/trackball.h>
#include <igl/canonical_quaternions.h>
#include <igl/PI.h>
Expand Down Expand Up @@ -135,7 +135,7 @@ void display()
// }
//}

report_gl_error();
igl::opengl::report_gl_error();
glutSwapBuffers();
glutPostRedisplay();

Expand Down
16 changes: 8 additions & 8 deletions examples/camera/example.cpp
Expand Up @@ -2,20 +2,20 @@
#include <igl/Viewport.h>
#include <igl/Camera.h>
#include <igl/matlab_format.h>
#include <igl/report_gl_error.h>
#include <igl/opengl/report_gl_error.h>
#include <igl/anttweakbar/ReAntTweakBar.h>
#include <igl/trackball.h>
#include <igl/two_axis_valuator_fixed_up.h>
#include <igl/PI.h>
#include <igl/EPS.h>
#include <igl/get_seconds.h>
#include <igl/material_colors.h>
#include <igl/draw_mesh.h>
#include <igl/opengl2/draw_mesh.h>
#include <igl/readOFF.h>
#include <igl/per_face_normals.h>
#include <igl/draw_floor.h>
#include <igl/project.h>
#include <igl/unproject.h>
#include <igl/opengl2/draw_floor.h>
#include <igl/opengl2/project.h>
#include <igl/opengl2/unproject.h>

#include <Eigen/Core>
#include <Eigen/Geometry>
Expand Down Expand Up @@ -354,7 +354,7 @@ void draw_scene(const igl::Camera & v_camera,
glMaterialfv(GL_BACK, GL_DIFFUSE, FAST_GREEN_DIFFUSE );
glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR);
glMaterialf (GL_BACK, GL_SHININESS, 128);
draw_mesh(V,F,N);
igl::opengl2::draw_mesh(V,F,N);
glDisable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
//glLineWidth(3.f);
Expand All @@ -365,7 +365,7 @@ void draw_scene(const igl::Camera & v_camera,
{
glPushMatrix();
glTranslated(0,-1,0);
draw_floor();
igl::opengl2::draw_floor();
glPopMatrix();
}

Expand All @@ -383,7 +383,7 @@ void draw_scene(const igl::Camera & v_camera,
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
report_gl_error();
igl::opengl::report_gl_error();

if(render_to_texture)
{
Expand Down
14 changes: 7 additions & 7 deletions examples/colored-mesh/example.cpp
@@ -1,12 +1,12 @@
#include <igl/OpenGL_convenience.h>
#include <igl/opengl/OpenGL_convenience.h>
#include <igl/per_face_normals.h>
#include <igl/per_vertex_normals.h>
#include <igl/two_axis_valuator_fixed_up.h>
#include <igl/normalize_row_lengths.h>
#include <igl/draw_mesh.h>
#include <igl/draw_floor.h>
#include <igl/opengl2/draw_mesh.h>
#include <igl/opengl2/draw_floor.h>
#include <igl/quat_to_mat.h>
#include <igl/report_gl_error.h>
#include <igl/opengl/report_gl_error.h>
#include <igl/readOBJ.h>
#include <igl/readDMAT.h>
#include <igl/readOFF.h>
Expand Down Expand Up @@ -258,7 +258,7 @@ void display()
// Draw the model
// Set material properties
glEnable(GL_COLOR_MATERIAL);
draw_mesh(V,F,N,C);
igl::opengl2::draw_mesh(V,F,N,C);

pop_object();

Expand All @@ -269,12 +269,12 @@ void display()
glTranslated(0,floor_offset,0);
const float GREY[4] = {0.5,0.5,0.6,1.0};
const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
draw_floor(GREY,DARK_GREY);
igl::opengl2::draw_floor(GREY,DARK_GREY);
glPopMatrix();

pop_scene();

report_gl_error();
igl::opengl::report_gl_error();

TwDraw();
glutSwapBuffers();
Expand Down
2 changes: 1 addition & 1 deletion examples/components/Makefile
Expand Up @@ -2,7 +2,7 @@

# Shared flags etc.
include ../Makefile.conf
LIBIGL_LIB+=-liglembree -liglboost
LIBIGL_LIB+=-liglembree

all: obj example

Expand Down

0 comments on commit 577624e

Please sign in to comment.