Thread: A good graphics library?

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    244

    A good graphics library?

    Hi there!

    I'm looking for a good graphics library (Not OpenGL!) for c++.
    I'm common to some languages but new to c++. I know the basics and OOP.

    My question: What's a recommended graphics library to add pixels to the screen very fast?
    Thank you
    bye!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Probably not the fastest, but SDL does this.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    244
    If it's not the fastest, is there a faster one?
    Propably it will be enough for now.
    I found it and try to impement it. Let's see wheter it works this time.
    I tried some others but they didn't work...

    Do I have to use Win32 projects or is a console app enoguh?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I don't think SDL works in Console mode, you have to use a "Window" app.

    Of course, the Windows API itself has GDI(+) that does draw pixels to the screen (or off-screen for that matter) quite well.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    244
    Really? So i don't have to use a library at all? Show me how the GDI does that
    Is the GDI included to c++ in VisualStudio 2005 PROF_EDITION ?

  6. #6
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391
    allegro is also another one, comparable to SDL, I can't tell you whether or not its any faster as i don't have much experience in graphics programming.

    to use sdl or allegro, you'll need to know the correct linker commands to use the functions from their libraries, otherwise the compiler is going to say it doesn't know what you're talking about.

    as far as whether or not you need to use the win32 api for either of those...

    i'm pretty sure you create an *emtpy* project, and add all the stuff you need. if you want your app to be *windowed* then you'll need to include "windows.h", although you shouldn't need to use much of the win32 api to accomplish this (i.e. you won't need all those millions of lines of code that typically go into a win32 app.)

    hope this helps somewhat.

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    244
    Hm, but isnt that as matsp said possible with GDI?
    I mean: I'm kinda confues with adding libraries to VC... I tried a couple of times and it never worked...

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    GDI is part of Windows base functionality - it is how your windows appear on the screen, and how this text in this post eventually will be visible on someones machine [assuming that machine is running Windows - at least before Vista, Vista has some new concepts when it comes to drawing to the screen].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Jan 2008
    Posts
    244
    So, how do I add some pixels to the screen/window now?

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Well, first of all you need to implement enough code to put up a window, once you have done that, here's a reference of "Drawing" functions:
    http://msdn2.microsoft.com/en-us/lib...06(VS.85).aspx
    Bitmap functions:
    http://msdn2.microsoft.com/en-us/lib...43(VS.85).aspx

    All windows functions by category:
    http://msdn2.microsoft.com/en-us/lib...86(VS.85).aspx

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #11
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    You should really look into Programming Windows 5th Edition by Charles Petzold.

    Todd

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Note also if you want to really draw individual pixels, it's probably best to create a bitmapsurface, draw pixels there, and then BitBlt the bitmap to the screen [if you want to see updated pixels as it draws, have a count of how many pixels you've been drawing and BitBlt every <choose a number, 256, 1000, 50 or whatever makes most sense>].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Registered User
    Join Date
    Jan 2008
    Posts
    244
    hm... any examples?

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm pretty sure Google can come up with loads - but I don't have any here...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #15
    Registered User
    Join Date
    Jan 2008
    Posts
    244
    google is where i searched. but for me, as i dont know much about GDI, it is hard to find the good examples. i thought you might are?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. standrad library
    By sarahr202 in forum C++ Programming
    Replies: 11
    Last Post: 05-18-2009, 08:50 PM
  2. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM
  3. Good Game library
    By Girvo in forum Game Programming
    Replies: 2
    Last Post: 06-10-2004, 10:17 AM
  4. Graphics Programming :: Approach and Books
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 05-11-2004, 08:33 PM
  5. good vector library
    By rotis23 in forum C Programming
    Replies: 4
    Last Post: 10-08-2002, 11:49 AM