• Advertisement

Archived

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

VGA sucks ass!!!

This topic is 5502 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
bloody hell.

Go and get VESA.BGI. It was Borland''s Vesa driver from Borland C++ v2.0 (aka Turbo C v2.0).

Same calls, just change the name to VESA.BGI. It supports up to 1280x1024x256.

It''s what I used to write a cad program along time ago, and it was dead simple to initialise.

Not sure if its still around and easily available. It use to be seperate to Borlands Turbo C 2.0 (I think I had it on one of the add-on diskettes for it - it wasn''t in the original install).

Do a google search for it, I''m sure it will turn up some where.

If not I can probably (prefer not to) reinstall a 5.25" drive and find the old disks - probably all milduey now though.



Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
- Hi, I''m learning to code för 320x200x256, can you he...
- Hey! Where are you studying? 1991 or what? He.
- No, I''m coding for a cell phone...

There are many uses for basic knowledge... and really, 320x200 and 1024x768, the differens is just that there are a lot more pixels in 1024x768... it basicly works the same way.

Share this post


Link to post
Share on other sites

  • Advertisement