set background clear color correctly
This commit is contained in:
parent
0796b2cbcd
commit
f73241e4a6
|
@ -71,22 +71,18 @@ int main()
|
|||
{
|
||||
if(event.key.code == MP_KEY_LEFT)
|
||||
{
|
||||
printf("left\n");
|
||||
dx-=1.1;
|
||||
}
|
||||
else if(event.key.code == MP_KEY_RIGHT)
|
||||
{
|
||||
printf("right\n");
|
||||
dx+=1.1;
|
||||
}
|
||||
else if(event.key.code == MP_KEY_UP)
|
||||
{
|
||||
printf("up\n");
|
||||
dy+=1.1;
|
||||
}
|
||||
else if(event.key.code == MP_KEY_DOWN)
|
||||
{
|
||||
printf("down\n");
|
||||
dy-=1.1;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +96,7 @@ int main()
|
|||
mg_surface_prepare(surface);
|
||||
|
||||
// background
|
||||
mg_set_color_rgba(1, 0, 1, 1);
|
||||
mg_set_color_rgba(0, 1, 1, 1);
|
||||
mg_clear();
|
||||
|
||||
// head
|
||||
|
|
|
@ -125,12 +125,15 @@ void mg_gles_canvas_draw_buffers(mg_canvas_backend* interface, u32 vertexCount,
|
|||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->indexBuffer);
|
||||
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
|
||||
|
||||
|
||||
glUseProgram(backend->program);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, backend->dummyVertexBuffer);
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, backend->vertexBuffer);
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, backend->indexBuffer);
|
||||
|
||||
glUniform1i(0, indexCount);
|
||||
glUniform4f(1, clearColor.r, clearColor.g, clearColor.b, clearColor.a);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
mg_gles_canvas_update_vertex_layout(backend);
|
||||
|
|
|
@ -34,6 +34,8 @@ const char* gles_canvas_fragment =
|
|||
"} indexBuffer ;\n"
|
||||
"\n"
|
||||
"layout(location = 0) uniform int indexCount;\n"
|
||||
"layout(location = 1) uniform vec4 clearColor;\n"
|
||||
"\n"
|
||||
"layout(location = 0) out vec4 fragColor;\n"
|
||||
"\n"
|
||||
"bool is_top_left(ivec2 a, ivec2 b)\n"
|
||||
|
@ -51,8 +53,8 @@ const char* gles_canvas_fragment =
|
|||
"{\n"
|
||||
" float subPixelFactor = 16.;\n"
|
||||
"\n"
|
||||
" vec4 pixelColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
|
||||
" vec4 currentColor = vec4(0., 0., 0., 1.0);\n"
|
||||
" vec4 pixelColor = clearColor;\n"
|
||||
" vec4 currentColor = clearColor;\n"
|
||||
"\n"
|
||||
" ivec2 samplePoint = ivec2(gl_FragCoord.xy * subPixelFactor + vec2(0.5, 0.5));\n"
|
||||
"\n"
|
||||
|
|
|
@ -21,6 +21,8 @@ layout(binding = 1) buffer indexBufferSSBO {
|
|||
} indexBuffer ;
|
||||
|
||||
layout(location = 0) uniform int indexCount;
|
||||
layout(location = 1) uniform vec4 clearColor;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
bool is_top_left(ivec2 a, ivec2 b)
|
||||
|
@ -38,8 +40,8 @@ void main()
|
|||
{
|
||||
float subPixelFactor = 16.;
|
||||
|
||||
vec4 pixelColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
vec4 currentColor = vec4(0., 0., 0., 1.0);
|
||||
vec4 pixelColor = clearColor;
|
||||
vec4 currentColor = clearColor;
|
||||
|
||||
ivec2 samplePoint = ivec2(gl_FragCoord.xy * subPixelFactor + vec2(0.5, 0.5));
|
||||
|
||||
|
|
10
todo.txt
10
todo.txt
|
@ -22,12 +22,14 @@
|
|||
-> convert verts pos to fixed point
|
||||
-> do orient2d in fixed point
|
||||
[!] Check precision/possible overflow when using barycentric coords
|
||||
|
||||
[>>] Investigate cubics flipping when curves are disabled
|
||||
[>>] Investigate bad curve splitting on the right?
|
||||
[!] Avoid first useless (degenerate) triangle on every path
|
||||
[x] Set backround clear color
|
||||
[ ] Multi-sampling
|
||||
[ ] Assess perf
|
||||
[ ] Tiling
|
||||
[ ] Precomputing triangle edges/biases?
|
||||
|
||||
[>] Avoid first useless (degenerate) triangle on every path
|
||||
[ ] Little test drawing app
|
||||
|
||||
[ ] Implement surfaces with child windows on win32
|
||||
[/] Maybe implement compositing directly in d3d and opengl compat extension...
|
||||
|
|
Loading…
Reference in New Issue