-
Notifications
You must be signed in to change notification settings - Fork 0
/
silhouette.cpp
36 lines (30 loc) · 994 Bytes
/
silhouette.cpp
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
#include "sceneLoader.h"
HalfEdgeModel *hemModel;
GLSLProgram *SilhouetteProg;
GLuint dispID;
void LoadSilModel()
{
hemModel = new HalfEdgeModel( "./models/triceratops.hem", TYPE_HEM_FILE );
if (!hemModel->IsValid()) printf( "triceratops.hem not loaded!\n" );
dispID = hemModel->CreateOpenGLDisplayList(USE_LINES | WITH_ADJACENT_FACE_NORMS);
PathList path("./shaders/silhouetteShaders/");
SilhouetteProg = new GLSLProgram(true,&path);
SilhouetteProg->SetVertexShader("SilVert.glsl");
SilhouetteProg->SetGeometryShader("SilGeom.glsl");
SilhouetteProg->GeometryShaderSettings(GL_LINES,2,GL_LINE_STRIP);
SilhouetteProg->LinkProgram();
}
void DrawSilModel()
{
glPushMatrix();
glTranslatef( -2, -1.55, -4 );
SilhouetteProg->EnableShader();
GLuint Uniforms;
Uniforms=glGetUniformLocation(SilhouetteProg->GetProgramID(),"SilCol");
glUniform4f(Uniforms,1,1,1,1);
glLineWidth(5);
hemModel->CallList(USE_LINES);
glLineWidth(1);
SilhouetteProg->DisableShader();
glPopMatrix();
}