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