#include <stdlib.h>
#include "stonerview.h"
-static GLfloat view_rotx = -45.0, view_roty = 0.0, view_rotz = 0.0;
+static GLfloat view_rotx = -45.0, view_roty = 0.0, view_rotz = 15.0;
static GLfloat view_scale = 4.0;
stonerview_state *
-init_view(int wireframe_p)
+stonerview_init_view(int wireframe_p, int transparent_p)
{
stonerview_state *st = (stonerview_state *) calloc (1, sizeof(*st));
st->wireframe = wireframe_p;
+ st->transparent = transparent_p;
st->num_els = NUM_ELS;
- st->elist = (elem_t *) calloc (st->num_els, sizeof(*st->elist));
+ st->elist = (stonerview_elem_t *) calloc (st->num_els, sizeof(*st->elist));
st->osctail = &st->oscroot;
/* for trackball, two-sided lighting and no face culling */
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+ glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_BLEND);
+
+ if (st->transparent)
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE);
+
return st;
}
/* callback: draw everything */
-void win_draw(stonerview_state *st)
+void
+stonerview_win_draw(stonerview_state *st)
{
int ix;
static const GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 };
glShadeModel(GL_FLAT);
for (ix=0; ix < st->num_els; ix++) {
- elem_t *el = &st->elist[ix];
+ stonerview_elem_t *el = &st->elist[ix];
glNormal3f(0.0, 0.0, 1.0);
glPopMatrix();
}
-void win_release(stonerview_state *st)
+void
+stonerview_win_release(stonerview_state *st)
{
free (st->elist);
/*free (st->oscroot); -- #### how do we free this? */