Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Julio

VGA sucks ass!!!

This topic is 5768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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:

  
#include <conio.h> //Used for getch();
//Pointer to the VGA screen

unsigned char far *VGA_Ptr = (unsigned char far*)0xa0000000l;

//Put a pixel to the screen

void PutPixel(short x, short y, unsigned char Color)
{
VGA_Ptr[y*320+x]=Color;
}

//Set a pallete entry... 0-255 for r,g,b

void 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;
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.
}

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
chalkboard

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!