diff --git a/backend/sokol/source_shared.shdc.glsl b/backend/sokol/source_shared.shdc.glsl index 2d30f5d..cd9ed9a 100644 --- a/backend/sokol/source_shared.shdc.glsl +++ b/backend/sokol/source_shared.shdc.glsl @@ -1,6 +1,5 @@ in vec2 v_position; in vec2 v_texture; -// in vec4 v_elem; out vec2 uv; void main() diff --git a/docs/guide_backend.md b/docs/guide_backend.md index fa306e0..b0bd5f6 100644 --- a/docs/guide_backend.md +++ b/docs/guide_backend.md @@ -36,3 +36,17 @@ The index buffer is just a u32 stream. For how a quad mesh is laid out see `blit_quad` in [draw.odin](../vefontcache/draw.odin) For how glyph shape triangulation meshes, the library currently only uses a triangle fanning technique so `fill_path_via_fan_triangulation` within [draw.odin](../vefontcache/draw.odin) is where that is being done. Eventually the libary will also support other modes on a per-font basis. + +## Keep in mind GLSL vs HLSL UV (texture) coordinate convention + +The UV coordinates used DirectX, Metal, and Vulkan all consider the top-left corner (0, 0), Where the Y axis increases downwards (traditional screenspace). This library follows the convention of (0, 0) being at the bottom-left (Y goes up) which is what OpenGL uses. + +In the shader the UV just has to be adjusted accordingly: + +```c +#if ! OpenGL +uv = vec2( v_texture.x, 1.0 - v_texture.y ); +#else +uv = vec2( v_texture.x, v_texture.y ); +#endif +```