Shop OBEX P1 Docs P2 Docs Learn Events
Does the "graphics" object ONLY work with TV ? — Parallax Forums

Does the "graphics" object ONLY work with TV ?

BeanBean Posts: 8,129
edited 2012-09-07 04:20 in Propeller 1
I want to use the "graphics" object (vector text) with a VGA monitor. But I don't see any demos of it.
Can it be done ?

Bean

Comments

  • potatoheadpotatohead Posts: 10,261
    edited 2012-09-05 10:06
    Yes.

    The tile structure is the same in both TV.spin and VGA.spin Configure a VGA.spin display with X tiles and Y tiles. Once you've done that, simply use graphics.spin the same way you would for the TV.spin driver. Graphics.spin just wants to know where the screen is and how many tiles it has. (gr.setup)

    From there, it's just going to draw pixels to the HUB.

    You will want to assign VGA colors to the palettes instead of the TV colors.

    **If you have trouble making that work, post here and I'll go dig up my sample code when I am home.
  • BeanBean Posts: 8,129
    edited 2012-09-05 10:08
    I'm killed with work right now.
    Does anyone know of any code that uses "graphics" with VGA ?
    Something I could borrow from...

    Bean
  • BeanBean Posts: 8,129
    edited 2012-09-05 10:30
    Okay, that works,but only uses a small portion of the center of the screen.
    But it is a starting point...

    Thanks

    Bean
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-09-05 10:40
    Memory appears to be the issue with full screen. If you find a work around, please post up.

    Jeff
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-05 10:44
    There isn't enough hub RAM for a large bitmapped screen buffer. The biggest is about 512 x 384 which is why you find 512 x 384 pixel graphics objects / drivers in the ObEx. Mikronauts has a modified VGA graphics driver that uses external parallel SRAM for a larger screen buffer.
  • RaymanRayman Posts: 14,877
    edited 2012-09-05 10:51
    I think the VGA driver has horizontal and vertical scaling factors you can use to make it bigger...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-09-05 11:21
    That's pretty slick! I found the stretch one direction, just not the other.. What's the other scaling factor setting?
    vgaparams               long    0               'status
                            long    1               'enable
                            long    %010_111        'pins
                            long    %0011           'mode
                            long    0               'videobase
                            long    0               'colorbase
                            long    x_tiles         'hc
                            long    y_tiles         'vc
                            long    2'1               'hx
                            long    1               'vx
                            long    0               'ho
                            long    0               'vo
                            long    512             'hd
                            long    32'16              'hf
                            long    96              'hs
                            long    48              'hb
                            long    380             'vd
                            long    11              'vf
                            long    2               'vs
                            long    31              'vb
                            long    20_000_000      'rate
    
  • RaymanRayman Posts: 14,877
    edited 2012-09-05 11:47
    I think the "h" varaibles are for horizontal and "v" are for vertical...
  • RaymanRayman Posts: 14,877
    edited 2012-09-05 16:41
    If nobody posts it, I'll take a whack at stretching it to fill the screen tomorrow...
    I've done this for the 3.5" touchscreen driver (based on the VGA driver) already to make graphics fill the screen...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-09-05 19:13
    I managed to get it working (somewhat) by increasing the number of tiles, but it's messy. I'll wait to see what you come up with.

    Jeff
  • AribaAriba Posts: 2,690
    edited 2012-09-05 20:39
    The VGA demo from the link above does not work with my picky VGA monitor, so I modified it with my prefered VGA settings.
    To get a full screen I reduced the Y tiles to 10 and increased vx to 3, so the monitor sees 640x480 pixels with 60Hz. The real resolution of the bitmap in memory is 256 x 160 with 4 colors per tile, so each bitmap buffer needs only 10kBytes.

    Andy
  • RaymanRayman Posts: 14,877
    edited 2012-09-06 12:55
    I had a little sync trouble too, but I got it to run on 2 different monitors at full screen by playing with vd and vb:
    Graphics_Demo_VGA.spin

    I had forgotten that the VGA driver doesn't run at 640x480, but a special resolution...
    This might work better to use one of the other drivers that does real 640x480 output...

    Andy, I tried yours at it also works on both of my monitors although top and bottom look cut off.

    If people tell me this version works, I'll take a stab at fixing up the colors.
    Doesn't look like any attempt was made to pick the right colors.
    It's not going to look as good as the TV version due to reduced palette, but it can be a whole lot better than this one...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-09-06 14:15
    Spot on here!

    Yes, I saw the same issue on Andy's.


    Jeff
  • AribaAriba Posts: 2,690
    edited 2012-09-06 18:54
    Yes, my version cuts a bit of the graphic at top and bottom, because it has only 160 pixels Y resolution instead of 192. This can be adjusted by moving and scaling the graphics content, but I think Bean does not want the graphics demo, he needs an example of how to use the graphics driver with VGA, so I don't put any work in scaling and color changes.

    Andy
  • BeanBean Posts: 8,129
    edited 2012-09-07 04:20
    Thanks Andy and Rayman.
    Both version look good.
    I need to use the vector fonts on a VGA monitor and it looks like both version will work for that.
    I assume Andy's version uses less memory since it only has 160 lines.

    Thanks again guys, you're the best.

    Bean
Sign In or Register to comment.