12 Commits
v1.4 ... v1.4.2

Author SHA1 Message Date
Jarcode
9fb80be00f Merge branch 'unstable' 2018-03-18 12:26:31 -07:00
Jarcode
283afaaaca Cleanup & implementation of #32 2018-03-18 12:20:20 -07:00
Jarcode
5ac2cc4a94 Removed changelog in favour of GitHub releases 2018-03-04 13:39:39 -08:00
Jarcode
273cca946e Merge branch 'master' of https://github.com/wacossusca34/glava 2018-03-04 12:49:51 -08:00
Jarcode
95ceadf0e1 Merge branch 'unstable' 2018-03-04 12:49:23 -08:00
Jarcode
f32f0ded0f Version increase 2018-03-04 12:41:51 -08:00
Jarcode
3a1dcac8c9 Fixed texture load order, closes #28 2018-03-04 12:40:17 -08:00
Levi Webb
8adc8fe459 Merge pull request #26 from coderobe/master
Fix LDFLAGS
2018-03-02 17:41:49 -08:00
Robin Broda
e2f32a14cf Fix LDFLAGS 2018-03-02 18:40:35 +01:00
Levi Webb
318b4b3395 Update README.md 2018-02-20 19:05:00 -08:00
Levi Webb
b89fcd2e44 Merge pull request #23 from Aaahh/patch-3
Update Package names
2018-02-17 17:18:15 -08:00
Aaahh Ahh
baed3086d0 Update Package names
libpulse and libxext6-dev don't exist, also add libglx0 as it's not installed by default
2018-02-17 15:25:36 -05:00
10 changed files with 51 additions and 66 deletions

View File

@@ -1,33 +0,0 @@
## 1.4
* Added window creation backends. GLava automatically uses the appropriate backend, currently `"glx"` and `"glfw"` are available. The GLX window creation code nicely supports transparent windows so that users do not need to use GLFW 3.3 for native transparency, which remains unstable and unreleased.
* Added a `--backend` (or `-b`) flag that can be used to manually select window creation backends.
* Fixed alpha blending with `"native"` transparency. GLava now correctly uses premultiplied alpha to provide alpha blending with other X windows, where a compositor is available.
* Fixed a segmentation fault that occurs with uncommon window managers, see #19
* Fixed various other issues with alpha blending in shader code.
## 1.3
* Added RGBA color parsing for GLSL code and directives (does not work within `#request` directives). The behaviour converts `#3ef708ff` -> `vec4(0.243, 0.967, 0.031, 1.0)`. If the alpha component is omitted, it is assumed to be `1.0`. The parsing occurs during compile time, so it does not incurr any performance penalty.
* Fixed stray `[DEBUG]` messages that were errornously being printed
* _Actually_ added support for GLFW 3.1, see issue #13
* Fixed issue with some WMs not responding to GLava's window types and hints, see #17
* Fixed alpha blending not working, `radial` and `circle` image quality should be drastically improved on `xroot` and `none` opacity settings.
* Added `--version` command line flag
## 1.2
* Attempted to add support for GLFW 3.1, see issue #13
* Added configurable solid background color, see #16
* Fixed issue with excessive file reads from `~/.Xauthority` see #15
## 1.1
* Added `circle` module
* Added anti-aliasing to the `radial` module, written into the shader itself
* Default configuration values should create more appealing visualizers now
* Massive performance improvements, see issue #10
## 1.0
* All versions of GLava with `1.0` version numbers are older development releases.

View File

@@ -53,7 +53,7 @@ ifeq ($(INSTALL),osx)
SHADER_DIR = Library/glava
endif
LDFLAGS = $(ASAN) -lpulse -lpulse-simple -pthread $(LDFLAGS_GLFW) -ldl -lm -lX11 -lXext $(LDFLAGS_GLX)
LDFLAGS += $(ASAN) -lpulse -lpulse-simple -pthread $(LDFLAGS_GLFW) -ldl -lm -lX11 -lXext $(LDFLAGS_GLX)
PYTHON = python

View File

@@ -1,7 +1,7 @@
## GLava
<img align="left" width="200" height="200" src="https://thumbs.gfycat.com/DefiantInformalIndianspinyloach-size_restricted.gif" />
GLava is an OpenGL audio spectrum visualizer. Its primary use case is for desktop windows or backgrounds. Displayed to the left is the `radial` shader module, and [here is a demonstration video](https://streamable.com/dgpj8). Development is active, and reporting issues is encouranged.
**GLava** is an OpenGL audio spectrum visualizer. Its primary use case is for desktop windows or backgrounds. Displayed to the left is the `radial` shader module, and [here is a demonstration video](https://streamable.com/dgpj8). Development is active, and reporting issues is encouranged.
**Compiling** (Or use the [`glava-git` AUR package](https://aur.archlinux.org/packages/glava-git/))**:**
@@ -31,7 +31,7 @@ You can pass `BUILD=debug` to the makefile for debug builds of both glad and gla
**Ubuntu/Debian users:** the following command ensures you have all the needed packages and headers to compile GLava:
```bash
sudo apt-get install libpulse libpulse-dev libglfw3 libglfw3-dev libxext6 libxext6-dev python make gcc
sudo apt-get install libpulse0 libpulse-dev libglfw3 libglfw3-dev libglx0 libxext6 libxext-dev python make gcc
```
## [Configuration](https://github.com/wacossusca34/glava/wiki)

View File

@@ -18,7 +18,7 @@
#include "render.h"
#include "xwin.h"
#define GLAVA_VERSION "1.4"
#define GLAVA_VERSION "1.4.1"
#ifdef GLAD_DEBUG
#define GLAVA_RELEASE_TYPE_PREFIX "debug, "
#else
@@ -199,7 +199,7 @@ int main(int argc, char** argv) {
bool verbose = false;
bool copy_mode = false;
int c, idx, n = 0;
int c, idx;
while ((c = getopt_long(argc, argv, opt_str, p_opts, &idx)) != -1) {
switch (c) {
case 'v': verbose = true; break;
@@ -259,7 +259,7 @@ int main(int argc, char** argv) {
}
pthread_t thread;
int thread_id = pthread_create(&thread, NULL, input_pulse, (void*) &audio);
pthread_create(&thread, NULL, input_pulse, (void*) &audio);
float lb[r->bufsize_request], rb[r->bufsize_request];
while (r->alive) {

View File

@@ -119,7 +119,7 @@ static void set_visible(GLFWwindow* w, bool visible) {
else glfwHideWindow(w);
}
static bool swap_buffers(GLFWwindow* w) {
static void swap_buffers(GLFWwindow* w) {
glfwSwapBuffers(w);
glfwPollEvents();
}

View File

@@ -15,6 +15,7 @@
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
#include <X11/extensions/shape.h>
#include <X11/Xatom.h>
#include <glad/glad.h>
@@ -126,7 +127,7 @@ static void* create_and_bind(const char* name, const char* class,
if (!fmt || (transparent ? fmt->direct.alphaMask == 0 : fmt->direct.alphaMask != 0))
continue;
if (best < 0 || samp_buf && samples > samp) {
if (best < 0 || (samp_buf && samples > samp)) {
best = t;
samp = samples;
}
@@ -157,9 +158,11 @@ static void* create_and_bind(const char* name, const char* class,
fprintf(stderr, "XCreateWindow(): failed\n");
abort();
}
bool desktop = false;
if (type)
xwin_settype(&wcb_glx, w, type);
desktop = xwin_settype(&wcb_glx, w, type);
for (size_t t = 0; t < states_sz; ++t)
xwin_addstate(&wcb_glx, w, states[t]);
@@ -180,6 +183,20 @@ static void* create_and_bind(const char* name, const char* class,
Atom dwin = XInternAtom(display, "WM_DELETE_WINDOW", false);
XSetWMProtocols(display, w->w, &dwin, 1);
// XReparentWindow(display, w->w, DefaultRootWindow(display), 0, 0);
/* Eliminate the window's effective region */
if (desktop){
int ignored;
if (XShapeQueryExtension(display, &ignored, &ignored)) {
Region region;
if ((region = XCreateRegion())) {
XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet);
XDestroyRegion(region);
}
}
}
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = NULL;
glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL;
@@ -255,7 +272,6 @@ static void get_fbsize(struct glxwin* w, int* d, int* h) {
}
static void get_pos(struct glxwin* w, int* x, int* y) {
XWindowAttributes a;
Window _ignored;
XTranslateCoordinates(display, w->w, DefaultRootWindow(display), 0, 0, x, y, &_ignored);
}

View File

@@ -326,10 +326,8 @@ static GLuint create_1d_tex() {
}
static void update_1d_tex(GLuint tex, size_t w, float* data) {
float buf[w];
memcpy(buf, data, w * sizeof(float));
glBindTexture(GL_TEXTURE_1D, tex);
glTexImage1D(GL_TEXTURE_1D, 0, GL_R16, w, 0, GL_RED, GL_FLOAT, buf);
glTexImage1D(GL_TEXTURE_1D, 0, GL_R16, w, 0, GL_RED, GL_FLOAT, data);
}
#define BIND_VEC2 0
@@ -508,7 +506,6 @@ void transform_smooth(struct gl_data* d, void** udaa, void* data) {
for (int t = 0; t < asz; ++t) {
float
db = log(t), /* buffer index on log scale */
v = b[t], /* value at this position */
avg = 0; /* adj value averages (weighted) */
/* Calculate real indexes for sampling at this position, since the
distance is specified in scalar values */
@@ -594,7 +591,7 @@ void transform_wrange(struct gl_data* d, void** _, void* data) {
void transform_window(struct gl_data* d, void** _, void* data) {
struct gl_sampler_data* s = (struct gl_sampler_data*) data;
float* b = s->buf, w;
float* b = s->buf;
size_t sz = s->sz, t;
for (t = 0; t < sz; ++t) {
@@ -767,7 +764,7 @@ struct renderer* rd_new(const char** paths, const char* entry,
};
if (!gl->wcb) {
fprintf(stderr, "Invalid window creation backend selected: '%s'\n", gl->wcb);
fprintf(stderr, "Invalid window creation backend selected: '%s'\n", backend);
abort();
}
@@ -1361,7 +1358,7 @@ void rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
for (t = 0; t < gl->stages_sz; ++t) {
bool needed[64] = { [ 0 ... 63 ] = false }; /* Load flags for each texture position */
bool load_flags[64] = { [ 0 ... 63 ] = false }; /* Load flags for each texture position */
/* Current shader program */
struct gl_sfbo* current = &gl->stages[t];
@@ -1428,6 +1425,10 @@ void rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
/* Handle transformations and bindings for 1D samplers */
void handle_1d_tex(GLuint tex, float* buf, float* ubuf, size_t sz, int offset, bool audio) {
if (load_flags[offset])
goto bind_uniform;
load_flags[offset] = true;
/* Only apply transformations if the buffers we
were given are newly copied from PA */
@@ -1443,6 +1444,7 @@ void rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
transform types are added) */
}
}
glActiveTexture(GL_TEXTURE0 + offset);
/* Update texture with our data */
update_1d_tex(tex, sz, gl->interpolate ? (ubuf ? ubuf : buf) : buf);
@@ -1526,11 +1528,9 @@ void rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
tex = sm->tex; /* replace input texture with our processed one */
}
if (!needed[offset]) {
glActiveTexture(GL_TEXTURE0 + offset);
glBindTexture(GL_TEXTURE_1D, tex);
needed[offset] = true;
}
glActiveTexture(GL_TEXTURE0 + offset);
glBindTexture(GL_TEXTURE_1D, tex);
bind_uniform:
glUniform1i(bind->uniform, offset);
}

View File

@@ -31,7 +31,7 @@ struct gl_wcb {
int x, int y,
int version_major, int version_minor);
bool (*should_close) (void* ptr);
bool (*swap_buffers) (void* ptr);
void (*swap_buffers) (void* ptr);
void (*get_pos) (void* ptr, int* x, int* y);
void (*get_fbsize) (void* ptr, int* w, int* h);
void (*set_geometry) (void* ptr, int x, int y, int w, int h);

18
xwin.c
View File

@@ -100,9 +100,7 @@ bool xwin_should_render(struct renderer* rd) {
return ret;
}
/* Set window types defined by the EWMH standard, possible values:
-> "desktop", "dock", "toolbar", "menu", "utility", "splash", "dialog", "normal" */
static void xwin_changeatom(struct gl_wcb* wcb, void* impl, const char* type,
static bool xwin_changeatom(struct gl_wcb* wcb, void* impl, const char* type,
const char* atom, const char* fmt, int mode) {
Window w = wcb->get_x11_window(impl);
Display* d = wcb->get_x11_display();
@@ -116,14 +114,19 @@ static void xwin_changeatom(struct gl_wcb* wcb, void* impl, const char* type,
default: formatted[t] = c;
}
}
bool ret = !strcmp(type, "DESKTOP");
char buf[256];
snprintf(buf, sizeof(buf), fmt, formatted);
Atom desk = XInternAtom(d, buf, false);
XChangeProperty(d, w, wtype, XA_ATOM, 32, mode, (unsigned char*) &desk, 1);
return ret;
}
void xwin_settype(struct gl_wcb* wcb, void* impl, const char* type) {
xwin_changeatom(wcb, impl, type, "_NET_WM_WINDOW_TYPE", "_NET_WM_WINDOW_TYPE_%s", PropModeReplace);
/* Set window types defined by the EWMH standard, possible values:
-> "desktop", "dock", "toolbar", "menu", "utility", "splash", "dialog", "normal" */
bool xwin_settype(struct gl_wcb* wcb, void* impl, const char* type) {
return xwin_changeatom(wcb, impl, type, "_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_%s", PropModeReplace);
}
void xwin_addstate(struct gl_wcb* wcb, void* impl, const char* state) {
@@ -160,14 +163,13 @@ unsigned int xwin_copyglbg(struct renderer* rd, unsigned int tex) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bool use_shm = true;
int x, y, w, h;
rd_get_wcb(rd)->get_fbsize(rd_get_impl_window(rd), &w, &h);
rd_get_wcb(rd)->get_pos(rd_get_impl_window(rd), &x, &y);
XColor c;
Display* d = rd_get_wcb(rd)->get_x11_display();
Drawable src = get_drawable(d, find_desktop(rd));
bool use_shm = XShmQueryExtension(d);
/* Obtain section of root pixmap */
@@ -191,7 +193,7 @@ unsigned int xwin_copyglbg(struct renderer* rd, unsigned int tex) {
XShmGetImage(d, src, image, x, y, AllPlanes);
} else {
image = XGetImage(d, src, x, y, (unsigned int) w, (unsigned int) h,
ZPixmap, AllPlanes);
AllPlanes, ZPixmap);
}
/* Try to convert pixel bit depth to OpenGL storage format. The following formats\

2
xwin.h
View File

@@ -1,5 +1,5 @@
bool xwin_should_render(struct renderer* rd);
void xwin_settype(struct gl_wcb* wcb, void* impl, const char* type);
bool xwin_settype(struct gl_wcb* wcb, void* impl, const char* type);
void xwin_addstate(struct gl_wcb* wcb, void* impl, const char* state);
unsigned int xwin_copyglbg(struct renderer* rd, unsigned int texture);