svgalib question, gl_putbox

svgalib question, gl_putbox

Post by ADAM P JENKI » Thu, 02 Feb 1995 14:40:28



I don't understand a problem I'm having with using gl_putbox, from the
libvgagl functions.  If I create a solid color bitmap, and then write
it to the screen with gl_putbox, it doesn't come out solid, but is
filled with evenly spaced vertical lines that are the background
color.  This doesn't happen if the putbox command is the first drawing
command, but if I put "gl_clearscreen" first, or any other writes to
the screen, than "putbox" has this problem. Here is the relevant code,
(a simplified version).

#include <vga.h>
#include <vgagl.h>

main()
{
  void *buffer;
  GraphicsContext savedcontext;
  int x, y, width, height, color;

  vga_setmode(G640x480x256);
  gl_setcontextvga(G640x480x256);
  gl_setrgbpalette();

  width = 128;                  /* width of the bitmap */
  height = 256;                 /* height of the bitmap */

  /* allocate memory for a bitmap */
  buffer = (void *)malloc(width * height * BYTESPERPIXEL);

  /* use temporary virtual context to create a bitmap */
  gl_getcontext(&savedcontext);
  gl_setcontextvirtual(width, height, BYTESPERPIXEL, BITSPERPIXEL, buffer);

  color = 50;
  /* make each pixel in the bitmap one color (50) */
  for (y = 0; y < height; y++)
    for (x = 0; x < width; x++)
      gl_setpixel(x, y, color);

  /* restore the saved context */
  gl_setcontext(&savedcontext);

  gl_clearscreen(2);            /* if this isn't here first, no problem */

  x = 264;
  y = 100;
  /*
   * put the bitmap on the sceen, around the middle.
   * This is the box that seems like it should be solid, but it has lines
   * throught it.
   */
  gl_putbox(x, y, width, height, buffer);

  /* press 'q' to exit */
  while (vga_getkey() != 'q')
    ;

  free(buffer);
  vga_setmode(TEXT);

Quote:}

        If you just comment out the "gl_clearscreen" line, it will
draw a solid box, otherwise it will have vertical lines through it. I
saw mentioned in README.gl "aligned putbox".  Can you not put a box
anywhere on the screen?  Does it have anything to do with the graphics
mode?  I would appreciate any help on this.  Thank you.  (The above
code will compile if you want to test it, with "gcc test.c -lvgagl -lvga")

--------------------------------------------------------------
Adam P. Jenkins

--------------------------------------------------------------
Adam P. Jenkins

 
 
 

1. GS fonts, svgalib questions

Hey,
        Could someone tell me if there are some better fonts for Ghostscript
out there, and where I can find them, and how to install them...  I only
recently got Ghostscript and my printcap coordinated enough to print
with my BJ-200ex...  
        The output looks ~ok~ .  The fonts don't seem to be very consistent
within themselves... Some letters are consistently darker than others
within the same font.  I have GS 2.6.2

        Also, are there some docs for svgalib?  I have a diamond stealth 64
graphics 2120...everytime I use something that uses svgalib, everything
gets out of sync with everything else.  Even after the program quits or
aborts or whatever, my text is all scrambled and I have to reboot.  I
don't recall right now what version of svgalib I have.  (Got it from my
redhat 3.0.3 dist.) I have read the limited docs that come with it,
(i.e. libsvga.README)  Doesn't seem to help.

Anyhelp is appreciated,

Scott

2. How to find out a file is open by other process

3. Linux squake mouse acceleration and SVGALib question...

4. PowerBook, New Kernel, & Video

5. Some questions about svgalib and Diamond Stealth...

6. Tru64unix 5.1A with KPGCA Cards

7. vgagl and svgalib question...

8. Linux memory limitations?

9. Svgalib question

10. SVGAlib question

11. SVGAlib and mouse questions

12. trouble w/sasteroid and Svgalib; su question

13. svgalib & vgagl question...