|
@@ -518,6 +518,12 @@ file_browser_run(struct file_browser *browser, struct nk_context *ctx)
|
|
|
* DEVICE
|
|
|
*
|
|
|
* ===============================================================*/
|
|
|
+struct nk_glfw_vertex {
|
|
|
+ float position[2];
|
|
|
+ float uv[2];
|
|
|
+ nk_byte col[4];
|
|
|
+};
|
|
|
+
|
|
|
struct device {
|
|
|
struct nk_buffer cmds;
|
|
|
struct nk_draw_null_texture null;
|
|
@@ -606,10 +612,10 @@ device_init(struct device *dev)
|
|
|
|
|
|
{
|
|
|
/* buffer setup */
|
|
|
- GLsizei vs = sizeof(struct nk_draw_vertex);
|
|
|
- size_t vp = offsetof(struct nk_draw_vertex, position);
|
|
|
- size_t vt = offsetof(struct nk_draw_vertex, uv);
|
|
|
- size_t vc = offsetof(struct nk_draw_vertex, col);
|
|
|
+ GLsizei vs = sizeof(struct nk_glfw_vertex);
|
|
|
+ size_t vp = offsetof(struct nk_glfw_vertex, position);
|
|
|
+ size_t vt = offsetof(struct nk_glfw_vertex, uv);
|
|
|
+ size_t vc = offsetof(struct nk_glfw_vertex, col);
|
|
|
|
|
|
glGenBuffers(1, &dev->vbo);
|
|
|
glGenBuffers(1, &dev->ebo);
|
|
@@ -703,16 +709,25 @@ device_draw(struct device *dev, struct nk_context *ctx, int width, int height,
|
|
|
vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
|
|
elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
|
|
{
|
|
|
- /* fill converting configuration */
|
|
|
+ /* fill convert configuration */
|
|
|
struct nk_convert_config config;
|
|
|
- memset(&config, 0, sizeof(config));
|
|
|
- config.global_alpha = 1.0f;
|
|
|
- config.shape_AA = AA;
|
|
|
- config.line_AA = AA;
|
|
|
+ static const struct nk_draw_vertex_layout_element vertex_layout[] = {
|
|
|
+ {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct nk_glfw_vertex, position)},
|
|
|
+ {NK_VERTEX_TEXCOORD, NK_FORMAT_FLOAT, NK_OFFSETOF(struct nk_glfw_vertex, uv)},
|
|
|
+ {NK_VERTEX_COLOR, NK_FORMAT_R8G8B8A8, NK_OFFSETOF(struct nk_glfw_vertex, col)},
|
|
|
+ {NK_VERTEX_LAYOUT_END}
|
|
|
+ };
|
|
|
+ NK_MEMSET(&config, 0, sizeof(config));
|
|
|
+ config.vertex_layout = vertex_layout;
|
|
|
+ config.vertex_size = sizeof(struct nk_glfw_vertex);
|
|
|
+ config.vertex_alignment = NK_ALIGNOF(struct nk_glfw_vertex);
|
|
|
+ config.null = dev->null;
|
|
|
config.circle_segment_count = 22;
|
|
|
config.curve_segment_count = 22;
|
|
|
config.arc_segment_count = 22;
|
|
|
- config.null = dev->null;
|
|
|
+ config.global_alpha = 1.0f;
|
|
|
+ config.shape_AA = AA;
|
|
|
+ config.line_AA = AA;
|
|
|
|
|
|
/* setup buffers to load vertices and elements */
|
|
|
{struct nk_buffer vbuf, ebuf;
|