-/* tronbit, Copyright (c) 2011 Jamie Zawinski <jwz@jwz.org>
+/* tronbit, Copyright (c) 2011-2012 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
int polys = 0;
GLfloat scale = sin (ratio * M_PI / 2);
GLfloat osize, nsize, small;
+ int wire = MI_IS_WIREFRAME(mi);
+
+ glShadeModel(GL_SMOOTH);
+
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_NORMALIZE);
+ glEnable(GL_CULL_FACE);
+
+ if (!wire)
+ {
+ glEnable(GL_LIGHTING);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ }
if ((omodel == BIT_IDLE1 || omodel == BIT_IDLE2) &&
(nmodel == BIT_IDLE1 || nmodel == BIT_IDLE2))
int overlays = 5;
int k;
- glPushAttrib (GL_TRANSFORM_BIT | /* for matrix contents */
- GL_ENABLE_BIT | /* for various glDisable calls */
- GL_CURRENT_BIT | /* for glColor3f() */
- GL_LIST_BIT); /* for glListBase() */
-
glDisable (GL_TEXTURE_2D);
glDisable (GL_LIGHTING);
glDisable (GL_BLEND);
glPushMatrix();
glLoadIdentity();
- gluOrtho2D (0, mi->xgwa.width, 0, mi->xgwa.height);
+ glRotatef(current_device_rotation(), 0, 0, 1);
+ glOrtho (0, mi->xgwa.width, 0, mi->xgwa.height, -1, 1);
for (k = 0; k < overlays; k++)
{
glMatrixMode(GL_PROJECTION);
glPopMatrix();
- glPopAttrib();
-
glMatrixMode(GL_MODELVIEW);
return polys;
init_bit (ModeInfo *mi)
{
bit_configuration *bp;
- int wire = MI_IS_WIREFRAME(mi);
int i;
if (!bps) {
reshape_bit (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
- if (!wire)
- {
- GLfloat pos[4] = {1.0, 1.0, 1.0, 0.0};
- GLfloat amb[4] = {0.0, 0.0, 0.0, 1.0};
- GLfloat dif[4] = {1.0, 1.0, 1.0, 1.0};
- GLfloat spc[4] = {0.0, 1.0, 1.0, 1.0};
-
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_CULL_FACE);
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glLightfv(GL_LIGHT0, GL_AMBIENT, amb);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, dif);
- glLightfv(GL_LIGHT0, GL_SPECULAR, spc);
- }
-
{
double spin_speed = 3.0;
double wander_speed = 0.03 * speed;
bit_configuration *bp = &bps[MI_SCREEN(mi)];
Display *dpy = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
+ int wire = MI_IS_WIREFRAME(mi);
if (!bp->glx_context)
return;
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
- glShadeModel(GL_SMOOTH);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_NORMALIZE);
- glEnable(GL_CULL_FACE);
+ if (!wire)
+ {
+ GLfloat pos[4] = {1.0, 1.0, 1.0, 0.0};
+ GLfloat amb[4] = {0.0, 0.0, 0.0, 1.0};
+ GLfloat dif[4] = {1.0, 1.0, 1.0, 1.0};
+ GLfloat spc[4] = {0.0, 1.0, 1.0, 1.0};
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ glLightfv(GL_LIGHT0, GL_POSITION, pos);
+ glLightfv(GL_LIGHT0, GL_AMBIENT, amb);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, dif);
+ glLightfv(GL_LIGHT0, GL_SPECULAR, spc);
+ }
glPushMatrix ();
+ glRotatef(current_device_rotation(), 0, 0, 1);
glScalef(1.1, 1.1, 1.1);
(y - 0.5) * 5,
(z - 0.5) * 3);
+ glRotatef(-current_device_rotation(), 0, 0, 1);
gltrackball_rotate (bp->trackball);
+ glRotatef(current_device_rotation(), 0, 0, 1);
get_rotation (bp->rot, &x, &y, &z, !bp->button_down_p);
glRotatef (x * 360, 1.0, 0.0, 0.0);
glScalef (6, 6, 6);
-
{
int nmodel = bp->history [bp->history_fp];
int omodel = bp->history [bp->history_fp > 0