Thread: Easiest way to draw a few rectangles to the screen?

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    145

    Easiest way to draw a few rectangles to the screen?

    Hi, I looking for a graphics library to work with an existing application, all I need is something this is simple to use, and that will allow me to render a frame and then to draw a few rectangles within it every so often.

    Is opengl the way to go or is there something that'll be a bit easier to set up and get running?

    thx

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What plantform(s) [that means OS and/or compiler] do you want this to work on?

    OpenGL is mainly a 3D API, so it's perhaps not the most suitable for 2D drawing, and there's probably other simpler API's for this purpose, but it would depend on the platform which one is the best choice.

    --
    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
    Nov 2005
    Posts
    145
    I'm using Vista (and Microsoft VS 2008, not sure which compiler it's using)

  4. #4
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    Quote Originally Posted by Wiretron View Post
    Is opengl the way to go or is there something that'll be a bit easier to set up and get running?

    thx
    SDL is quite easy to get started with, you can use SDL_Rect for the rectangles, it can be kept very simple...

    http://lazyfoo.net/SDL_tutorials/index.php
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    And would this be a console or "windows" application? If it's a Windows app, then you can easily use the Windows GDI functions, in particular:
    http://msdn2.microsoft.com/en-us/lib...82(VS.85).aspx
    FillRect() should do the thing you want.

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

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    With a Sharpie.

    Slightly harder is to use OpenGL. Check out the tutorials at http://nehe.gamedev.net. One of the first few should be appropriate for modification.
    Last edited by medievalelks; 04-17-2008 at 03:02 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How does MS Excel or Word draw to the screen??
    By Fremontknight1 in forum Windows Programming
    Replies: 2
    Last Post: 07-20-2008, 01:58 PM
  2. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  3. SDL segfault when trying to draw to screen
    By Blizzarddog in forum Game Programming
    Replies: 2
    Last Post: 12-09-2005, 07:53 AM
  4. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  5. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM