Shop OBEX P1 Docs P2 Docs Learn Events
Graphics or Display Anomaly — Parallax Forums

Graphics or Display Anomaly

CannibalRoboticsCannibalRobotics Posts: 535
edited 2008-10-30 11:41 in Propeller 1
Anybody have any idea why I'm getting this rainbow effect when the Color ==1? In the picture it's not that pronounced but it's most agrivating on the display. It does seem to migrate to other displays. I'm driving it with NTSC.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent, only $1.
Send cash and signature to CannibalRobotics.

Post Edited (CannibalRobotics) : 10/27/2008 4:05:40 PM GMT
640 x 450 - 54K
640 x 446 - 51K

Comments

  • BaggersBaggers Posts: 3,019
    edited 2008-10-27 17:35
    cannibal robotics, it's because the screen display palette is being changed down the screen

    you've probably got code like this in your initial setup
      'init tile screen
      repeat dx from 0 to tv_hc - 1
        repeat dy from 0 to tv_vc - 1
          screen[noparse][[/noparse]dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10)
    
    



    try changing to
      'init tile screen
      repeat dx from 0 to tv_hc - 1
        repeat dy from 0 to tv_vc - 1
          screen[noparse][[/noparse]dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc
    
    



    that will set all the screen tiles to have the first 4 colours in your palette [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • schwiegjcschwiegjc Posts: 41
    edited 2008-10-27 18:14
    I had the same problem. Depending on the location of the item on the screen, the color of the item would be different. I will try it. Thank you.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-27 18:37
    Ok, so i tried it all shades of red or green are gone. SO, I pulled up the graphics_demo program just to test it there too. I insertedf the code and got the same result - all reds and greens are gone.

    Other ideas?
  • BaggersBaggers Posts: 3,019
    edited 2008-10-27 19:08
    all the reds and greens are gone, that's because you have to set bits 10 upwards in the word in screen buffer for the area you want to draw that text to the palette number
    eg

      screen[noparse][[/noparse]y * tv_hc + x]:=(screen[noparse][[/noparse]y * tv_hc + x] & $3ff) + (palette<<10)
    
    



    where x is the x tile you want to change colour of, and y is the y position of the tile you want to change the·palette of.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • pemspems Posts: 70
    edited 2008-10-27 19:33
    Hi Cannibal

    I cannot offer a solution, but i like your GUI drawing effort. I assume you're rendering from vector data of the lines and curves on the prop. I was thinking of making a similar graphics accelerator for another MCU to feed vector data from, so i am excited to see your progress.

    Cheers
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-27 21:51
    Baggers
    how do I set 'Palette'?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-27 23:49
    I'll take a look.
    Interestingly enough, the picture of the little monitor parallax sells running the graphics demo is showing signs of the same problem. Look at the color variations in the '9' from top to bottom.
    700 x 700 - 72K
  • RaymanRayman Posts: 14,243
    edited 2008-10-28 00:19
    Do take a look. I think you'll find the answer there...
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-28 00:19
    OK,
    I read your write ups, quite impressive. But I'm still stuck trying to figure out how to make the forth color row identical from top to bottom.
    Help???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • RaymanRayman Posts: 14,243
    edited 2008-10-28 00:31
    This is the code that sets the colors:
      'init colors
      repeat i from 0 to 63
        colors[noparse][[/noparse]i] := $00001010 * (i+4) & $F + $2B060C02
    

    Just change this to:
      'init colors
      repeat i from 0 to 63
        colors[noparse][[/noparse]i] := $2B060C02
    
    



    ·
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-28 00:40
    OK,
    I'm at home at the moment but the smoke is beginning to clear.
    I might get back to the lab later tonight to try this but to help me clarify my understanding of this, the long 2B060C02 is actually the four bytes that make up the four tiles colors.
    They are: %2B, %06, %0C and %02 from top to bottom, right?
    So if I choose color %01 I would be displaying the color defined by %06?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • RaymanRayman Posts: 14,243
    edited 2008-10-28 00:50
    I think you've got it. But, you need to use $ instead of %...
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-28 00:55
    This begs a further question I guess.
    If the color for every tile is the same, can one save the 64 longs on both the bitmap and display memories by simply plugging constants into the code where color is used?
    That's 128 longs (which at this point seems like a great big chunk of memory).
    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-28 00:56
    oops, getting late --- must program....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • schwiegjcschwiegjc Posts: 41
    edited 2008-10-28 16:07
    I am trying to resolve the solution

    First Fix:

    'init tile screen
    repeat dx from 0 to tv_hc - 1
    repeat dy from 0 to tv_vc - 1
    screen[noparse][[/noparse]dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc

    Second Fix:
    screen[noparse][[/noparse]y * tv_hc + x]:=(screen[noparse][[/noparse]y * tv_hc + x] & $3ff) + (palette<<10)

    Third Fix:
    'init colors
    repeat i from 0 to 63
    colors := $2B060C02

    How is the solution implemented? Insert First Fix, Third Fix, and replace screen[noparse]/noparse line in First Fix with Second Fix.
  • BaggersBaggers Posts: 3,019
    edited 2008-10-28 18:44
    replace code similar to first fix with the first fix

    replace code similar to third fix with the third fix


    the second fix is if you want to change the colour of a tile at x , y to palette [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • schwiegjcschwiegjc Posts: 41
    edited 2008-10-29 17:28
    I tried the First and third Fix which did resolved the problem (even though the display is not as pretty). I have a couple of analog gages that I am displaying to TV screen. How can the Second Fix be used to change the dial colors?

    roll is between 0 to 450(or 45 degrees)
    rolldir is 1 or 0

    [noparse][[/noparse] gr.color(2)
    gr.width(0)
    gr.arc(60, 30, 50, 50, 0, 409, 11, 3)
    gr.arc(60, 30, 45, 45, 204, 409, 10, 3)
    gr.color(0)
    gr.width(2)
    gr.arc(60, 30, 42, 42, 0, 204, 21, 3)
    gr.color(1)
    gr.width(0)
    roll := roll/10
    if roll>45
    roll := 45
    if rolldir==1
    gr.arc(60, 30, 40, 40, 4096-(((45+roll)*4096)/90) ,1, 1, 3)
    gr.arc(60, 30, 40, 40, 4096-(((roll)*4096)/90) ,1, 1, 3)
    gr.arc(60, 30, 40, 40, 4096-(((90+roll)*4096)/90) ,1, 1, 3)
    else
    gr.arc(60, 30, 40, 40, 4096-(((45-roll)*4096)/90) ,1, 1, 3)
    gr.arc(60, 30, 40, 40, 4096-(((360-roll)*4096)/90) ,1, 1, 3)
    gr.arc(60, 30, 40, 40, 4096-(((90-roll)*4096)/90) ,1, 1, 3)]

    How does the second fix allow to adjust the line color? The Graphics Pallette Demo has 64 different colors.
  • BaggersBaggers Posts: 3,019
    edited 2008-10-29 18:55
    well, the third fix, could be

    repeat i from 0 to 63
      colors [noparse][[/noparse] i ]:= mycolours [noparse][[/noparse] i ]
    '
    '
    'put this in dat section at bottom.
    dat
    mycolours long $2B060C02
        long    $3f071c02 ' and have your second 4 colour palette set up here
        long    $3f071c02 ' and have your third 4 colour palette set up here
    ' and so on for up to 64, 4 colour palettes
    
    



    that will give you more palettes to choose from, when doing fix 2 [noparse]:)[/noparse]
    you'll have to do this bit manually, as the gr. routines that actually draw the lines and arcs etc, are in asm.

    PUB setattr( x, y, palette )
      x+=128 ' remove this line if you're not using the positions from center of screen being 0,0
      y+=96  ' remove this line if you're not using the positions from center of screen being 0,0
      x>>=4 ' divide x by 16
      y>>=4 ' divide y by 16 to make them both point to attribute blocks
      screen[noparse][[/noparse]y * tv_hc + x]:=(screen[noparse][[/noparse]y * tv_hc + x] & $3ff) + (palette<<10)
    
    



    hope that's clear enough for you?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • schwiegjcschwiegjc Posts: 41
    edited 2008-10-29 21:40
    Thank you. I wil try it out. I took the color palette from the Graphics Demo Code:

    [noparse][[/noparse]repeat i from 0 to 63
    colors [noparse][[/noparse] i ]:= mycolours [noparse][[/noparse] i ]

    mycolours long $07020504
    long $07020504
    long $07020504
    long $07020504
    long $07020504
    long $02020507
    long $03020507
    long $04020507
    long $05020507
    long $06020507
    long $07020507
    long $07020504
    long $07020504
    long $07020504
    long $07020504
    long $07020504
    long $0B0A0507
    long $1B1A0507
    long $2B2A0507
    long $3B3A0507
    long $4B4A0507
    long $5B5A0507
    long $6B6A0507
    long $7B7A0507
    long $8B8A0507
    long $9B9A0507
    long $ABAA0507
    long $BBBA0507
    long $CBCA0507
    long $DBDA0507
    long $EBEA0507
    long $FBFA0507
    long $0D0C0507
    long $1D1C0507
    long $2D2C0507
    long $3D3C0507
    long $4D4C0507
    long $5D5C0507
    long $6D6C0507
    long $7D7C0507
    long $8D8C0507
    long $9D9C0507
    long $ADAC0507
    long $BDBC0507
    long $CDCC0507
    long $DDDC0507
    long $EDEC0507
    long $FDFC0507
    long $080E0507
    long $181E0507
    long $282E0507
    long $383E0507
    long $484E0507
    long $585E0507
    long $686E0507
    long $787E0507
    long $888E0507
    long $989E0507
    long $A8AE0507
    long $B8BE0507
    long $C8CE0507
    long $D8DE0507
    long $E8EE0507
    long $F8FE0507
    ]
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-30 11:20
    I found it very helpful in getting my head around the problem to generate a sequence of filled boxes across and down the screen.
    As the boxes were generated I changed the color, 0 to 3. This created a mosaic like effect. I could then alter the color pallet 'regionally' to accommodate a wider selection of color across the screen. Another very enlightening exercise was to adjust the colors on the fly.
    I have a test jig that has pots on an 8 chan AD converter. I generated the color pallet by using data from 4 of the channels rotating the bytes into place to create the long. I could turn the knobs and the colors would change.
    This really helped me optimize the colors for the display and isolate color combinations that just do not get along very well.
    Jim-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • BaggersBaggers Posts: 3,019
    edited 2008-10-30 11:41
    glad you're getting your head around it now [noparse]:)[/noparse] and most of all that you're having fun doing it.

    Baggers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
Sign In or Register to comment.