Results 1 to 10 of 10

Thread: Can we access more than 256 colors in a graphics program in Turbo C

  1. #1

    Thread Starter
    Hyperactive Member toughcoder's Avatar
    Join Date
    Nov 2002
    Location
    Near, Very Near
    Posts
    340

    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????

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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.

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    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


  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    agreed, but I thought there were libraries to use OpenGL/Directx.. I could be wrong!

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  9. #9

    Thread Starter
    Hyperactive Member toughcoder's Avatar
    Join Date
    Nov 2002
    Location
    Near, Very Near
    Posts
    340
    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

  10. #10
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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
  •  



Click Here to Expand Forum to Full Width