projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver]
/
hacks
/
glx
/
mirrorblob.c
diff --git
a/hacks/glx/mirrorblob.c
b/hacks/glx/mirrorblob.c
index 61250cc03be64bbb5cf3fa90ebb9a6571d88b52c..6c721c2a0d5bcdc99c01f9c5c1859dbf15a37383 100644
(file)
--- a/
hacks/glx/mirrorblob.c
+++ b/
hacks/glx/mirrorblob.c
@@
-19,7
+19,7
@@
* 10-Feb-2004: jon.dowdall@bigpond.com Added motion blur
*
* The mirrorblob screensaver draws a pulsing blob on the screen. Options
* 10-Feb-2004: jon.dowdall@bigpond.com Added motion blur
*
* The mirrorblob screensaver draws a pulsing blob on the screen. Options
- * include adding a background (via screen_to_
ximag
e), texturing the blob,
+ * include adding a background (via screen_to_
textur
e), texturing the blob,
* making the blob semi-transparent and varying the resolution of the blob
* tessellation.
*
* making the blob semi-transparent and varying the resolution of the blob
* tessellation.
*
@@
-80,7
+80,8
@@
"*motion_blur: " DEF_MOTION_BLUR "\n" \
"*incremental: " DEF_INCREMENTAL "\n" \
"*hold_time: " DEF_HOLD_TIME "\n" \
"*motion_blur: " DEF_MOTION_BLUR "\n" \
"*incremental: " DEF_INCREMENTAL "\n" \
"*hold_time: " DEF_HOLD_TIME "\n" \
- "*fade_time: " DEF_FADE_TIME "\n"
+ "*fade_time: " DEF_FADE_TIME "\n" \
+ "*useSHM: True \n"
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
@@
-336,35
+337,30
@@
reset_projection(int width, int height)
/****************************************************************************
*
/****************************************************************************
*
- * Load a texture using the screen_to_
ximag
e function.
+ * Load a texture using the screen_to_
textur
e function.
*/
void
grab_texture(ModeInfo *mi, int texture_index)
{
*/
void
grab_texture(ModeInfo *mi, int texture_index)
{
- XImage *ximage;
-
- ximage = screen_to_ximage (mi->xgwa.screen, mi->window, 0);
+ Bool mipmap_p = True;
+ int iw, ih, tw, th;
glBindTexture (GL_TEXTURE_2D, textures[texture_index]);
glBindTexture (GL_TEXTURE_2D, textures[texture_index]);
- glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ximage->width, ximage->height,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, ximage->data);
+ if (! screen_to_texture (mi->xgwa.screen, mi->window, 0, 0, mipmap_p,
+ NULL, NULL, &iw, &ih, &tw, &th))
+ exit(1);
- tex_width
[texture_index] = (mi->xgwa.width - 1) / (GLfloat)ximage->width
;
- tex_height[texture_index] =
(mi->xgwa.height - 1) / (GLfloat)ximage->height
;
+ tex_width
[texture_index] = (GLfloat) iw / tw
;
+ tex_height[texture_index] =
-(GLfloat) ih / th
;
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ (mipmap_p ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR));
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- free(ximage->data);
- ximage->data = 0;
- XDestroyImage (ximage);
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
/******************************************************************************
}
/******************************************************************************
@@
-1109,16
+1105,16
@@
draw_background (ModeInfo *mi)
glBegin (GL_QUADS);
glBegin (GL_QUADS);
- glTexCoord2f (0.0,
tex_height[current_texture]
);
+ glTexCoord2f (0.0,
0.0
);
glVertex2i (0, 0);
glVertex2i (0, 0);
- glTexCoord2f (0.0,
0.0
);
+ glTexCoord2f (0.0,
-tex_height[current_texture]
);
glVertex2i (0, MI_HEIGHT(mi));
glVertex2i (0, MI_HEIGHT(mi));
- glTexCoord2f (tex_width[current_texture],
0.0
);
+ glTexCoord2f (tex_width[current_texture],
-tex_height[current_texture]
);
glVertex2i (MI_WIDTH(mi), MI_HEIGHT(mi));
glVertex2i (MI_WIDTH(mi), MI_HEIGHT(mi));
- glTexCoord2f (tex_width[current_texture],
tex_height[current_texture]
);
+ glTexCoord2f (tex_width[current_texture],
0.0
);
glVertex2i (MI_WIDTH(mi), 0);
glEnd();
glVertex2i (MI_WIDTH(mi), 0);
glEnd();