xglbg
所属分类:OpenGL
开发工具:C
文件大小:0KB
下载次数:0
上传日期:2019-10-23 11:29:21
上 传 者:
sh-1993
说明: X的OpenGL着色器背景,
(OpenGL Shader background for X,)
文件列表:
LICENSE (1086, 2019-10-23)
Makefile (430, 2019-10-23)
TODO.md (132, 2019-10-23)
images/ (0, 2019-10-23)
images/island/ (0, 2019-10-23)
images/island/CREDITS.md (77, 2019-10-23)
images/island/island-01.jpg (679813, 2019-10-23)
images/island/island-03.jpg (640298, 2019-10-23)
images/island/island-04.jpg (781874, 2019-10-23)
images/island/island-05.jpg (924558, 2019-10-23)
images/island/island-06.jpg (935854, 2019-10-23)
images/island/island-07.jpg (1000437, 2019-10-23)
images/island/island-08.jpg (751319, 2019-10-23)
images/island/island-09.jpg (738715, 2019-10-23)
images/island/island-10.jpg (705251, 2019-10-23)
images/island/island-11.jpg (786845, 2019-10-23)
images/island/island-12.jpg (592945, 2019-10-23)
images/island/island-13.jpg (507609, 2019-10-23)
include/ (0, 2019-10-23)
include/GL/ (0, 2019-10-23)
include/GL/glext.h (726860, 2019-10-23)
include/config.h (679, 2019-10-23)
include/opengl.h (390, 2019-10-23)
include/pulsefft.h (1487, 2019-10-23)
include/renderer.h (544, 2019-10-23)
include/shader.h (3039, 2019-10-23)
include/stb_image.h (260290, 2019-10-23)
include/utils.h (523, 2019-10-23)
include/xwin.h (887, 2019-10-23)
shaders/ (0, 2019-10-23)
shaders/livebg/ (0, 2019-10-23)
shaders/livebg/frag.glsl (324, 2019-10-23)
shaders/livebgfft/ (0, 2019-10-23)
shaders/livebgfft/frag.glsl (563, 2019-10-23)
shaders/livebgfft2/ (0, 2019-10-23)
shaders/livebgfft2/frag.glsl (542, 2019-10-23)
shaders/solarwind/ (0, 2019-10-23)
shaders/solarwind/frag.glsl (3638, 2019-10-23)
... ...
# xglbg
Live background wallpaper in opengl for X (i3). It's made for shaders from [Shadertoy.com](https://github.com/dyuri/xglbg/blob/master/shadertoy.com).
Started as a fork of [liveW](https://github.com/dyuri/xglbg/blob/master/https://github.com/dgranosa/liveW.git), but I've removed a lot of features I don't need, and rewrote some parts. Sound visualisation *inspired* by [cava](https://github.com/dyuri/xglbg/blob/master/https://github.com/karlstav/cava).
![Imgur](https://github.com/dyuri/xglbg/blob/master/https://i.imgur.com/0IxH4UQ.png)
[Gallery](https://github.com/dyuri/xglbg/blob/master/https://imgur.com/gallery/WriGs3z)
# Requirements
- Pulseaudio
- FFTW
# Compiling
```
$ git clone https://github.com/dyuri/xglbg
$ cd xglbg
$ make
```
By default `clang` is used to compile the sources, but you can change that by setting the `COMPILER` environment variable. For example (using `gcc`):
```
$ COMPILER=gcc make
```
## Ubuntu
The following packages are required to compile the project on Ubuntu:
```
$ sudo apt install mesa-common-dev libglu1-mesa-dev freeglut3-dev libxrender-dev libpulse-dev libfftw3-dev
```
# Initial config
The following command copies the included images and shaders into the configuration folder (`$XDG_CONFIG_HOME/xglbg`):
```
make config
```
# Using
```
$ ./xglbg -p _shader_name_ -i _image_theme_
```
_shader_name_ is the name of the shaders folder inside `/shaders/` in the configuration directory.
_image_theme_ is the name of the image theme folder inside `/images/` in the configuration directory. The images (PNG or JPG) in that directory will be loaded in alphabetical order based on the time of the day (`dayprogress`) and passed to the shader as `image` and `nextimage`. For example if you have 24 images (`image00.png`, `image01.png` ... `image23.png`) then at 10:20 `image10.png` will be loaded as `image` and `image11.png` will be `nextimage`.
With `-s _source_` you can specify a Pulseaudio device to use, which you can obtain with:
```
$ pacmd list-sources | grep "name:"
name:
name:
```
You are intrested in one with .monitor on the end.
The configuration directory is `$XDG_CONFIG_HOME/xglbg` which is usually `$HOME/.config/xglbg`.
Example: `./xglbg -s alsa_output.pci-0000_22_00.3.analog-stereo.monitor -p equalizer -i island`
```
$ ./xglbg -h
Usage: xglbg
Options:
-h Print help
-d Turn debug on
-k Plasma window setup
-w Window mode
-g Window geometry WIDTHxHEIGHT
-o Position of window relative to top left corner TOPxLEFT (default 0x0)
-t Transparency (default 1.0)
-p shader name in shaders folder
-i image theme in images folder
-S image change speed (default 1.0)
-f FPS (default 30)
-D Dynamic FPS - use 1 fps if there is no sound
-m mono mode
-s Pulseaudio device source
Specify using the name from "pacmd list-sources | grep "name:""
```
# Multi monitor setup
In most multi monitor configurations all monitors are part of one X11 screen so maybe `xglbg` will be strached through all monitors.
To set `xglbg` to draw on one monitor use arguments -g (set width and height of window) and -o (distance of top-left corner of window and top-left corner of screen).
## Example
If you have two monitors vertically placed with resolution 1920x1200.
First monitor: `./xglbg -g 1920x1200`
Second monitor: `./xglbg -g 1920x1200 -o 1920x0`
# Using shaders from Shadertoy
1. Create directory inside shaders/ and copy shader code in file frag.glsl inside created folder.
2. Add to begining of the shader:
```glsl
#version 430
uniform vec2 resolution;
uniform float time;
uniform float dayprogress; // progress of day - from 0.0 to 1.0
uniform float imageprogress; // progress of images - from 0.0 to 1.0
uniform float nrimages; // number of background images in rotation
uniform int nosound; // 0 if there's sound, 1 otherwise
uniform sampler1D samples;
uniform sampler1D fft;
uniform sampler2D image; // background image
uniform sampler2D nextimage; // next background image
out vec4 color;
```
3. Rename possible colission between variables names from above inside code in something else.
4. Replace:
- iResolution -> resolution
- fragCoord -> gl_FragCoord
- fragColor -> color
- iTime -> time
- void mainImage( in, out ) -> void main()
近期下载者:
相关文件:
收藏者: