Shop OBEX P1 Docs P2 Docs Learn Events
Using more than one instance of the Graphics Object — Parallax Forums

Using more than one instance of the Graphics Object

Jim FouchJim Fouch Posts: 395
edited 2006-09-12 19:45 in Propeller 1
I'm working on a project that I seem to have ran out of memory in my main cog. I'm using the TV & Graphics object. I'm wondering if there is a way to have two different cogs display information using the TV object, or is there a way to have one Graphics object used by two different cogs?

Jim

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-09-12 14:22
    Yes, you just have to ensure that only one cog uses the Graphics object at a time. Read the section of the SPIN manual on LOCKNEW, LOCKSET, LOCKCLR, and LOCKRET for a description of how to use the semaphores. The TV object just sits in the background displaying the contents of a screen bitmap and doesn't care what cog changes it. The Graphics object consists of a cog that does most of the work in the background and gets commands from the SPIN code which does a little bit of the work in setting up the parameters for the cog.
  • Jim FouchJim Fouch Posts: 395
    edited 2006-09-12 19:45
    I've look at the manual where you mentioned, it helps somewhat. I'm still wondering what the best way to make this work. I bascially have more work to display info on the TV using the Graphics object. Can more than one COG call the single instance of the graphics COG? If so, are there any examples of this. I've looked in the manual, but didn't see anything I understand.

    I'm a VB programmer by trade, so I understand the idea of an objects. What is the best way to have a global variable? Right now I have ~8 longs that I am using as globals. When I create a new instance of an object that needs to read or change these, I pass the address of the first var, then do a LongMove from a local copy of the Var into the address of the global. Is there a better way?
Sign In or Register to comment.