Can Graphics be Created in C++ and Used in Source Code?

  • Context: C/C++ 
  • Thread starter Thread starter JamesU
  • Start date Start date
  • Tags Tags
    C++ Graphics
Click For Summary

Discussion Overview

The discussion revolves around the creation and integration of graphics in C++ programming, including the use of graphics files and the potential for incorporating code from other programming languages within C++ documents. The scope includes technical explanations, proposed libraries, and tools for graphics development.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants suggest using the Windows GDI, MFC classes, DirectX, or OpenGL for graphics in C++, while others mention SDL and Qt libraries as alternatives.
  • There is a discussion about embedding code from other languages into C++, with one participant stating that direct embedding is not possible unless translated to C++, while noting that some compilers support embedded assembly language.
  • One participant mentions the possibility of embedding MATLAB code in C++, although this is not elaborated upon.
  • Another participant recommends using the GD library for creating and editing images, while acknowledging a misunderstanding regarding the original question about using other languages.
  • One participant suggests using the Allegro library for graphics, describing it as enjoyable and easy to use, although this is presented as a personal opinion.

Areas of Agreement / Disagreement

Participants express various perspectives on the tools and libraries available for graphics in C++, with no clear consensus on the best approach or method for embedding other languages.

Contextual Notes

Some limitations include the lack of clarity on specific requirements for graphics integration and the varying levels of familiarity with different libraries among participants.

Who May Find This Useful

Readers interested in graphics programming in C++, exploring different libraries and methods for integrating graphics and other programming languages.

JamesU
Gold Member
Messages
828
Reaction score
3
Is there a way to create graphics in C++. or in some other language, and I can use the grphic file in the C++ source code?
 
Technology news on Phys.org
also, how could I put a code with another language in the middle of a C++ document?
 
If you're using Windows, you could use the GDI through the Windows API or through the MFC classes, or you could use DirectX or OpenGL for 3D high-speed graphics. You could also use any number of available libraries, SDL for example. In Linux, you're going to have to go through the X libraries (not recommended). Probably you should use some toolkit, like the Qt libraries. For 3d graphics, you can use OpenGL, or OpenGL + SDL (thats what I use).
Also, I don't get what you mean by embedded another language into a C++ document. If you mean whether you can embed code from another language into a C++ source file, then no, unless you translate it to C++, because the compiler only compiles C/C++ and not any other language. However, most compilers do support some form of embedded assembly language. The MSVC compiler uses the "__asm" keyword I believe. In gcc/g++ it would be asm("...")
 
you can embed MATLAB too apparently.
 
dduardo said:
cefarix, your going a little overboard.

If you simply want to create and edit images then use this:

http://www.boutell.com/gd/

Ah, sorry. I missed the part where he said "or any other language." I thought he wanted to do it via C++ only ...
 
You mean she. Also GD is written in C so it works with C++.
 
Why not do some really enjoyable stuff with graphics and play some games?
Try allegro
http://www.talula.demon.co.uk/allegro/

Its enjoyable and easy to play around with (well atleast i found it easy to play around it, so i may be generalising a bit too much here). There are lots of demos to help you around.

-- AI
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 21 ·
Replies
21
Views
3K
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 24 ·
Replies
24
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K