How to use graphics and sound in C?

  • Thread starter Thread starter Lojzek
  • Start date Start date
  • Tags Tags
    Graphics Sound
Click For Summary

Discussion Overview

The discussion revolves around how to implement graphics and sound in C programming, specifically using DevC++ on Windows. Participants explore various graphics libraries and interfaces, as well as the challenges associated with using them.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about methods to output graphics and sound in C using DevC++.
  • Another participant suggests using GDI for 2D vector graphics on Windows and mentions the possibility of using OpenGL for cross-platform compatibility.
  • A participant expresses a lack of knowledge about graphics types and seeks clarification on using GDI to display colored points on the screen, questioning how to transfer data between C and GDI.
  • One participant explains that GDI is the Windows graphics subsystem and provides a link for further samples of Windows programming.
  • Another participant argues against using GDI due to its complexity and Windows exclusivity, recommending cross-platform GUI toolkits like wx, Qt, and GTK+, while cautioning that using these toolkits requires advanced programming skills.

Areas of Agreement / Disagreement

Participants express differing opinions on the best approach to implement graphics in C. While some advocate for GDI and OpenGL, others recommend avoiding GDI in favor of cross-platform libraries, indicating a lack of consensus on the preferred method.

Contextual Notes

Participants note the challenges of using GDI and the complexity of cross-platform toolkits, highlighting the need for a sophisticated understanding of programming to effectively utilize these libraries.

Lojzek
Messages
246
Reaction score
1
I would like to write a C program that outputs graphics and sound.
I use DevC++.

How can I do it?
 
Technology news on Phys.org
Lojzek said:
I would like to write a C program that outputs graphics and sound.
I use DevC++.

How can I do it?

Well, what type of graphics? Aimed at what operating system? In windows, you can use GDI (graphics device interface) to do 2D vector graphics, and also use bitmaps. You might want to use a cross platform graphics library such as OpenGL to do your graphics if you want to port your application to other operating systems.
 
computerex said:
Well, what type of graphics? Aimed at what operating system? In windows, you can use GDI (graphics device interface) to do 2D vector graphics, and also use bitmaps. You might want to use a cross platform graphics library such as OpenGL to do your graphics if you want to port your application to other operating systems.
I don't know anything about graphics types. I just want to find any way to put colored points on the screen on the specified coordinates calculated in C. I use windows. Can you tell me more about GDI? Is this a program that I can download? And how can I transfer information between C and GDI? I suppose data calculated in C must be put to a file in a specific format?
 
GDI is the Windows graphics subsystem - it's the set of commands to draw a point/line etc in a window. There is also opengl, a more complicated but industry standard way of drawing 2d and 3d objects.
Look at http://www.codeproject.com/KB/GDI/ for samples of windows programming, I assume from the dev c++ you are on windows?.
 
You cannot do these tasks directly from C/C++ alone -- you need to use some kind of a library. The GDI is an interface to Windows directly, and I advise that you do not use it. It's very cumbersome and, of course, locks you into using Windows.

Instead, I'd recommend that you take a look at the various cross-platform GUI toolkits and pick one that suits your needs best. wx, Qt, and GTK+ are all good choices.

Using these toolkits from C/C++ is by no means easy. You'll actually need to be a fairly sophisticated programmer to use them. As a result, I strongly recommend ditching C/C++ entirely, and using a platform like wxPython for your work.

- Warren
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
Replies
15
Views
3K
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 24 ·
Replies
24
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 13 ·
Replies
13
Views
6K