projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.30.tar.gz
[xscreensaver]
/
hacks
/
glx
/
circuit.c
diff --git
a/hacks/glx/circuit.c
b/hacks/glx/circuit.c
index b7a0c256c9734b3c51a1e9bb36b238aa83324ab1..e3580eeb93f706fff4fa9af00b6fcd63330c68c7 100644
(file)
--- a/
hacks/glx/circuit.c
+++ b/
hacks/glx/circuit.c
@@
-423,7
+423,6
@@
static int createCylinder (Circuit *ci,
int a; /* current angle around cylinder */
int angle, norm;
float z1, y1, z2, y2,ex;
int a; /* current angle around cylinder */
int angle, norm;
float z1, y1, z2, y2,ex;
- int step;
int nsegs;
glPushMatrix();
int nsegs;
glPushMatrix();
@@
-432,7
+431,6
@@
static int createCylinder (Circuit *ci,
if (nsegs % 2)
nsegs += 1;
angle = (half) ? (180 - 90/nsegs) : 374;
if (nsegs % 2)
nsegs += 1;
angle = (half) ? (180 - 90/nsegs) : 374;
- step = angle/nsegs;
z1 = radius; y1 = 0;
glBegin(GL_QUADS);
for (a = 0 ; a <= angle ; a+= angle/nsegs) {
z1 = radius; y1 = 0;
glBegin(GL_QUADS);
for (a = 0 ; a <= angle ; a+= angle/nsegs) {
@@
-1859,7
+1857,7
@@
static void makebandlist(Circuit *ci)
GLfloat shine = 40;
for (i = 0 ; i < 12 ; i++) {
GLfloat shine = 40;
for (i = 0 ; i < 12 ; i++) {
- ci->band_list[i] = glGenLists(
i
);
+ ci->band_list[i] = glGenLists(
1
);
glNewList(ci->band_list[i], GL_COMPILE);
col[0] = colorcodes[i][0];
col[1] = colorcodes[i][1];
glNewList(ci->band_list[i], GL_COMPILE);
col[0] = colorcodes[i][0];
col[1] = colorcodes[i][1];
@@
-1880,7
+1878,6
@@
static int bandedCylinder(Circuit *ci,
{
int polys = 0;
int n; /* band number */
{
int polys = 0;
int n; /* band number */
- int p = 0; /* prev number + 1; */
GLfloat col[] = {0,0,0,0};
col[0] = r; col[1] = g; col[2] = bl;
GLfloat col[] = {0,0,0,0};
col[0] = r; col[1] = g; col[2] = bl;
@@
-1893,7
+1890,6
@@
static int bandedCylinder(Circuit *ci,
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, col);
polys += createCylinder(ci, b[n]->len*l, radius*1.05, 0, 0); /* band */
glPopMatrix();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, col);
polys += createCylinder(ci, b[n]->len*l, radius*1.05, 0, 0); /* band */
glPopMatrix();
- p = n+1;
}
return polys;
}
}
return polys;
}
@@
-2022,6
+2018,7
@@
static void display(ModeInfo *mi)
glEnable(GL_LIGHTING);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glEnable(GL_LIGHTING);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
+ /* glRotatef(current_device_rotation(), 0, 0, 1); */
gluLookAt(ci->viewer[0], ci->viewer[1], ci->viewer[2],
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
gluLookAt(ci->viewer[0], ci->viewer[1], ci->viewer[2],
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
@@
-2073,11
+2070,11
@@
static TexNum * fonttexturealloc (ModeInfo *mi,
const char *str, float *fg, float *bg)
{
Circuit *ci = &circuit[MI_SCREEN(mi)];
const char *str, float *fg, float *bg)
{
Circuit *ci = &circuit[MI_SCREEN(mi)];
- int i
, status
;
+ int i;
XImage *ximage;
char *c;
TexNum *t;
XImage *ximage;
char *c;
TexNum *t;
-
+ GLuint mintex;
if (ci->font_init == 0) {
for (i = 0 ; i < 50 ; i++) {
ci->font_strings[i] = NULL;
if (ci->font_init == 0) {
for (i = 0 ; i < 50 ; i++) {
ci->font_strings[i] = NULL;
@@
-2105,7
+2102,8
@@
static TexNum * fonttexturealloc (ModeInfo *mi,
mi->xgwa.visual,
font, str,
fg, bg);
mi->xgwa.visual,
font, str,
fg, bg);
- for (i = 0 ; ci->font_strings[i] != NULL ; i++) { /* set i to the next unused value */
+ glGenTextures (1, &mintex);
+ for (i = mintex ; ci->font_strings[i] != NULL ; i++) { /* set i to the next unused value */
if (i > 49) {
fprintf(stderr, "Texture cache full!\n");
free(ximage->data);
if (i > 49) {
fprintf(stderr, "Texture cache full!\n");
free(ximage->data);
@@
-2121,17
+2119,24
@@
static TexNum * fonttexturealloc (ModeInfo *mi,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
clear_gl_error();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
clear_gl_error();
- status = gluBuild2DMipmaps(GL_TEXTURE_2D, 4, ximage->width, ximage->height,
- GL_RGBA, GL_UNSIGNED_BYTE, ximage->data);
- if (status)
+#if 0
+ i = gluBuild2DMipmaps(GL_TEXTURE_2D, 4,
+ ximage->width, ximage->height,
+ GL_RGBA, GL_UNSIGNED_BYTE, ximage->data);
+ if (i)
{
{
- const char *s = (char *) gluErrorString (
status
);
+ const char *s = (char *) gluErrorString (
i
);
fprintf (stderr, "%s: error mipmapping %dx%d texture: %s\n",
progname, ximage->width, ximage->height,
(s ? s : "(unknown)"));
fprintf (stderr, "%s: error mipmapping %dx%d texture: %s\n",
progname, ximage->width, ximage->height,
(s ? s : "(unknown)"));
-
exit (1
);
+
abort(
);
}
check_gl_error("mipmapping");
}
check_gl_error("mipmapping");
+#else
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, ximage->width, ximage->height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, ximage->data);
+ check_gl_error("texture");
+#endif
t = malloc(sizeof(TexNum));
t->w = ximage->width;
t = malloc(sizeof(TexNum));
t->w = ximage->width;
@@
-2235,7
+2240,6
@@
Circuit *ci;
}
if (uselight == 0)
ci->light = 1;
}
if (uselight == 0)
ci->light = 1;
- glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_SMOOTH);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glEnable(GL_DEPTH_TEST);