Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Way to create graphics in C++

  1. Sep 9, 2005 #1

    JamesU

    User Avatar
    Gold Member

    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?
     
  2. jcsd
  3. Sep 9, 2005 #2

    JamesU

    User Avatar
    Gold Member

    also, how could I put a code with another language in the middle of a C++ document?
     
  4. Sep 9, 2005 #3
    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 gonna 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("...")
     
  5. Sep 9, 2005 #4
    you can embed matlab too apparently.
     
  6. Sep 9, 2005 #5

    dduardo

    User Avatar
    Staff Emeritus

    cefarix, your going a little overboard.

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

    http://www.boutell.com/gd/
     
  7. Sep 9, 2005 #6
    Ah, sorry. I missed the part where he said "or any other language." I thought he wanted to do it via C++ only ...
     
  8. Sep 9, 2005 #7

    dduardo

    User Avatar
    Staff Emeritus

    You mean she. Also GD is written in C so it works with C++.
     
  9. Sep 10, 2005 #8
    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
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Way to create graphics in C++
  1. No way (Replies: 4)

  2. Graphics Problem (Replies: 2)

  3. Graphics Programs? (Replies: 6)

Loading...