mattp
Full Member
 
Posts: 37
|
Post by mattp on Jul 17, 2021 8:59:02 GMT -8
Looking at points plotting examples. In the header files RAM_PAL seems to be out of line with the rest of the defines. Should this code work on the dazzler? Thanks #define RAM_PAL 1056768UL
#define RAM_CMD (ft8xx_model ? 0x308000UL : 0x108000UL) #define RAM_DL (ft8xx_model ? 0x300000UL : 0x100000UL) OK, added a check for offscreen coordinates in plot... looks good! #include <EEPROM.h> #include <SPI.h> #include <GD2.h>
float a = 0.5; float b = -0.6; float c = 0.7; float x = 1; float y = 0;
int cnt; byte col = 1;
static void setpal(byte i, uint32_t argb) { GD.wr32(RAM_PAL + 4 * i, argb); }
static void plot(uint16_t x, uint16_t y, uint32_t i) { if ((x < 480) && (y < 272)) GD.wr(x + (480UL * y), i); }
void setup() { GD.begin(0); GD.cmd_memset(0, 0, 480UL * 272UL); GD.Clear(); GD.BitmapLayout(PALETTED, 480, 272); GD.BitmapSize(NEAREST, BORDER, BORDER, 480, 272); GD.BitmapSource(0); GD.Begin(BITMAPS); GD.Vertex2ii(0, 0); GD.swap(); GD.finish();
setpal(0, 0x00000000UL); for (int i = 1; i < 256; i++) setpal(i, 0xff000000UL | random(0x1000000)); }
void loop() { float oldx = x; float oldy = y;
x = oldy-(oldx/abs(oldx))*sqrt(abs(b*oldx-c)); y = a-oldx;
if (cnt++ == 1500) { col++; cnt = 0; }
plot(239 + (7 * x), 136 + (7 * y), col); }
|
|
mattp
Full Member
 
Posts: 37
|
Post by mattp on Jul 18, 2021 8:58:06 GMT -8
There is a difference between ft80x and ft81x so I'm close to answering my own question
PALETTED8 format is supported indirectly in FT81X and it is different from PALETTED format in FT80X. To render Alpha, Red, Green and Blue channels, multi-pass drawing action is required.
from the developer guide:
BITMAP_HANDLE, BITMAP_SIZE, BITMAP_SOURCE,PALETTE_SOURCE //addr_pal is the starting address of palette lookup table in RAM_G //bitmap source(palette indices) is starting from address 0 dl(BITMAP_HANDLE(0)) dl(BITMAP_LAYOUT(PALETTED8, width, height)) dl(BITMAP_SIZE(NEAREST, BORDER, BORDER, width, height)) dl(BITMAP_SOURCE(0)) //bitmap source(palette indices) dl(BEGIN(BITMAPS)) dl(BLEND_FUNC(ONE, ZERO)) //Draw Alpha channel dl(COLOR_MASK(0,0,0,1)) dl(PALETTE_SOURCE(addr_pal+3)) dl(VERTEX2II(0, 0, 0, 0)) //Draw Red channel dl(BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA)) dl(COLOR_MASK(1,0,0,0)) dl(PALETTE_SOURCE (addr_pal+2)) dl(VERTEX2II (0, 0, 0, 0)) //Draw Green channel dl(COLOR_MASK(0,1,0,0)) dl(PALETTE_SOURCE(addr_pal + 1)) dl(VERTEX2II(0, 0, 0, 0)) //Draw Blue channel dl(COLOR_MASK(0,0,1,0)) dl(PALETTE_SOURCE(addr_pal)) dl(VERTEX2II(0, 0, 0, 0)) Code Snippet 10 PALETTED8 drawing example
|
|
|
Post by jamesbowman on Jul 18, 2021 10:32:31 GMT -8
Right, PALETTED is 80x (GD2) only. 81x (GD3 onwards) replaced it with PALETTED565, PALETTED4 and PALETTED8.
It's a bit of a quagmire to be honest!
|
|
mattp
Full Member
 
Posts: 37
|
Post by mattp on Jul 18, 2021 10:59:35 GMT -8
Is it possible to create a framebuffer in a similar way on the 81x or am I heading down a blind alley?
|
|
|
Post by jamesbowman on Jul 18, 2021 14:03:11 GMT -8
Oh yes totally. You can follow the sequence you posted above, and get a paletted framebuffer. Because it only takes 1 byte per pixel, there's enough memory for even the Dazzler (1280x720). I'd suggest putting the framebuffer at 0, with the paletted ram (addr_ram above) at top 1K of RAM, at 0xffc00.
Am putting an example together now.
(Really should collect these snippets into one place.)
|
|
|
Post by jamesbowman on Jul 18, 2021 18:15:28 GMT -8
|
|
mattp
Full Member
 
Posts: 37
|
Post by mattp on Jul 18, 2021 22:56:16 GMT -8
Thanks - that's great - I'll give it a go  **EDIT _ works perfectly thank you
|
|
mattp
Full Member
 
Posts: 37
|
Post by mattp on Jul 19, 2021 7:53:56 GMT -8
|
|
mattp
Full Member
 
Posts: 37
|
Post by mattp on Sept 24, 2021 22:40:55 GMT -8
Got a full mandelbrot working now. Thanks jamesbowmanAttachments:
|
|