fix
This commit is contained in:
parent
6093413aa5
commit
c365a657ff
2 changed files with 9 additions and 12 deletions
|
|
@ -27,9 +27,7 @@ double time_since_start() {
|
||||||
(now.tv_nsec - program_start.tv_nsec) / 1e9;
|
(now.tv_nsec - program_start.tv_nsec) / 1e9;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int main(int argc, char *argv[]) {
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
char *shader_path = NULL;
|
char *shader_path = NULL;
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
shader_path = argv[1];
|
shader_path = argv[1];
|
||||||
|
|
|
||||||
17
wayland.c
17
wayland.c
|
|
@ -29,9 +29,7 @@ static const struct xdg_surface_listener xdg_surface_listener = {
|
||||||
static void
|
static void
|
||||||
xdg_wm_base_ping(void *data, struct xdg_wm_base *xdg_wm_base, uint32_t serial)
|
xdg_wm_base_ping(void *data, struct xdg_wm_base *xdg_wm_base, uint32_t serial)
|
||||||
{
|
{
|
||||||
xdg_wm_base_pong(xdg_wm_base, serial);
|
xdg_wm_base_pong(xdg_wm_base, serial); }
|
||||||
}
|
|
||||||
|
|
||||||
static const struct xdg_wm_base_listener xdg_wm_base_listener = {
|
static const struct xdg_wm_base_listener xdg_wm_base_listener = {
|
||||||
.ping = xdg_wm_base_ping,
|
.ping = xdg_wm_base_ping,
|
||||||
};
|
};
|
||||||
|
|
@ -72,9 +70,6 @@ wl_registry_listener = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void egl_init(struct client_state *state) {
|
static void egl_init(struct client_state *state) {
|
||||||
EGLint major, minor, count, n, size;
|
|
||||||
EGLConfig *configs;
|
|
||||||
int i;
|
|
||||||
EGLint config_attribs[] = {
|
EGLint config_attribs[] = {
|
||||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
EGL_RED_SIZE, 8,
|
EGL_RED_SIZE, 8,
|
||||||
|
|
@ -98,21 +93,26 @@ static void egl_init(struct client_state *state) {
|
||||||
fprintf(stderr, "Created egl display\n");
|
fprintf(stderr, "Created egl display\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EGLint major, minor;
|
||||||
if (eglInitialize(state->egl_display, &major, &minor) != EGL_TRUE) {
|
if (eglInitialize(state->egl_display, &major, &minor) != EGL_TRUE) {
|
||||||
fprintf(stderr, "Can't initialise egl display\n");
|
fprintf(stderr, "Can't initialise egl display\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
printf("EGL major: %d, minor %d\n", major, minor);
|
printf("EGL major: %d, minor %d\n", major, minor);
|
||||||
|
|
||||||
|
EGLint count;
|
||||||
eglGetConfigs(state->egl_display, NULL, 0, &count);
|
eglGetConfigs(state->egl_display, NULL, 0, &count);
|
||||||
printf("EGL has %d configs\n", count);
|
printf("EGL has %d configs\n", count);
|
||||||
|
|
||||||
configs = calloc(count, sizeof *configs);
|
|
||||||
|
EGLConfig *configs = calloc(count, sizeof *configs);
|
||||||
|
|
||||||
|
EGLint n;
|
||||||
eglChooseConfig(state->egl_display, config_attribs,
|
eglChooseConfig(state->egl_display, config_attribs,
|
||||||
configs, count, &n);
|
configs, count, &n);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
|
EGLint size;
|
||||||
eglGetConfigAttrib(state->egl_display,
|
eglGetConfigAttrib(state->egl_display,
|
||||||
configs[i], EGL_BUFFER_SIZE, &size);
|
configs[i], EGL_BUFFER_SIZE, &size);
|
||||||
printf("Buffer size for config %d is %d\n", i, size);
|
printf("Buffer size for config %d is %d\n", i, size);
|
||||||
|
|
@ -132,7 +132,6 @@ static void egl_init(struct client_state *state) {
|
||||||
state->egl_config,
|
state->egl_config,
|
||||||
EGL_NO_CONTEXT, context_attribs);
|
EGL_NO_CONTEXT, context_attribs);
|
||||||
|
|
||||||
|
|
||||||
// EGL window
|
// EGL window
|
||||||
state->egl_window = wl_egl_window_create(state->wl_surface,
|
state->egl_window = wl_egl_window_create(state->wl_surface,
|
||||||
state->width, state->height);
|
state->width, state->height);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue