Shop OBEX P1 Docs P2 Docs Learn Events
Graphics Driver plot/line 'units' — Parallax Forums

Graphics Driver plot/line 'units'

HarleyHarley Posts: 997
edited 2010-07-21 02:12 in Propeller 1
Are the 'units' for this driver in pixels, tiles, or what? I'm using Rayman's PTP board and 3.5" LCD trying to plot some points and lines. However, using info from the PTP Graphics Demo and Graphics Driver source files it seems vague whether 'plot' or 'line' x,y values are in pixels or tiles or something else. Nothing desired is displayed, my problem #1.

I am using 'plot_screen = $8000 - 9600' which places the upper left of the screen RAM at address $5A80, by my calculation: 320x240 pixels = 10 longs x 240 lines = 2400 longs or 9600 bytes = $2580; and $8000 - 9600 = $5A80, does that sound right? On the left in the photo, is some 'garbage' that shows up if the 'stack' is increased. If increased by '100' the the garbage shows up near the top left; by '200' then it is where the photo shows; by '300' it is near the bottom left. I would have expected such stack space to occupy one or more linex horizontally not vertically. And when the touchscreen is touched you can see the lower half of the 'garbage' bits varying. Presently my program uses: Program 2303 longs, Variables 569 and Stack/free 5316; 4 longs short of full 32K space. The 'garbage' on the right side is fixed and does not vary ever; I don't yet know what's causing that; I'm not concerned about that for the moment.

I copied from the the Graphics Demo the 'draw bouncing lines' (below, renamed 'waveform') for that to draw something on screen. The 'y' value is from an A/D and 'x' value runs from 1 to 320, the width of the screen. I'd expect something to appear on-screen. 'ADbuff' is a 320 long buffer for the A/D samples.
PUB waveform | i
  gr.colorwidth(1,thickness)
  gr.plot(0,ADbuff)
  repeat i from 2 to 321
    gr.line(i-2,ADbuff[i])
  gr.line(0,ADbuff)
[/i]



Am I using that incorrectly? I assume it uses pixels as units to plot points or lines, else it would be pretty crude plots if tiles. I must be missing something, right?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
640 x 480 - 37K

Comments

  • potatoheadpotatohead Posts: 10,261
    edited 2010-07-20 22:54
    If it were me, I think I would redefine the screen in terms of larger pixels to take less memory to start. It's pixels for plotting by the way.

    Try half the horizontal resolution, changing number of tiles in the X to be half what you have now.

    Then try some more lines.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Wondering how to set tile colors in the graphics_demo.spin?
    Safety Tip: Life is as good as YOU think it is!
  • HarleyHarley Posts: 997
    edited 2010-07-21 00:38
    potatohead, Thanks for your suggestions. Though I'd prefer to have the full resolution horizontally and most vertically; (a few touchscreen menus to include at top or bottom).

    Time to put the DEBUG HAT back on.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • potatoheadpotatohead Posts: 10,261
    edited 2010-07-21 02:12
    Yeah, I think you can probably get them too. But, first things first. I would get it to run, then plot some stuff at the extents of the screen, until you know your way around. Then look hard at the RAM, and grow the screen where you can. When it's all close, sometimes you end up chasing problems you don't need to, that's all.

    BTW: That driver has scaling, so you can grow your screen resolution as you find room for it. That library also clips the graphics, if they don't actually appear on screen. Try plotting in all four coordinates, until you see stuff.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Wondering how to set tile colors in the graphics_demo.spin?
    Safety Tip: Life is as good as YOU think it is!
Sign In or Register to comment.