From: tony Tong (chaffmanus@yahoo.com)
Date: Fri 25 Jan 2002 - 07:22:17 IST
i have read the demo testgl.c which provide a example
for use of gl_putbox(). but when i run it , the
result is awful . The logo can be recognized .but it
is too bad quality .at first i think maybe the
linuxlogo.bmp in the demo is of bad qulity . so i
replace it with a beautiful raw rgb pic.However the
result is the same .
why this happen?
when run testgl , the output information my program
give is "riva tnt/riva tnt2 driver nv4"
so i try to write another one .but ,this time, even
bad image i cannot get .what i get is just a green
box.
the following is my test code.
#include <stdio.h>
#include <vga.h>
#include <vgagl.h>
#define LOGOWIDTH 408
#define LOGOHEIGHT 167
void loadbitmap( void *buf)
{
FILE *f;
f = fopen("sample.r08", "rb");//sample.r08 is a
408x167x256 raw rgb image
if(f==NULL)return;
fread(buf, 1, 68136, f);
fclose(f);
}
int main()
{ GraphicsContext physicalscreen;
void *logobitmap;
/* Initialize */
if (vga_init()!=0) {
printf("Error initialising svgalib!\n");
exit(1);
}
if (vga_setmode(G800x600x256)!=0) {
printf("Can't set mode 800x600x256!\n");
exit(1);
}
if (gl_setcontextvga(G800x600x256)!=0) {
printf("Error setting context!\n");
exit(1);
}
gl_getcontext(&physicalscreen);
if (gl_setcontextvgavirtual(G800x600x256)!=0) {
printf("Error setting virtual context!\n");
exit(1);
}
// Use
gl_clearscreen(0);
gl_setrgbpalette();
logobitmap = alloca(LOGOWIDTH * LOGOHEIGHT);
loadbitmap(logobitmap);
gl_putbox(1,1,408,167,logobitmap);
vga_waitretrace();
gl_copyscreen(&physicalscreen);
getchar();
/* Restore */
vga_setmode(TEXT);
return(0);
}
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
------------------------------------------------------------------
Unsubscribe: To: listbot@svgalib.org
Body: unsubscribe linux-svgalib
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST