Sign in to follow this  
biggjoee5790

what can be done?

Recommended Posts

I have been reading all about people learning to make windows apps, 3d games, GUI's and such. Most of them are using OpenGl, Win32, DirectX , etc. Now it seems like the programs are using C languages most of the time. Since I am learning to program with Python, I was wondering If I can use it to create the same apps that people can create with C based languages. Now I know you can create 2d games with Pygame. But what about 3d, windows apps, etc? Can you create this sort of stuff in python, if so what allows you to do so. Im asking this because while learning Python, Ive been reading up on alot of posts on this site. I am reading about games and other apps people are creating with Win32, directx, opengl, etc. Since most are using C++, I was concerned about Pythons ability to create these types of programs. Learing how to program for the first time with Python is challenging in itself, I dont want to later find that I need to completely learn C++ to do what I want to do, making my Python learning pretty much useless, while I could have been using the time to learn C++. I may be totally wrong about this, If I am please someone clear this up.

Share this post


Link to post
Share on other sites
Since I never did any Python don't take seriously whatever I say since it might be very powerful and/or similar to other languages.

Still it's exactly the reason why I usually tell people who don't know where to go to start straight in C and in DirectX/OpenGL. I know there is a lot of peps here recommend Python+PyGames for starters so I'll let them answer..

Share this post


Link to post
Share on other sites
Quote:
Original post by Dunge
Still it's exactly the reason why I usually tell people who don't know where to go to start straight in C and in DirectX/OpenGL.

What reason?


Anyway, python is a fully featured programming language, just like c or c++.
C or c++ can't do graphics. They can't do GUIs or networking or anything.

Its all about libraries. C and C++ can be trivially linked with all sorts of libraries ( as most libraries are written with this in mind). Python can also use these libraries, but the process is more involved. For example, the pygame python library is really just a python interface to the SDL c library.

However, I imagine there are python bindings to opengl, allowing accelerated 3d graphics, and python GUI libraries too.

Share this post


Link to post
Share on other sites
Like rip-off said it's all about the libraries. Fortunately it's fairly easy to create Python bindings for C based libraries. There are python bindings for OpenGL, Ogre, wxWidgets, irrlicht, Qt and many other great libraries.

There are also Python implementations based on Java and .NET (Jython and IronPython) that allow you to work with those libraries as well.

All in all, Python is a good choice if you want lots of options with this sort of thing [smile]

Share this post


Link to post
Share on other sites
Yes, you can.

You can make GUI applications with Tkinter, as well as with a number of other libraries should you so desire. This is what you might commonly use to develop GUI tools or simpler games which have a "windows GUI" feel to them; people developing in other languages might use Win32, MFC or winforms to achieve similar results.

You can create 3d applications using PyOpenGL or Panda3d or PyOgre amongst many other options. People using other programming languages might use OpenGL or DirectX or Allegro to achieve similar results.


You may have seen mention of people using SDL with C++ as it's quite a common option; PyGame is actually built on top of SDL.


Anything you can do with C++ you can also do with Python; your final product may however be less runtime-efficient than well-optimised C++, but the tradeoff is that it's very significantly more difficult to write well optimised and stable C++ than it is to produce clean efficient Python.


If you get good with Python you'll also find it significantly easier to learn C++ at a later date should you feel the need to do so.

Share this post


Link to post
Share on other sites
Anything you can do in C++ you can usually do with less, more readable code in Python... but with a bit more runtime overhead. I'v done a molecule structure visualization program in python with OpenGL and it was fast enough.

Speed is usally limited by algorithms, and you will more easily learn good algorithms in python. Of course there is a higher constant overhead in python, but it will take you a long time before this is a problem - if ever, computers are getting faster, and performnace in 3d apps has a lot to do with how efficient you feed the GPU (for example the 3d XNA demos are looking pretty slick, and C# is not a static compiled language (albeit less dynamic/powerful, but faster than python).

Share this post


Link to post
Share on other sites
Quote:
Original post by Glak
why would you ever tell a beginner to start with C when C++ exists? The scanf function is enough to make C unsuitable for beginners.


I would say that the "single cause of unsuitability" is more neatly expressed as "lack of a proper built-in string type".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this