r/GraphicsProgramming • u/bzarnal • Jun 26 '18
SRGP vs. OpenGL vs. SDL
I'm trying to follow Foley's CG book, and I found he uses SRGP, but searching around the internet I found that it's worthless to learn SRGP. So, I'm wondering how does SRGP compare with OpenGL?(Because, that's the only other thing I've heard related to Graphics Programming, and is popular). Would it be Okay to read theory from Foley's book and implement them with OpenGL or something? And How does OpenGL compare with SDL?
2
u/Gobrosse Jun 26 '18
How old is that book ? It's weird anyone would teach current cg methods without leveraging GPU hardware acceleration
1
u/bzarnal Jun 26 '18 edited Jun 26 '18
Don't know about the 3rd edition, but the 2nd edition is probably published in 1987, and 3rd edition from amazon is completely different. https://www.amazon.com/Computer-Graphics-Principles-Practice-3rd/dp/0321399528/ref=sr_1_1?ie=UTF8&qid=1530000672&sr=8-1&keywords=computer+graphics+principles+and+practice
4
u/specialpatrol Jun 26 '18
Dude, the book's like twenty years old, that's a long time in CG, it will only be useful for the absolute fundamentals, any implementation will probably be completely different now.
1
u/bzarnal Jun 26 '18
So, which book do you suggest?
3
u/Tynach Jun 26 '18
Do you have the third edition, or the second edition? It looks like the third edition was written in 2013, and was completely rewritten from scratch to cover new stuff. If you have the third edition, it might still be worthwhile.
1
u/bzarnal Jun 26 '18
I have the 2nd but the 2nd's theory look essential as well, but the SRGP is not
4
u/Gobrosse Jun 26 '18
Do yourself a favour and don't pollute your mind reading that book, at least not until you learn about modern stuff. This book might be fun or interesting as a time piece, but please for your own sake educate yourself with something that's not two decades out of date
1
u/bzarnal Jun 27 '18
Thank you, I am definitely saved from starting out with the outdated version and wasting my time. Do you happen to know a book that goes hand in hand with both the coding and mathematics side of graphics?
1
u/bzarnal Jun 26 '18
plus, I don't know where they come up with another wierd library or whatever it is called WPF, don't know if this is any more useful than SRGP
3
u/hahanoob Jun 26 '18 edited Jun 26 '18
The authors did not come up with WPF: https://docs.microsoft.com/en-us/dotnet/framework/wpf/getting-started/introduction-to-wpf-in-vs. If you're using Windows then it will be trivial to get up and running with it compared to SRGP or anything else really. They chose it to sidestep the distraction of the very"what should I start with" question you're struggling with now. It's an excellent book and if you're willing to put forth the time you'll end with a very complete understanding of the topic which you can then apply to whatever field or particular graphics API you choose.
1
u/bzarnal Jun 26 '18
I'm actually on linux, so probably use a virtual box then?
2
u/Tynach Jun 26 '18
If you want a cross-platform solution, do not use WPF. Instead, for general graphics programming, use SDL instead. It's fairly easy and has an optional abstraction that lets you draw primitives and whatnot without needing to learn OpenGL directly.
A more direct competitor to WPF would be Qt, however. Most Linux distributions have Qt Creator installable from the repositories, so there's no need to deal with the (honestly confusingly set up) installer from the Qt website (which promotes buying a licensed copy for if you want to make proprietary software with Qt, while also modifying Qt, without releasing your Qt modifications).
Since the 2nd edition of that book was written, the absolute fundamentals for how computer graphics work have been reinvented from scratch at least twice. Do not bother with the 2nd edition, even for fundamentals.
→ More replies (0)1
u/specialpatrol Jun 26 '18
Well, since we got here I think SDL+ OpenGL would be a good platform to start with. To get that off the ground you will still want guidance on general c++ programming, if you aren't confident with that already. Once you a framework in place and want to start actually experimenting with graphics code something like GPU Gems is incredibly comprehensive and up to date.
3
u/Tynach Jun 26 '18
Looks like the third edition was published in 2013, so not that old... But if it's still largely based on the 2nd edition, then... Yeah, I'd say toss it.
Ninja edit: The Amazon page says this: "This third edition has been completely rewritten to provide detailed and up-to-date coverage of key concepts, algorithms, technologies, and applications." I'd say it might be worthwhile, as it's not too old.
1
15
u/CptCap Jun 26 '18
Would it be Okay to read theory from Foley's book and implement them with OpenGL or something?
No, the book is just too old. Graphic hardware/technology has been completely reinvented since then.
If you want to get started with real time graphics I recommend learnopengl.com.
4
u/kn4rf Jun 26 '18
SDL is great, and you can set it up so that you can use SDL together with OpenGL. SDL has an impressive list of games that it has been used in. According to a few comments here the book you're looking it might be a bit too old. But SDL + OpenGL is always a safe bet!
Of course in the future we're moving away from OpenGL over to DirectX, Vulkan, and Metal. Learning OpenGL should still be a good start for many years to come, and much of the knowledge will be the same for the newer API's.
You probably want to look at Lazy Foo's SDL tutorials and start out there. Then you can at a later point look at his SDL + OpenGL tutorial and keep going from there. If you are less interested in making games but just want to play with OpenGL then you could also just start using WebGL instead, as this doesn't require any C / C++ code and should be a quick way to get started. A lot of cool stuff has been made over at shadertoy.com directly in the browser.
6
u/teawreckshero Jun 26 '18
This is the first I've heard of SRGP. It looks like a software rasterizer used for academic purposes. You're not going to do any real work with it, just for learning concepts.
OpenGL is an API responsible for talking directly to your GPU. Vulkan and DirectX are two other such APIs. Note that OpenGL and DirectX both have multiple versions, the most widely used ones being OpenGL 4.3 and DirectX11. That said, Vulkan and DirectX12 are the newest APIs, and their structure most closely reflects actual GPU capabilities.
SDL uses OpenGL, along with other APIs, to create a more fully-featured framework that doesn't just render graphics, but then helps you put those rendered images in windows, along with handling keyboard/mouse input, all while remaining OS independent. As far as graphics goes, SDL just does a lot of the unexciting groundwork for you, hands you an OpenGL "context" and then let's you do your own thing.