|
Post by rohmer on Sept 25, 2017 14:11:19 GMT -8
So, I have some code that is supposed to draw a vector compass.
I draw two circles, and that works fine.
Here is where the issue comes in when I try to do a polygon. I have abstracted some of the GD library in a wrapper (To support different types of hardware).
So I initially thought it was that, but its not.
I stripped everything away and here is what I have:
GD.ColorRGB(0xf3d417);
Poly po;
po.begin();
/*
po.v(pt1.x * 16, pt1.y * 16);
po.v(pt2.x * 16, pt2.y * 16);
po.v(pt3.x * 16, pt3.y * 16);
*/
po.v(16 * 108, 16 * 100);
po.v(16 * 111, 16 * 105);
po.v(16 * 148, 16 * 100);
po.draw();
I get my circles (Eariler in the code), but this polygon refuses to show..
I'm completely at a loss.
This is on an FT812, I assume polygons support 800x480 (Although the above doesnt have that resolution)
|
|
|
Post by jamesbowman on Sept 25, 2017 15:03:56 GMT -8
I just tried this on an FT812 with the latest GD library:
#include <EEPROM.h> #include <SPI.h> #include <GD2.h>
void setup() { GD.begin(); }
void loop() { GD.ClearColorRGB(0x103000); GD.Clear(); GD.ColorRGB(0xf3d417); Poly po; po.begin(); po.v(16 * 154, 16 * 262); po.v(16 * 256, 16 * 182); po.v(16 * 312, 16 * 262); po.v(16 * 240, 16 * 10); po.draw(); GD.swap(); }
It works fine -- could the earlier circles be somehow interfering with the polygon?
|
|
|
Post by rohmer on Sept 25, 2017 16:07:02 GMT -8
Hmmm, Looking at the code, I had the following: #ifdef FT81X //GD.VertexFormat(2); #endif Removing that seems to have fixed the issue. When you hear hoofbeats think horses, I suppose
|
|
|
Post by rohmer on Sept 25, 2017 16:12:21 GMT -8
One quick question, are Vertex2ii and Vertex2f universally interchangeable?
|
|
|
Post by jamesbowman on Sept 25, 2017 16:16:50 GMT -8
GD.Vertex2ii(x, y, handle, cell) is identical to:
GD.BitmapHandle(handle); GD.Cell(cell); GD.Vertex2f(16 * x, 16 * y); And if you're drawing LINES or POINTS the bitmap handle and cell don't matter anyway.
And Vertex2ii doesn't allow subpixel coordinates, or coordinates outside 0-511.
|
|