Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c++ - graphics library

Posted on 2014-04-04
5
Medium Priority
?
314 Views
Last Modified: 2014-04-22
Hi,

I have to generate few lines, circles and rectangles and connect them by lines. Please suggest me any graphics library that I can use with VC++ 2012.

I checked SDL and it looks very complicated to draw even a single line. Please  suggest me any library that I can use for my work or which is easy to use.

Thanks
0
Comment
Question by:josephm67
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Assisted Solution

by:Pasha Kravtsov
Pasha Kravtsov earned 664 total points
ID: 39978391
There probably (guaranteed) won't be any libraries that are just 'easy' to use for C++. I recommend starting to learn DirectX8/9/10/11 or OpenGL
http://www.directxtutorial.com/LessonList.aspx?listid=9

Have fun and good luck.
0
 
LVL 86

Accepted Solution

by:
jkr earned 1336 total points
ID: 39978603
For this task you can just go with GDI+ which comes with VC++ (OpenGL and DirectX are overkill here, with all due respect). See the technical dos and reference at http://msdn.microsoft.com/en-us/library/windows/desktop/ms533798%28v=vs.85%29.aspx ("GDI+") and a tutorial at http://www.codeproject.com/Articles/1112/Starting-with-GDI ("Starting with GDI+"). Drawinf a rectangle then can be as simple as

CPaintDC dc(this); // Creates a device context for the client area, which
                   // also erases the area to be drawn.

CPen MyPen, * pOldPen;
CBrush MyBrush, * pOldBrush;
// A red pen, one pixel wide
MyPen.Create(1, PS_SOLID, RGB(255,0,0));

// Selecting an object returns the old one
// we need to catch and return it to avoid memory leaks
pOldPen = dc.SelectObject(&MyPen);       
                                          
// A Blue brush                                         
MyBrush.CreateSolidBrush(RGB(0, 0, 255)); 
pOldBrush = dc.SelectObject(&MyBrush);

// Finally, we have our device context set up with our pen and brush and can
// use them to draw.
//Draws a rectangle that is red on the outside, filled in blue 
dc.Rectangle(0, 0, 200, 200); 
dc.SelectObject(pOldPen);
dc.SelectObject(pOldBrush);

Open in new window

0
 
LVL 5

Expert Comment

by:Pasha Kravtsov
ID: 39978615
Dang I totally forgot about GDI+, I might use this too here soon thanks jkr.
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 1336 total points
ID: 39990514
Do you have any other questions regarding this issue?
0
 

Author Closing Comment

by:josephm67
ID: 40014540
thx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.
Suggested Courses

721 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