Solved

Question on using 640x480x32k colors mode

Posted on 1998-02-03
3
240 Views
Last Modified: 2006-11-17
Here's my question...

For your information, I am trying to program in a 640x480x32k colors mode. Before this, I've been in 320x200x256 colors mode and I'm able to play around with the 256 colors available for me and I'm able to create a palette
with 64 different shades of a color for my needs.

But I'm new to this 640x480x32k mode and I hope that someone could answer the following doubts:

1) How many different kinds of shades can a color element
   (eg: red) have in this mode? [eg: Red can have up to 64
   different shades in 320x200x256 colors mode]

2) How can I create a palette to contain all of the shades?
   [eg: for(index=0; index<64; index++)
            write_to_palette(index, index, 0, 0);
        I can have 64 different shades of red like this.]
   
3) I understand that in 320x200x256 colors mode, the 3
   important color element are Red, Green and Blue. What
   about in 640x480x32k colors mode?
 
4) How can I use the character set from the BIOS in
   640x480x32k colors mode? Can I create the font myself
   instead of using the character set? How?  

For more informations, I'm using Turbo C++ version 3.0 for
DOS compiler. Any help offered is very much appreciated!
0
Comment
Question by:justinng
  • 2
3 Comments
 
LVL 1

Expert Comment

by:TheMadManiac
Comment Utility
1) it depends on the card, but usually there are 5 bits for red, 5 bits for green and 5 bits for blue. this would mean that there can be 32 shades.

2) this mode does not use a palette. the 16 bits you need to write to the videomemory contain the all the color information it needs. much like in truecolor modus. Think about this: how big would a palette for 32k colors be ?

3) well, see 1. they still are red/green/blue

4) once you are in that mode, you can just use printf to write characters to the video-memory. this will take care of bios calls (which is just the same call as in textmode)
0
 

Author Comment

by:justinng
Comment Utility
For:

1) You mean there can be 64 different shades for Red element in
   320x200x256 colors mode and only 32 different shades for the
   Red element in 640x480x32k colors mode??

2) Well... you've got a point there but how can I go about doing    that?

3) Fine.... thanx!

4) You mean using printf to write to video memory? But how?
   Like I use printf to print a string or character on the
   80x25 screen but how can I do that in 640x480x32k colors mode?
   Can I assign one of the 32k colors to the string or character?
   Sorry but can you tell me how can I go about doing it by some
   brief codes maybe?

Thanx!
0
 
LVL 1

Accepted Solution

by:
TheMadManiac earned 30 total points
Comment Utility
1)
yes, the number of shades is reduced, but the number of colors that can be used at the same time has been increased from 256 to 32k colors. This is the cost of this modus

3)
think of the int made up out of bits:

 0 -> 4 = red
 5 -> 9 = green
 10->14 = blue

the 15th bit isn't used (it is in 64k color mode.. this is the only difference between 32k & 64k)

so, to write white, just write a in with the value 31+(31<<5)+(31<<10)

in which the first is red, the second is green and the last is blue. ( some cards use a different order of the colors in the int)

4)
printf writes to standard output device, and thus it is impossible to use colors with it (exceptions there, but do not apply for 32k color mode)
to write a character to that mode with a specified color, you probably just want to draw it yourself, with putpixels or something. this is faster as well.. i could explain it here, but that would take to much time, and it's done so many times before. besides, it's almost like putting an image on the screen.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now