Shop OBEX P1 Docs P2 Docs Learn Events
Newbie Graphics Color Question — Parallax Forums

Newbie Graphics Color Question

JaakkoJaakko Posts: 6
edited 2008-12-04 07:25 in Propeller 1
The method of choosing colors in the graphics object doesn´t appear particulary intuitive for a newcomer,·have I missed some documentation again or is there some simple way to pick colors?
Thank you guys for a great forum,
Jaakko·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-02 21:34
    No, it's not particularly intuitive for a newcomer.

    Basically, each pixel is one of four colors chosen from a palette. Groups of pixels are arranged in a "tile" which is 16 x 16 2-bit pixels and one 32-bit (4 byte) palette is associated with each tile. To save memory, these palettes are kept in a table that can have up to 64 entries and each tile selects one of these palettes.

    This scheme is partially determined by hardware and partially by software. The Hydra book is the best collection of information on video generation with the Propeller, but you can also glean a lot by reading the Propeller Manual's description of the video instruction (WAITVID) and control registers (VCFG and VSCL).
  • potatoheadpotatohead Posts: 10,261
    edited 2008-12-03 00:41
    There is a pretty good explanation in the sample HYDRA Book chapter posted online here:

    http://www.parallax.com/dl/docs/prod/prop/Hydra-Ch16Sample-v1.0.pdf

    That is good for the Parallax Reference Drivers that ship with the Propeller tool.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
  • Nick McClickNick McClick Posts: 1,003
    edited 2008-12-03 02:06
    'not particularly intuitive' is an understatement. It took me the longest time to figure out I was trying to write graphics to the screen pointer array, not the display. I forget who wrote up This page, but it's the explanation that makes the most sense to me.

    I think of it this way - There are 16x12 tiles on the screen. Each tile is defined by the screen pointer array. Each screen pointer defines (1) the colors for this tile, and (2) where the contents of the tile are actually stored (the Display).

    So, there are a few ways to change the contents of the screen
    1 - Change the screen pointer to point to new contents. You could also have several tiles all pointing to the same contents.

    2 - Change the contents by writing into the display. The screen pointers are still pointing to the same patch of data, but the data has changed.

    To add a bit of confusion, it's very common to double buffer the screen. This means you set another patch of memory aside, casually draw your screen on that, and then flip the screen pointers to your new screen once you're done.

    There are probably better ways to explain it, but I hope that helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Gadget Gangster - Share your Electronic Projects - Sign up as a Designer and get a free 4-pack of Project Boards!
  • Nick McClickNick McClick Posts: 1,003
    edited 2008-12-03 02:07
    That's who wrote it! Rayman beat me to it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Gadget Gangster - Share your Electronic Projects - Sign up as a Designer and get a free 4-pack of Project Boards!
  • potatoheadpotatohead Posts: 10,261
    edited 2008-12-03 03:01
    The pointers are cool, because you can point tiles to the ROM for text that really doesn't cost you anything.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
  • JaakkoJaakko Posts: 6
    edited 2008-12-04 07:25
    Thank you very much, gentlemen!

    I will read trough the documents you recommended. All I need at this point is 4 colors, I just have to figure out how to control what those 4 colors actually are.

    Best regards,

    Jaakko
Sign In or Register to comment.