Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


quick question about OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 ISDCaptain01   Members   -  Reputation: 1433

Like
1Likes
Like

Posted 21 September 2012 - 11:11 AM

I read on some recent thread that OpenGL is backwards compatible with obsolete code? So that means if I were to pick up a book from 7-8 years ago, the code would still run without any tweaking on the newer version of OpenGL?
Is the same true for directx?

Sponsor:

#2 yewbie   Members   -  Reputation: 665

Like
0Likes
Like

Posted 21 September 2012 - 11:15 AM

Is the same true for directx?


Not really most major verisons of DirectX have similar code but vastly different implemenations on much of it.

I am not sure about OpenGL though =)

#3 Goran Milovanovic   Members   -  Reputation: 1104

Like
0Likes
Like

Posted 21 September 2012 - 12:56 PM

The latest versions of OpenGL support old code through something called "a compatibility context". I'm not exactly sure, but I think that's the default; Unless you specifically request (and get) an OpenGL 3.1 context, you're running in compatibility mode, where all the old stuff works.

Old OpenGL books/tutorials are still somewhat useful (the math part didn't really change), but I would recommend learning modern OpenGL, because that will help you leverage the true power of modern hardware.

Visit the OpenGL forum here on gamedev; There are many links there which lead to really useful, modern tutorials.

I really like this one: http://www.arcsynthesis.org/gltut/

+---------------------------------------------------------------------+

| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#4 freakchild   Members   -  Reputation: 557

Like
1Likes
Like

Posted 21 September 2012 - 12:58 PM

I read on some recent thread that OpenGL is backwards compatible with obsolete code? So that means if I were to pick up a book from 7-8 years ago, the code would still run without any tweaking on the newer version of OpenGL?


Don't count on it. New functionality in OpenGL often comes in via extensions. Often, the extensions were such a good idea they were then adopted into the core profile in the next version and whatever was the common practice prior has often been deprecated and won't work unless you specifically choose a version or a legacy compatibility mode.

There's so much OpenGL reference out there that it's actually quite easy to be looking at an older example and not realizing why it won't work. A good example of this would be based on vertex data. The original methods were dropped a long time ago and just about everyone knows that, but things like vertex buffer objects were still optional at that point, yet by 3.X were mandatory. A lot of 2.X examples will compile under 3.X, but won't work...and there are an awful lot of examples out there that are 2.X but not obviously so. To add to the confusion, you'll find a lot of reference where people think they are talking about vertex buffer objects but are actually talking about the predecessor. Then you've got the idea that the internet is also littered (due to the boom in mobile development) with current Open GL ES examples, which might work in 2.X but not in 3.X for the same reasons.

For OpenGL, make sure you have the latest references and if you go looking for examples, try and ascertain the version. Also read the spec, but bear in mind a few key things are described sometimes in just one not very obvious sentence in the open gl spec. RTFM doesn't always apply with open gl due to non-obviousness, even if the information is actually there.

Is the same true for directx?


To some extent yes, but largely no.

For starters, DirectX doesn't have the problem introduced by mobile/ES.

I'd also say that generally, it's a little more obvious when looking at DirectX code which version you're looking at. A lot of this has to do with the idea DX9 was prevalent for a long time and a lot of the examples of DX10/11 are not only flagged as such but also do have some obvious differences and as yewbie mentions, many of the newer features force a differing implementation in the surrounding code. This is very much different to the Open GL vertex buffer objects examples I mentioned above, which look very similar between versions, often with the same function call being used with the only difference being one parameter.

DirectX may at least in part suffer the same problem over time - we could find ourselves in a position at some point where the wealth of DX9 examples are nothing other than misleading.

I think at some point, were going to need some sort of internet command to delete old information or search engines that filter/age out results more intelligently. We'll also be much more thankful of things like Wiki's too - where someone else will come and delete whatever old example I posted 25 years before I died.

Edited by freakchild, 21 September 2012 - 01:11 PM.


#5 Acharis   Crossbones+   -  Reputation: 3877

Like
0Likes
Like

Posted 24 September 2012 - 02:24 PM

Yes, no problem at all. I used to code in OpenGL 10 years ago, recently I tried again and everything works as it used to :) Also everything from the RedBook seems to still work.
Note through that it is not recommended for performance reasons, but if you just need to code something small and don't care about the best speed possible, there is no problem at all, you can just copy/paste your ancient code.

As for DX that's definitely not true.

Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS