done
This commit is contained in:
parent
7c306a2d1e
commit
30c8f4ef20
4 changed files with 21 additions and 16 deletions
|
|
@ -1,9 +1,4 @@
|
|||
#version 320 es
|
||||
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
precision lowp sampler2D;
|
||||
precision lowp samplerCube;
|
||||
#version 330 core
|
||||
|
||||
uniform vec2 WindowSize;
|
||||
uniform float time;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
uniform vec2 WindowSize;
|
||||
uniform float time;
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
|
|
@ -13,5 +13,5 @@ void main() {
|
|||
vec2 uv = gl_FragCoord.xy / WindowSize;
|
||||
// grid
|
||||
float glob = rand(uv + time);
|
||||
FragColor = vec4(glob * (sin(time)/2 + 0.5), glob, 1.0, 1.0); //vec4(gl_FragCoord.xy / WindowSize, 0.0, 1.0);
|
||||
color = vec4(glob * (sin(time)/2 + 0.5), glob, 1.0, 1.0); //vec4(gl_FragCoord.xy / WindowSize, 0.0, 1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ GLuint compile_shader(GLuint type, const char *src) {
|
|||
}
|
||||
|
||||
const char *vertex_shader_src =
|
||||
"#version 320 es\n"
|
||||
"#version 330 core\n"
|
||||
"\n"
|
||||
"layout(location = 0) in vec2 aPos;\n"
|
||||
"\n"
|
||||
|
|
@ -158,7 +158,7 @@ void render(Renderer *state, int w, int h, double time, char *shader_path, int r
|
|||
// Rendorrrr
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 1.0f); // Dark gray background
|
||||
glClearColor(0.8f, 0.3f, 0.3f, 1.0f); // Dark gray background
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Shader parameters.
|
||||
|
|
|
|||
22
wayland.c
22
wayland.c
|
|
@ -365,13 +365,17 @@ static void egl_init(struct client_state *state) {
|
|||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT | EGL_OPENGL_BIT,
|
||||
EGL_MIN_SWAP_INTERVAL, 0, // make sure that swapping buffers don't block the thread
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
static const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
//EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_CONTEXT_MAJOR_VERSION, 4,
|
||||
EGL_CONTEXT_MINOR_VERSION, 6,
|
||||
EGL_CONTEXT_OPENGL_PROFILE_MASK,
|
||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
|
|
@ -391,11 +395,16 @@ static void egl_init(struct client_state *state) {
|
|||
}
|
||||
printf("EGL major: %d, minor %d\n", major, minor);
|
||||
|
||||
// Desktop GL?
|
||||
if (eglBindAPI(EGL_OPENGL_API) == EGL_FALSE) {
|
||||
printf("eglBindAPI failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
EGLint count;
|
||||
eglGetConfigs(state->egl_display, NULL, 0, &count);
|
||||
printf("EGL has %d configs\n", count);
|
||||
|
||||
|
||||
EGLConfig *configs = calloc(count, sizeof *configs);
|
||||
|
||||
EGLint n;
|
||||
|
|
@ -415,13 +424,14 @@ static void egl_init(struct client_state *state) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Desktop GL?
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
|
||||
state->egl_context =
|
||||
eglCreateContext(state->egl_display,
|
||||
state->egl_config,
|
||||
EGL_NO_CONTEXT, context_attribs);
|
||||
if (state->egl_context == EGL_NO_CONTEXT) {
|
||||
printf("Failed to create EGL context\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// EGL window
|
||||
struct surface_list *next = state->surface_list;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue