formatting
This commit is contained in:
parent
35d8ca7358
commit
ae999d1b83
2 changed files with 19 additions and 33 deletions
12
renderer.c
12
renderer.c
|
|
@ -5,13 +5,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
|
||||||
void checkGlError() {
|
|
||||||
//const char *err = SDL_GetError();
|
|
||||||
//if (*err != 0) {
|
|
||||||
// printf("OpenGL error: %s", err);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// returns 0 if failed.
|
/// returns 0 if failed.
|
||||||
GLuint compile_shader(GLuint type, const char *src) {
|
GLuint compile_shader(GLuint type, const char *src) {
|
||||||
GLuint id = glCreateShader(type);
|
GLuint id = glCreateShader(type);
|
||||||
|
|
@ -35,11 +28,6 @@ GLuint compile_shader(GLuint type, const char *src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *vertex_shader_src =
|
const char *vertex_shader_src =
|
||||||
//"attribute vec4 vPosition; \n"
|
|
||||||
//"void main() \n"
|
|
||||||
//"{ \n"
|
|
||||||
//" gl_Position = vPosition; \n"
|
|
||||||
//"} \n";
|
|
||||||
"#version 320 es\n"
|
"#version 320 es\n"
|
||||||
"\n"
|
"\n"
|
||||||
"layout(location = 0) in vec2 aPos;\n"
|
"layout(location = 0) in vec2 aPos;\n"
|
||||||
|
|
|
||||||
40
wayland.c
40
wayland.c
|
|
@ -3,9 +3,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "wayland.h"
|
#include "wayland.h"
|
||||||
|
|
||||||
static void
|
static void wl_buffer_release(void *data, struct wl_buffer *wl_buffer) {
|
||||||
wl_buffer_release(void *data, struct wl_buffer *wl_buffer)
|
|
||||||
{
|
|
||||||
/* Sent by the compositor when it's no longer using this buffer */
|
/* Sent by the compositor when it's no longer using this buffer */
|
||||||
wl_buffer_destroy(wl_buffer);
|
wl_buffer_destroy(wl_buffer);
|
||||||
}
|
}
|
||||||
|
|
@ -14,10 +12,7 @@ static const struct wl_buffer_listener wl_buffer_listener = {
|
||||||
.release = wl_buffer_release,
|
.release = wl_buffer_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, uint32_t serial) {
|
||||||
xdg_surface_configure(void *data,
|
|
||||||
struct xdg_surface *xdg_surface, uint32_t serial)
|
|
||||||
{
|
|
||||||
struct client_state *state = data;
|
struct client_state *state = data;
|
||||||
xdg_surface_ack_configure(xdg_surface, serial);
|
xdg_surface_ack_configure(xdg_surface, serial);
|
||||||
}
|
}
|
||||||
|
|
@ -26,10 +21,10 @@ static const struct xdg_surface_listener xdg_surface_listener = {
|
||||||
.configure = xdg_surface_configure,
|
.configure = xdg_surface_configure,
|
||||||
};
|
};
|
||||||
|
|
||||||
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,
|
||||||
};
|
};
|
||||||
|
|
@ -59,10 +54,13 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||||
.close = xdg_toplevel_close,
|
.close = xdg_toplevel_close,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void registry_handle_global(
|
||||||
registry_handle_global(void *data, struct wl_registry *registry,
|
void *data,
|
||||||
uint32_t name, const char *interface, uint32_t version)
|
struct wl_registry *registry,
|
||||||
{
|
uint32_t name,
|
||||||
|
const char *interface,
|
||||||
|
uint32_t version
|
||||||
|
) {
|
||||||
printf("interface: '%s', version: %d, name: %d\n",
|
printf("interface: '%s', version: %d, name: %d\n",
|
||||||
interface, version, name);
|
interface, version, name);
|
||||||
|
|
||||||
|
|
@ -96,15 +94,15 @@ registry_handle_global(void *data, struct wl_registry *registry,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void registry_handle_global_remove(
|
||||||
registry_handle_global_remove(void *data, struct wl_registry *registry,
|
void *data,
|
||||||
uint32_t name)
|
struct wl_registry *registry,
|
||||||
{
|
uint32_t name
|
||||||
|
) {
|
||||||
// This space deliberately left blank
|
// This space deliberately left blank
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener
|
static const struct wl_registry_listener wl_registry_listener = {
|
||||||
wl_registry_listener = {
|
|
||||||
.global = registry_handle_global,
|
.global = registry_handle_global,
|
||||||
.global_remove = registry_handle_global_remove,
|
.global_remove = registry_handle_global_remove,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue