5 Replies - 5561 Views - Last Post: 28 July 2012 - 04:06 PM

#1 mrudul89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-July 12

C++ graphics programming

Posted 22 July 2012 - 07:33 AM

So I am new here and have been learning c++ for a while. I think I have learned quite a lot and it's time to make a big c++ application.
I am planning to make an application to teach Physics (generally High school). As you would expect this application will include demonstrations, simulations, equations and a lot more. I've learned windows sdk, managing events and many other stuffs to develop an application.
However, the problem is GRAPHICS. I don't know where to begin with. Ofcourse I want to include images, sprites and add some graphical effects to make a good quality application. I don't know which graphics libraries would be suitable to make such application. Lot of pages on internet suggest OpenGL and DirectX. But, they are more 3D oriented and I am only interested in 2D graphics. Ofcourse I can use OpenGL and DirectX for 2D graphics as well but I am worried if my application does not work well in old systems since both OpenGL and DirectX both make use of video hardware. What if the system does not have a good video card? Would my application still be Okay? And besides this is just a physics application and there won't be a lot of rendering.
For 2D graphics they suggested SDL and SFML. But I don't want to use those libraries. They make work kinda easy. I want to learn more about graphics and how c++ draws stuff on computer screen. I also thought about GDI or GDI+ and they both are included with windows sdk. But I think they are made for older versions like windows XP or 2003. What if the application does not run well on windows 7?
Basically I want to know if I use GDI will it run well on new systems? Or if I use OpenGL or Direct3D will they not suffer from bad framerate in old systems? I just want to make an application which would run fine on all systems. And I won't include any special or high quality effects like those you see in games. Which graphics API should I use for this purpose?

Is This A Good Question/Topic? 0
  • +

Replies To: C++ graphics programming

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1001
  • View blog
  • Posts: 3,555
  • Joined: 05-June 09

Re: C++ graphics programming

Posted 22 July 2012 - 07:51 AM

GDI/GDI+ aren't so great for high-performance (not to say you couldn't make it do the job, though!), if you're looking to use DirectX/OpenGL I would suggest Direct2D if you're doing primarily 2D work.

I don't see why SDL would distract from you learning how stuff works, you have to just remember that all of these libraries are essentially working directly with the graphics card drivers themselves, and that's how it renders stuff :)

This post has been edited by RudiVisser: 22 July 2012 - 07:53 AM

Was This Post Helpful? 0
  • +
  • -

#3 mrudul89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-July 12

Re: C++ graphics programming

Posted 22 July 2012 - 11:24 AM

Hey! Thanks for the reply :bigsmile:
I suppose Direct2D interacts directly with your video card. So if I use latest Direct2D libraries will the application not suffer from poor performance in systems with very cheap video card?
Like I said before I don't want to render high quality graphics. Just small stuffs like drawing graphs, circles, shapes and all that... I don't care about quality. Just the performance.

And the reason I don't prefer SDL/SFML is that they don't let you understand what goes on behind those APIs. That is to say if you want to draw a circle it would take just couple of codes with SFML but, a lot more without any API.
Was This Post Helpful? 0
  • +
  • -

#4 ishkabible  Icon User is offline

  • spelling expret
  • member icon





Reputation: 1616
  • View blog
  • Posts: 5,707
  • Joined: 03-August 09

Re: C++ graphics programming

Posted 22 July 2012 - 04:57 PM

SDL doesn't work with the graphics card unless you tell it to use hardware acceleration. it also doesn't do as good a job as Direct2D or OpenGL can becuase it has to maintain the same functionality(namely, respecting the data member of SDL_surface which OpenGL and Direct2D would prefer to have as a framebuffer or texture.

This post has been edited by ishkabible: 22 July 2012 - 05:06 PM

Was This Post Helpful? 0
  • +
  • -

#5 vividexstance  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 630
  • View blog
  • Posts: 2,107
  • Joined: 31-December 10

Re: C++ graphics programming

Posted 24 July 2012 - 09:19 AM

View Postmrudul89, on 22 July 2012 - 02:24 PM, said:

And the reason I don't prefer SDL/SFML is that they don't let you understand what goes on behind those APIs. That is to say if you want to draw a circle it would take just couple of codes with SFML but, a lot more without any API.

The point of most libraries is that you shouldn't have to understand how the library does what it does just to be able to use that library. Another point I'd like to make is if you do want to see how the library works, just download the source and go through the implementation files (.cpp files).
Was This Post Helpful? 0
  • +
  • -

#6 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: C++ graphics programming

Posted 28 July 2012 - 04:06 PM

> I am planning to make an application to teach Physics (generally High school). As you would expect this application will include demonstrations, simulations, equations and a lot more.

Before you get started, you should determine all the features in your program. Then figure out the level of effort it would take for each of those features, which then determines the timeline before you can get anything out the door. That's an important reality check.

> But, they are more 3D oriented and I am only interested in 2D graphics.

2D is 3D. You just aren't working with the third dimensions (or nowhere near as much).

> Ofcourse I can use OpenGL and DirectX for 2D graphics as well but I am worried if my application does not work well in old systems since both OpenGL and DirectX both make use of video hardware.

Depends on how old and out of date. If you're supporting old systems, OpenGL 1.4 and Direct3D 9.0c are not bad targets. If you want it to work on even more uncertain environments, you need software rendering (like in SDL or the GDI APIs, etc.).

> For 2D graphics they suggested SDL and SFML. But I don't want to use those libraries. They make work kinda easy.

I hope that would be the idea. Do want to write your own C++ compiler too? I mean, using a premade one would be too easy...

Have you actually sat down, evaluated the scope of your project, and determine how many hours you should budget for it? It's easy to throw ideas around. But if it were so easy to execute, every man and dog would have wonderful software out there.

Get your head out of the clouds for once and think about the amount of work you are building out for yourself. And if you can't evaluate the amount of work required for your project, you have more learning to do.

> I want to learn more about graphics and how c++ draws stuff on computer screen.

C++ itself does nothing.

> I also thought about GDI or GDI+ and they both are included with windows sdk. But I think they are made for older versions like windows XP or 2003.

They are older APIs, but they still continue because there is no replacement.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1