Solved

c++ - graphics library

Posted on 2014-04-04
5
312 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 166 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 334 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 334 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

626 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