Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Question on using 640x480x32k colors mode

Posted on 1998-02-03
3
Medium Priority
?
254 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
ID: 1180424
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
ID: 1180425
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 60 total points
ID: 1180426
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

916 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