-
Notifications
You must be signed in to change notification settings - Fork 1.1k
nk_fill_polygon, nk_stroke_polygon and nk_stroke_polyline always contain one point at the origin #808
Comments
struct nk_command_buffer* buf = nk_window_get_canvas(&ctx);
nk_fill_triangle(buf, 100, 100, 100, 200, 200, 200, nk_rgb(0, 0, 200));
edit: the are called primitives because they do the very basic thing, compositing is up to you |
None of this addresses the issue with all polygons having a point in the origin. I'm not looking for workarounds, I just would like Nuklear to work correctly. I could just use OpenGL if I were willing to go through all the trouble of fixing Nuklear. I commend the developers for making such a useful library and would like to offer my thanks. I hope they may take a look at this issue and let me know how the polygon functions work and if it can be solved. |
I've downloaded LWJGL and studied their code. Unfortunately I could not find any mistake regarding origin |
My software is quite complex and is spread out over many classes, but the following code is a condensed version of the code I'm using to draw the polygon. I make a call to the test_polygon() function on each program loop, preceded by calls to the nk_begin and nk_layout_* functions to set up a window and place the widget. I have set up Nuklear to work with OpenGL and GLFW similar to how it is shown in this example:
For the moment, I've just replaced calls to nk_fill_polygon with nk_fill_rect and made a simplified version of what I intended to draw. It is not imperative to have this issue resolved since this part of the software is just for internal use. |
In case it matters, I've been using the LWJGL binding of Nuklear and used code from their demo to bind Nuklear to OpenGL. https://github.com/LWJGL/lwjgl3/blob/master/modules/samples/src/test/java/org/lwjgl/demo/nuklear/GLFWDemo.java
Whenever I make calls to nk_fill_polygon, nk_stroke_polygon or nk_stroke_polyline, I always end up with a polygon that has one of its points at the top left of the window. If this is not a bug, can you tell me if there is a function that sets the origin for drawing polygons to something other than (0, 0)?
On a side note, I've had trouble drawing shapes in general, the library seems a bit limited in what I can draw. I wanted to draw a rectangle with one rounded edge.
My first approach was to draw a polygon that resembles a rectangle with a small square cut out of the corner and then draw an arc at that corner. Polygon did not work because of the issue mentioned above.
For my next approach I drew two rectangles, one large one and a smaller one, such that they look like a larger rectangle with a corner removed. when I went to add the arc I found that nk_stroke_arc actually draws straight lines along with the curve. Is there any way to just draw the curve without the radial lines attached to it.
Finally, I wanted to draw an L-shaped polygon with a rounded corner on the 270 degree angle, but it doesn't appear like there are any tools for drawing those kinds of corners, as the arc commands are specifically for filling the inside of circle that the arc belongs to.
The text was updated successfully, but these errors were encountered: