VGA sucks ass!!!
hey,
I''m supposed to teach the graphics unit for my highschool ap comp sci class. I''m writing a little pcx demo which displays a little logo. i reduced the image to 256 colors thinking I had this many to work with, but I have a palette of 16 to work with (Borland 3.0 w/BGI graphics). wtf. I have managed to reduce the palette to 16 colors, but if I reduce my image it looks like shit. any suggestions on how I can get more colors on the screen in this color mode?
thanks,
Joe
My Homepage
Or use a different BGI driver.
320x200x256
another one (at the bottom)
a whole bunch of free packages
good luck,
pat
320x200x256
another one (at the bottom)
a whole bunch of free packages
good luck,
pat
Use 320x200 with 256 colors... that''s what I always used in a borland turbo c/c++ compiler. If you would like any help with this, let me know...
Email - Ready4Dis@aol.com
AIM = Crazyguy4Eva
MSN = Ready4Dis_1@hotmail.com
Here is the basic code to get you started:
Email - Ready4Dis@aol.com
AIM = Crazyguy4Eva
MSN = Ready4Dis_1@hotmail.com
Here is the basic code to get you started:
#include <conio.h> //Used for getch();//Pointer to the VGA screenunsigned char far *VGA_Ptr = (unsigned char far*)0xa0000000l;//Put a pixel to the screenvoid PutPixel(short x, short y, unsigned char Color){ VGA_Ptr[y*320+x]=Color;}//Set a pallete entry... 0-255 for r,g,bvoid SetPallete(unsigned char index, unsigned char r, char unsigned g, char unsigned b){ outportb(0x3c8,index); outportb(0x3c9,r>>2); //Put us between 0->63 outportb(0x3c9,g>>2); //Put us between 0->63 outportb(0x3c9,b>>2); //Put us between 0->63}void SetMode(short mode){ asm mov ax, mode; asm int 0x10;}int main(void){ SetMode(0x13); //Set our 320x200 graphics mode//We can now set our pallete and plot pixels as needed. getch(); SetMode(0x3); //Back to text mode! return 0;}
Just wanted to add (AP from above) that you should probably put a check in the put pixel function to check boundaries...
void PutPixel(short x, short y, unsigned char Color)
{
if (x>-1 && y>-1 && x<320 && y<200) //Make sure we''re within our limit!
VGA_Ptr[(y<<6)+(y<<8)+x]=Color; //<<6 + <<8 = *320, just a bit faster.
}
void PutPixel(short x, short y, unsigned char Color)
{
if (x>-1 && y>-1 && x<320 && y<200) //Make sure we''re within our limit!
VGA_Ptr[(y<<6)+(y<<8)+x]=Color; //<<6 + <<8 = *320, just a bit faster.
}
quote:
Where do you teach? 1991?
not exactly, dipshit.
I''m a studen at Hickman High school. the teacher wanted me to teach this unit since a have a little background in graphics. thanks to darookie for actually answering my question. I know how to do mode13. that''s what I started on 6 years ago. for this class we use Borland (don''t know why) and we have to use BGI.
thanks again,
Joe
My Homepage
quote:Original post by gmcbay
Where do you teach? 1991?
Pascal is still a very good language for learning how to program.
Pascal was created for that purpose and I learned it
too, when I was at school (actually that was sometime around the early 90''s).
Julio:
np - I had the same problem when I wrote my first game in Pascal.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement