Solved

c++ - graphics library

Posted on 2014-04-04
5
310 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
How to gracefully close the c++ 11 thread? 3 160
Header Errors LNK2019, LNK1120 - Unresolved Externals 4 316
print bytes of an integer 6 48
cmake and message 1 22
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

739 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