After learning the basics of computing simple die throwing games and calendar applications, I want to explore simple graphics – drawing and moving around geometric objects is ok to start with, eventually adding pixel graphic of course.
I’ve taken an introductory Java course but would rather do it in C++, Python or a combination of them (that’s what we will eventually be using in school). I also want to learn the principles behind it, not just blindly applying incomprehensible syntax to make the compiler happy.
Some posts seem to imply SFML is a solid choice, so I thought I’d get a book covering it and work through it, but there only seems to be ONE book on SFML available, and that one hasn’t been reviewed at all. Not in the mood for a $30 gamble, so I’m feeling kind of lost!
How should I approach learning basic graphics programming?
2
As a starting point I’d recommend Googling the following keywords:
- Transformation Matrix
- World Matrix
- View Matrix
- Projection Matrix (This one is really only valid if you’re wanting to do 3D)
Matrices are more of a mathematics thing, but they’re crucial to understanding how a system like Direct3D or OpenGL is working, so if you’re wanting to do more than just follow instructions I recommend understanding the use of Matricies within code.
You’ll probably need to build up a lot of practice with code though to be able to apply all of these principles in code.
You can write graphics code without understanding the underlying math, but I find it a lot more fun (less frustrating) to program when I understand the entirety of the system I’m building.
I don’t know what the best way to go about learning the coding side of it specific to Java though.
1
SFML is indeed a good choice to begin with, at least in my opinion. From what I’ve heard, it’s easier than SDL and Allegro. It’s also in C++ while the two others are more C based. Personnaly, it’s the one I’m trying to pick up at the moment.
SFML offers binding for many other languages (C, Python, Ruby, etc.) and many custom bindings can be found. It is based on five modules and you can use whichever you need: Graphics, Window, Audio, Network, System. It works under Window/Mac/Linux. It can also use OpenGL.
As for the book, I do not know about it. However, the SFML wiki is quite good and offer a lot of resources to start working with it. Furthermore, the SFML wiki forwards to some tutorials and helpful pages to start working with the library. For instance, I found the CodingMadeEasy youtube video series that goes through SFML 2.0 over a few hours and is a useful introduction. Paired with the documentation and wiki pages, it shouldn’t be hard to pick up, for only $0.
1
I’ve recently begun learning OpenGL using C++. It is usable on multiple platforms, and there are a plenty of options for binding it with other languages. Plus, you can also apply it to the variations of OpenGL such as WebGL, OpenGL ES, etc.
http://www.opengl-tutorial.org/
The website above is a good place to start and also suggests other resources for those just getting started.
I have appreciated the Processing language and The Nature of Code ( http://natureofcode.com/book/ ) for this purpose.
Processing ( processing.org ) is built on top of Java, but requires almost none of the boilerplate you would expect with Java. As far as language goes, I wouldn’t worry too much about what language you learn these skills in as they are somewhat language agnostic. The skills will transfer. What I like about Processing is that it’s all about getting to the point of, e.g., what is a normalized vector and what’s it for.
The Nature of Code walks you through getting graphics on the screen w/ Processing and the physics you are trying to represent.
And both are free.
Speaking a bit more generally, I would recommend a framework with as few ‘moving parts’ outside of the concept you are trying to learn as possible.