|
-
Nov 19th, 2002, 11:28 AM
#1
Thread Starter
Hyperactive Member
Can we access more than 256 colors in a graphics program in Turbo C
Hello fellow programmers, well I have a doubt to which I have no idea. Well, coming straight to the point, in Turbo C, we can switch to the graphics mode by using the initgraph() function. We can access 16 colors there. We can switch to 256 color mode also by using some dos interrupts. I would like to know how can we access more than 256 colors just like windows. Even windows was built using C and asm, can we 2 access more than 256 colors????
-
Nov 19th, 2002, 01:13 PM
#2
Frenzied Member
In a word: NO
You can't call anything but 16bit OS calls (assuming you have 4.5)
The reason for this: Turbo C was written for DOS up to DOS 6.0 and Windows 3.11 - 32 bit calls do not exist in these environments.
Also, when the compilers were writtten 256 VGA was where it was at hardware-wise for CRT's, and the 486 was standard.
Pentiums came in at about the same time as Windows 95 - after these compilers.
-
Nov 19th, 2002, 01:47 PM
#3
Monday Morning Lunatic
Can you use VESA from a DOS compiler?
Either way, I'd suggest getting a slightly more up-to-date compiler, learning 32-bit programming, and doing your graphics with OpenGL.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 20th, 2002, 05:40 AM
#4
Maybe he doesn't have a better pc...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 20th, 2002, 05:44 AM
#5
You can use a different C compiler, here's a nice free one: http://www.delorie.com/djgpp/
I haven't used it for a few years (I'm now strictly VB - it pays better!) but I'm pretty sure it can cope with all the colours you want, among other things
-
Nov 20th, 2002, 06:00 AM
#6
No it can't. Just because it uses a 32-bit extender it can't get more out of the hardware than there is.
The problem is that there is no standardized way to access a graphics card in any video mode above 640x480x256. Therefore you need drivers and sometimes different code to use more colors. This means getting hardware info directly from the manufacturers, something only companies did because it was simply too much paperwork for provate persons.
Now in the time of 32-bit OSs there always is an abstraction layer which allows you to use one code to access every graphics card. This layer might be the Windows GDI, DirectX, XLib or OpenGL, it doesn't matter. Fact is that nowadays the hard work of dealing with the hardware is left to the companies that produce the hardware.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 20th, 2002, 06:03 AM
#7
agreed, but I thought there were libraries to use OpenGL/Directx.. I could be wrong!
-
Nov 20th, 2002, 06:06 AM
#8
No, DJGPP is too old for that. It's a pure DOS compiler and there is AFAIK no DOS implementation of OpenGL, much less DirectX.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 21st, 2002, 11:27 AM
#9
Thread Starter
Hyperactive Member
Wel guys, I dont intend to use openGL or directX, i just wanted to know if i can access more than 256 colors, thanx everybody
-
Nov 21st, 2002, 11:28 AM
#10
Monday Morning Lunatic
Why are you programming for DOS?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|