displaying jpeg

Search this archive.

From: Marek Nazarko/Kat/ComputerLand/PL (mnazarko@computerland.pl)
Date: Tue 13 Mar 2001 - 15:23:39 IST


hello
I made a simply program to display any image (supported by liblug)
on-screen.
It works ok with GIF (256 colors) but flickers and dumps core with jpeg
(jpeg library is linked)
I think i should use different video-mode?
Changing G640x480x256 to G640x480x16M doesn't work (my card support it, of
course).
Maybe I should change anything else, please help me.
Marek

#include <stdlib.h>
#include <lug.h>
#include <lugfnts.h>
#include <vga.h>
#include <vgagl.h>

int main(int argc,char *argv[])
{

   int i, r, g, b;
   byte *ptr;
   bitmap_hdr file;

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


   read_lug_file(argv[1], &file);
   for (i = 0, ptr = file.cmap; i < file.colors; i++)
   {
      r = (double)*ptr++;
      g = (double)*ptr++;
      b = (double)*ptr++;
      gl_setpalettecolor(i, r>>2, g>>2, b>>2);
   }
   gl_putbox(0, 0, file.xsize, file.ysize, file.r);
   vga_getch();
return EXIT_SUCCESS;
}


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST