After a long stint on XNA and Direct3D I’ve recently come back to OpenGL. Whilst reading the specs and docs to come up to speed on the latest version of OpenGL I ended up writing a basic OpenGL 3.1 (forward compatible 3.0) app to help with my learning. Anyway I’m releasing the code in the hopes that other developers in a similar situation might find it useful.
That’s great, thanks very much for your contribution, I’m sure it will help quite a few people get started with the forward compatible OpenGL 3.x series.
However I want to make some comments regarding it.
Having read Mark Kilgard’s recent comments on deprecation, I have to agree somewhat with him that at this stage deprecation could possibly increase your hacking time a little…
I did an sloccount on your code to determine the total amount of effort required to initialise a context, set up a quad and texture it with a png.
Total Physical Source Lines of Code (SLOC) = 5,607
Schedule Estimate, Years (Months) = 0.58 (6.94(Months!))
Est’d Avg # of devs (Effort/Schedule) = 2.11
Total Estimated Cost to Develop = $ 165,123
Yeah yeah, it’s good fun to play with sloccount… but still, 5607 lines of code.
To put this in perspective, I wrote an OpenGL API 1.1 wrapper header that does complete 2D ortho texture and quad management with png decoding built-in to the header itself and when I sloccounted it, it came to 2,376 lines of code for the whole thing. -Less than half the size of this example.
I’m guessing the 3 series is at an early stage where wrangling utilities/headers haven’t been developed yet. Because the boiler-plate 3.x code seems to be fairly verbose.
And finally from the code:
// OpenGL 3.0 also deprecates fixed-function vertex processing. This means
// that we also need to calculate the projection, view, and model matrices
// by ourself.
Oh… /Reads book on calculating projection, view and model matrices. (sigh)
Nice example. I really like the stuff on your site.
but still, 5607 lines of code.
Did you look at the code? There’s almost 3000 lines of (probably auto-gen’ed) code for getting function pointers. Plus code for mouse etc.