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.38.tar.gz
[xscreensaver]
/
hacks
/
glx
/
extrusion.c
diff --git
a/hacks/glx/extrusion.c
b/hacks/glx/extrusion.c
index 7e98f5e3bf924524049e5cf24b065702a6081a73..b175ee4dec5e64ceeac91d2a0b525792d9a25bb3 100644
(file)
--- a/
hacks/glx/extrusion.c
+++ b/
hacks/glx/extrusion.c
@@
-31,7
+31,7
@@
"*showFPS: False \n" \
"*wireframe: False \n"
"*showFPS: False \n" \
"*wireframe: False \n"
-# define
refresh
_extrusion 0
+# define
free
_extrusion 0
# define release_extrusion 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# define release_extrusion 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
@@
-116,7
+116,7
@@
ENTRYPOINT ModeSpecOpt extrusion_opts = {countof(opts), opts, countof(vars), var
#ifdef USE_MODULES
ModStruct extrusion_description =
#ifdef USE_MODULES
ModStruct extrusion_description =
-{"extrusion", "init_extrusion", "draw_extrusion",
"release_extrusion"
,
+{"extrusion", "init_extrusion", "draw_extrusion",
NULL
,
"draw_extrusion", "init_extrusion", NULL, &extrusion_opts,
1000, 1, 2, 1, 4, 1.0, "",
"OpenGL extrusion", 0, NULL};
"draw_extrusion", "init_extrusion", NULL, &extrusion_opts,
1000, 1, 2, 1, 4, 1.0, "",
"OpenGL extrusion", 0, NULL};
@@
-218,11
+218,16
@@
static void Create_Texture(ModeInfo *mi, const char *filename)
int format;
if ( !strncmp(filename, "BUILTIN", 7))
int format;
if ( !strncmp(filename, "BUILTIN", 7))
- image = Generate_Image(&width, &height, &format);
+ {
+ BUILTIN:
+ image = Generate_Image(&width, &height, &format);
+ }
else
{
XImage *ximage = xpm_file_to_ximage (MI_DISPLAY (mi), MI_VISUAL (mi),
MI_COLORMAP (mi), filename);
else
{
XImage *ximage = xpm_file_to_ximage (MI_DISPLAY (mi), MI_VISUAL (mi),
MI_COLORMAP (mi), filename);
+ if (!ximage)
+ goto BUILTIN;
image = (GLubyte *) ximage->data;
width = ximage->width;
height = ximage->height;
image = (GLubyte *) ximage->data;
width = ximage->width;
height = ximage->height;
@@
-285,7
+290,7
@@
init_rotation (ModeInfo *mi)
0.2,
0.005,
True);
0.2,
0.005,
True);
- gp->trackball = gltrackball_init ();
+ gp->trackball = gltrackball_init (
True
);
lastx = (random() % (int) (max_lastx - min_lastx)) + min_lastx;
lasty = (random() % (int) (max_lasty - min_lasty)) + min_lasty;
lastx = (random() % (int) (max_lastx - min_lastx)) + min_lastx;
lasty = (random() % (int) (max_lasty - min_lasty)) + min_lasty;
@@
-378,8
+383,15
@@
ENTRYPOINT void
reshape_extrusion (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
reshape_extrusion (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
+ int y = 0;
+
+ if (width > height * 5) { /* tiny window: show middle */
+ height = width * 9/16;
+ y = -height/2;
+ h = height / (GLfloat) width;
+ }
- glViewport (0,
0
, (GLint) width, (GLint) height);
+ glViewport (0,
y
, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@
-438,11
+450,14
@@
initializeGL(ModeInfo *mi, GLsizei width, GLsizei height)
glViewport( 0, 0, width, height );
glEnable(GL_DEPTH_TEST);
glViewport( 0, 0, width, height );
glEnable(GL_DEPTH_TEST);
- glClearColor(0,0,0,0);
glDisable (GL_CULL_FACE);
glLightModeli (GL_LIGHT_MODEL_TWO_SIDE, True);
glShadeModel(GL_SMOOTH);
glDisable (GL_CULL_FACE);
glLightModeli (GL_LIGHT_MODEL_TWO_SIDE, True);
glShadeModel(GL_SMOOTH);
+# ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */
+ MI_IS_WIREFRAME(mi) = 0;
+# endif
+
if (do_light)
SetupLight();
if (MI_IS_WIREFRAME(mi)) {
if (do_light)
SetupLight();
if (MI_IS_WIREFRAME(mi)) {
@@
-481,46
+496,34
@@
extrusion_handle_event (ModeInfo *mi, XEvent *event)
event->xbutton.button == Button6 ||
event->xbutton.button == Button7))
{
event->xbutton.button == Button6 ||
event->xbutton.button == Button7))
{
- gltrackball_mousewheel (gp->trackball, event->xbutton.button, 10,
- !!event->xbutton.state);
- return True;
}
else if (event->xany.type == ButtonPress && /* rotate with left button */
!event->xbutton.state) /* if no modifier keys */
{
}
else if (event->xany.type == ButtonPress && /* rotate with left button */
!event->xbutton.state) /* if no modifier keys */
{
- gp->button_down_p = True;
- gltrackball_start (gp->trackball,
- event->xbutton.x, event->xbutton.y,
- MI_WIDTH (mi), MI_HEIGHT (mi));
- return True;
}
else if (event->xany.type == ButtonPress) /* deform with other buttons */
{ /* or with modifier keys */
gp->button2_down_p = True;
}
else if (event->xany.type == ButtonPress) /* deform with other buttons */
{ /* or with modifier keys */
gp->button2_down_p = True;
- gp->mouse_start_x = gp->mouse_x = event->xbutton.x;
- gp->mouse_start_y = gp->mouse_y = event->xbutton.y;
- return True;
}
else if (event->xany.type == ButtonRelease)
{
gp->button_down_p = False;
gp->button2_down_p = False;
}
else if (event->xany.type == ButtonRelease)
{
gp->button_down_p = False;
gp->button2_down_p = False;
- return True;
}
else if (event->xany.type == MotionNotify)
{
}
else if (event->xany.type == MotionNotify)
{
- if (gp->button_down_p)
- gltrackball_track (gp->trackball,
- event->xmotion.x, event->xmotion.y,
- MI_WIDTH (mi), MI_HEIGHT (mi));
if (gp->button2_down_p)
{
gp->mouse_x = event->xmotion.x;
gp->mouse_y = event->xmotion.y;
}
if (gp->button2_down_p)
{
gp->mouse_x = event->xmotion.x;
gp->mouse_y = event->xmotion.y;
}
- return True;
}
}
+ if (gltrackball_event_handler (event, gp->trackball,
+ MI_WIDTH (mi), MI_HEIGHT (mi),
+ &gp->button_down_p))
+ return True;
+
return False;
}
return False;
}
@@
-534,11
+537,7
@@
init_extrusion (ModeInfo * mi)
if (MI_IS_WIREFRAME(mi)) do_light = 0;
if (MI_IS_WIREFRAME(mi)) do_light = 0;
- if (Extrusion == NULL) {
- if ((Extrusion = (extrusionstruct *)
- calloc(MI_NUM_SCREENS(mi), sizeof (extrusionstruct))) == NULL)
- return;
- }
+ MI_INIT(mi, Extrusion);
gp = &Extrusion[screen];
gp->window = MI_WINDOW(mi);
gp = &Extrusion[screen];
gp->window = MI_WINDOW(mi);