Jump to content

  • Log In with Google      Sign In   
  • Create Account


Tips when learning a Graphics API like OGL and DX11?


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
12 replies to this topic

#1 Zero_Breaker   Members   -  Reputation: 363

Like
0Likes
Like

Posted 16 January 2014 - 08:33 AM

Hi guys.

 

After learning to render a Triangle on DirectX11 and looking at the documentation, i noticed that in actaul fact i was better of with OpenGL despite its lack of documenatation it was much more straightforward to render a triangle because i understood how upload co-ordinates to the GPU and configure shaders to show what you want to be rendered and how.

 

I think though that trying to learn DirectX and notice how much difference and speed of learning there was helped me reach a better decision on which API to use.

 

I also think that Microsoft won't last forever, there will be a time when they will go bankrupt and another company may succeed them. I also think that linux will be the future OS for Desktop's because it is Open-Source and free. It is community based and there is no big corp like Microsoft which control's everything and is Close-source.

 

Currently Linux has less game support than Windows and the only reason i use windows is for games/game development. If Linux had better support for games/game development than i would delete windows straight away and install a Linux Distro.

 

That being said, what are the best ways to remember 3D Graphics code and should i read book's or use online tutorials more?

 

How did you learn to program 3D Graphics and what resources did you use?

 

Is it best to read about 3D Graphics themselves to use the API's better?

 

Any answers or input would be quite valuable and i would greatly aprreciate it as alway's.



Sponsor:

#2 frob   Moderators   -  Reputation: 20102

Like
5Likes
Like

Posted 16 January 2014 - 09:58 AM

After learning to render a Triangle on DirectX11 and looking at the documentation, i noticed that in actaul fact i was better of with OpenGL despite its lack of documenatation it was much more straightforward to render a triangle because i understood how upload co-ordinates to the GPU and configure shaders to show what you want to be rendered and how.

This is one of many well-established tradeoffs that is done differently in each of them.

OpenGL allows access to any function, including those that are very old and inefficient, and those that are brand new or even experimental.

DirectX allows access to a specific combination of feature sets, eliminating those that are inefficient and those that are experimental.

Both approaches have their own sets of pros and cons and are discussed at length in other posts. Search the forum if you are interested in that debate.

I think though that trying to learn DirectX and notice how much difference and speed of learning there was helped me reach a better decision on which API to use.

Yes, more knowledge helps make informed decisions.

I also think that Microsoft won't last forever, there will be a time when they will go bankrupt and another company may succeed them. I also think that linux will be the future OS for Desktop's because it is Open-Source and free. It is community based and there is no big corp like Microsoft which control's everything and is Close-source.

Forever is a very long time. I expect neither will last forever. In the near term of the next decade neither is going away.

Currently Linux has less game support than Windows and the only reason i use windows is for games/game development. If Linux had better support for games/game development than i would delete windows straight away and install a Linux Distro.

That's an odd thing to say. I started with dual-boot of linux and windows back around 1997, and had dedicated machines for both starting around 1999. It is not an either/or style decision, you can have both and more besides.

That being said, what are the best ways to remember 3D Graphics code and should i read book's or use online tutorials more?

Read a lot. This includes not just books (of which there are many good ones) and online tutorials (sadly many are poor), but also conference papers and research work in both computer graphics fields and also pure math and physics fields.

Graphics programming is a very broad field, and many people specialize not just in graphics generally but instead specialize on a single facet of graphics programming.
 

How did you learn to program 3D Graphics and what resources did you use?

I started back before OpenGL was a thing, learning my toy programming on the CGA monitors that had four colors, programmed on banks of colors. From there I skipped to raw VGA programming that allowed you to chain together the banks of colors and made things easier. I cut my teeth on 3D back when ModeX was becoming popular, then learned OpenGL. I never specialized in graphics and have relied on other people to do that work; I find it tedious.
 

Is it best to read about 3D Graphics themselves to use the API's better?

Both. As analogies: Is it best to read about matrix manipulations or to learn to use existing libraries? Is it best to read about core data structures or to learn to use standard libraries? Is it best to read about theory or to rely entirely on other people's implementation?

If you don't understand the fundamentals you won't be able to effectively leverage the tools.

 

 

More knowledge is a good thing.


Check out my personal indie blog at bryanwagstaff.com.

#3 richardurich   Members   -  Reputation: 1187

Like
2Likes
Like

Posted 16 January 2014 - 10:05 AM

I have no idea if you're right or wrong about Linux vs. Windows, but it probably doesn't matter anyways.

 

If you want to develop an OpenGL game on Linux, it works fine unless you're using a game engine that lacks Linux support. I just dual boot with Windows so I can make sure it runs on both Linux and Windows. SDL2 or something similar helps keep OS-specific problems to a minimum. I run into the occasional minor problem (PRI64u instead of llu, mingw-w64 lacking quick_exit, etc.), but it's all really minor stuff. Is there a certain problem you're having on Linux other than game engine of choice not existing? I can't make your game engine of choice work on Linux, but other problems might be fixable.

 

For learning 3D graphics, there's a million tutorials now. Just find some and mess around. When you think "I wonder what would happen if..." just try it and find out. You'll make mistakes, and you'll fix them. You'll hit brick walls, and you'll blast through them. It's all part of the learning process. Just dive in and start the process. I strongly recommend against my approach of starting on a C64, advancing to a 186 Intel (yey for a chip Intel tries not to admit ever existed), etc. It's a pretty long trek to get up to 3D graphics that way, and even when you get there it starts with 3dfx glide instead of OpenGL or DirectX.

 

I've never read about 3D graphics in the abstract, other than papers on specific features and such. That means I can't say you should or shouldn't, but I can absolutely say it is extremely possible to just learn 3D graphics by actually doing 3D graphics. I guess I was always the type that would rather ride a bike than read about riding a bike.


Edited by richardurich, 16 January 2014 - 10:10 AM.


#4 Zero_Breaker   Members   -  Reputation: 363

Like
0Likes
Like

Posted 16 January 2014 - 11:00 AM

I have no idea if you're right or wrong about Linux vs. Windows, but it probably doesn't matter anyways.

 

If you want to develop an OpenGL game on Linux, it works fine unless you're using a game engine that lacks Linux support. I just dual boot with Windows so I can make sure it runs on both Linux and Windows. SDL2 or something similar helps keep OS-specific problems to a minimum. I run into the occasional minor problem (PRI64u instead of llu, mingw-w64 lacking quick_exit, etc.), but it's all really minor stuff. Is there a certain problem you're having on Linux other than game engine of choice not existing? I can't make your game engine of choice work on Linux, but other problems might be fixable.

 

For learning 3D graphics, there's a million tutorials now. Just find some and mess around. When you think "I wonder what would happen if..." just try it and find out. You'll make mistakes, and you'll fix them. You'll hit brick walls, and you'll blast through them. It's all part of the learning process. Just dive in and start the process. I strongly recommend against my approach of starting on a C64, advancing to a 186 Intel (yey for a chip Intel tries not to admit ever existed), etc. It's a pretty long trek to get up to 3D graphics that way, and even when you get there it starts with 3dfx glide instead of OpenGL or DirectX.

 

I've never read about 3D graphics in the abstract, other than papers on specific features and such. That means I can't say you should or shouldn't, but I can absolutely say it is extremely possible to just learn 3D graphics by actually doing 3D graphics. I guess I was always the type that would rather ride a bike than read about riding a bike.

For the OS argument its a matter of preference for each person, for me i prefer Linux because i love to modify something that suits me best. There is no right or wrong for those two since both have con's and pro's.

 

I agree with experimenting with anything . Everything i do i always try to see what that function can do because there are so many options you can do with it.

 

I am quite practical and learn things by doing but also then try to expand my skill by reading theory after i learned some of the things practically.

 

 

 

After learning to render a Triangle on DirectX11 and looking at the documentation, i noticed that in actaul fact i was better of with OpenGL despite its lack of documenatation it was much more straightforward to render a triangle because i understood how upload co-ordinates to the GPU and configure shaders to show what you want to be rendered and how.

This is one of many well-established tradeoffs that is done differently in each of them.

OpenGL allows access to any function, including those that are very old and inefficient, and those that are brand new or even experimental.

DirectX allows access to a specific combination of feature sets, eliminating those that are inefficient and those that are experimental.

Both approaches have their own sets of pros and cons and are discussed at length in other posts. Search the forum if you are interested in that debate.

I think though that trying to learn DirectX and notice how much difference and speed of learning there was helped me reach a better decision on which API to use.

Yes, more knowledge helps make informed decisions.

I also think that Microsoft won't last forever, there will be a time when they will go bankrupt and another company may succeed them. I also think that linux will be the future OS for Desktop's because it is Open-Source and free. It is community based and there is no big corp like Microsoft which control's everything and is Close-source.

Forever is a very long time. I expect neither will last forever. In the near term of the next decade neither is going away.

Currently Linux has less game support than Windows and the only reason i use windows is for games/game development. If Linux had better support for games/game development than i would delete windows straight away and install a Linux Distro.

That's an odd thing to say. I started with dual-boot of linux and windows back around 1997, and had dedicated machines for both starting around 1999. It is not an either/or style decision, you can have both and more besides.

That being said, what are the best ways to remember 3D Graphics code and should i read book's or use online tutorials more?

Read a lot. This includes not just books (of which there are many good ones) and online tutorials (sadly many are poor), but also conference papers and research work in both computer graphics fields and also pure math and physics fields.

Graphics programming is a very broad field, and many people specialize not just in graphics generally but instead specialize on a single facet of graphics programming.
 

How did you learn to program 3D Graphics and what resources did you use?

I started back before OpenGL was a thing, learning my toy programming on the CGA monitors that had four colors, programmed on banks of colors. From there I skipped to raw VGA programming that allowed you to chain together the banks of colors and made things easier. I cut my teeth on 3D back when ModeX was becoming popular, then learned OpenGL. I never specialized in graphics and have relied on other people to do that work; I find it tedious.
 

Is it best to read about 3D Graphics themselves to use the API's better?

Both. As analogies: Is it best to read about matrix manipulations or to learn to use existing libraries? Is it best to read about core data structures or to learn to use standard libraries? Is it best to read about theory or to rely entirely on other people's implementation?

If you don't understand the fundamentals you won't be able to effectively leverage the tools.

 

 

More knowledge is a good thing.

 

I already know about 3D Math's subjects like Linear Alegbra, Matrix Manipulation ,Calculus and etc. I mostly want to be able to create a 3D Game renderer which render's 3D Model's and Maps to be used in my games. I also agree that most tutorial's are quite poor when learning OpenGL however, i think that overtime as one start's to familriase himself/herself with a 3D API they can recongise the mistakes and improve on them through exprience and improve that skil by as you said, reading book's and Computer Science notes/lectures.

 

 

Thank's a lot for your input, it was very helpful and i aprreciate your advice,



#5 L. Spiro   Crossbones+   -  Reputation: 13163

Like
7Likes
Like

Posted 16 January 2014 - 03:51 PM

We already had this discussion and it was I who suggested Direct3D 11 to you.
Yes it works in mysterious ways.  Create a texture, and then a resource view, and then a target view?  What’s all this jazz?
 
 
I had assumed you were going to base your decision off what would be more relevant to your future.  All platforms are slowly switching to a Direct3D 11 model.  Windows Vista SP1, Windows 7, Windows 8, Xbox One, and PlayStation 4 are already there.  Yes, even Sony, competitor of Microsoft, uses Direct3D 11 (99% anyway).  Microsoft will be around longer than you will be alive, but it doesn’t really matter because Sony proves it is the future of graphics whether Microsoft is here or not.
 
Even OpenGL is switching to the Direct3D 11 model.  They are just trying to do it while sticking to a state machine and keeping as much back support as they can.
Direct3D introduces a feature such as constant buffers and OpenGL follows suit.  No other graphics API (Nintendo DS Nitro, Nintendo 3DS GR, PlayStation Portable native, PlayStation Vita native, PlayStation 3 native, Xbox 360 Direct3D 9, all mentioned above) use a state machine or the especially problematic bind-to-edit mechanism.  Recent extensions (and the future standard) of OpenGL are also trying to get away from the bind-to-edit model, acknowledging it as a flaw.
 
 
If I had known you were going to choose based on which is easiest to learn, I would have recommended Direct3D 9.
In terms of ease to learn, Direct3D 9 and OpenGL are fairly similar, but Direct3D 9 isn’t exposed as a state machine and is better documented.
 
 
As I mentioned the first time you asked this question, OpenGL’s only selling point is that it is cross-platform, but that really isn’t the case.
Even Minecraft apparently did not support certain Intel cards.
You will have fine support on Mac OS X and Linux, but it will be hit-and-miss on Windows.
 
 
Based on our previous discussions, I retract my suggestion for Direct3D 11 and suggest Direct3D 9 instead.  Being object-oriented, a lot of it just makes more sense and is easier to grasp (something to which you already admitted).
And to quote John Carmack, “…DX9 is really quite a good API level. Even with the Direct3D side of things, where I know I have a long history of people thinking I’m antagonistic against it. Microsoft has done a very, very good job of sensibly evolving it at each step—they’re not worried about breaking backwards compatibility—and it’s a pretty clean API. I especially like the work I’m doing on the 360, and it’s probably the best graphics API as far as a sensibly designed thing that I’ve worked with.”
 
 
The bit about them not being afraid to break backwards compatibility is something I have also been considering as the main reason for many of OpenGL’s current and future problems.  OpenGL could really make big progress if they would be willing to just release a clean new API in which you simply know the whole time you are using features from this version and only this version.  Nothing deprecated or poorly supported or something that will cause it to go into software mode (as pixel buffers are known to do).
This is one thing OpenGL ES 2.0 does right.  It’s still a state machine and uses the bind-to-edit model, but it’s a compact API with no feature support used just as carry-on.  They don’t try to just give you the option of using shaders, they force you into it.  And that is a good thing.
 
In fact, despite being a state machine and bind-to-edit, if OpenGL ES 2.0 is an option for you I would recommend learning it equally as much as I would recommend Direct3D 9.  And I would definitely recommend it before learning desktop OpenGL.
 
 
L. Spiro

Edited by L. Spiro, 18 January 2014 - 11:34 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#6 Irlan   Members   -  Reputation: 1454

Like
1Likes
Like

Posted 16 January 2014 - 03:54 PM

Start with DX not with OpenGL. Read Frank De Luna's book (DX11).



#7 Zero_Breaker   Members   -  Reputation: 363

Like
0Likes
Like

Posted 16 January 2014 - 05:39 PM

We already had this discussion and it was I who suggested Direct3D 11 to you.

Yes it works in mysterious ways.  Create a texture, and then a resource view, and then a target view?  What’s all this jazz?
 
 
I had assumed you were going to base your decision off what would be more relevant to your future.  All platforms are slowly switching to a Direct3D 11 model.  Windows Vista SP1, Windows 7, Windows 8, Xbox One, and PlayStation 3 are already there.  Yes, even Sony, competitor of Microsoft, uses Direct3D 11 (99% anyway).  Microsoft will be around longer than you will be alive, but it doesn’t really matter because Sony proves it is the future of graphics whether Microsoft is here or not.

 

I hope you mean PS4 because PS3 uses two completely different libraries called libGCM and PSGL. Sony does not use Direct 3D11 99.9% of the time since Sony is a completely different company from Microsoft and i am sure that Microsoft would have to create some contract for Sony to use their API or a deal or something because i do not think Microsoft will just let them use it.

 

Even OpenGL is switching to the Direct3D 11 model.  They are just trying to do it while sticking to a state machine and keeping as much back support as they can.
Direct3D introduces a feature such as constant buffers and OpenGL follows suit.  No other graphics API (Nintendo DS Nitro, Nintendo 3DS GR, PlayStation Portable native, PlayStation Vita native, PlayStation 3 native, Xbox 360 Direct3D 9, all mentioned above) use a state machine or the especially problematic bind-to-edit mechanism.  Recent extensions (and the future standard) of OpenGL are also trying to get away from the bind-to-edit model, acknowledging it as a flaw.
 

I do not know what a state-machine is since i dont know that much about OpenGL and DirectX in terms of how they work fully, i just wanted to learn whichever is efficient and much more understandable to me. I cannot say much about this so i would guess you are right about DirectX having newer features and OpenGL playing catchup.
 

If I had known you were going to choose based on which is easiest to learn, I would have recommended Direct3D 9.
In terms of ease to learn, Direct3D 9 and OpenGL are fairly similar, but Direct3D 9 isn’t exposed as a state machine and is better documented.
 

To be honest i should have said that in my previous discussions, i will look into Direct 3D9 and try that first.
 

As I mentioned the first time you asked this question, OpenGL’s only selling point is that it is cross-platform, but that really isn’t the case.
Even Minecraft apparently did not support certain Intel cards.
You will have fine support on Mac OS X and Linux, but it will be hit-and-miss on Windows.
 
 So i guess OpenGL's performance and support on Window's is sub-par to Direct3D.

 

Based on our previous discussions, I retract my suggestion for Direct3D 11 and suggest Direct3D 9 instead.  Being object-oriented, a lot of it just makes more sense and is easier to grasp (something to which you already admitted).
And to quote John Carmack, “…DX9 is really quite a good API level. Even with the Direct3D side of things, where I know I have a long history of people thinking I’m antagonistic against it. Microsoft has done a very, very good job of sensibly evolving it at each step—they’re not worried about breaking backwards compatibility—and it’s a pretty clean API. I especially like the work I’m doing on the 360, and it’s probably the best graphics API as far as a sensibly designed thing that I’ve worked with.”

 

That is subjective because i have yet to try Direct3D9. The only way to know if it is good is to try it myself and rely on my judgement but its nice to hear positive feedback about it. And you are right if something is object oriented then it will be better for me to use it. I am quite Open-minded as well so i may try Direct3D9.

 

The bit about them not being afraid to break backwards compatibility is something I have also been considering as the main reason for many of OpenGL’s current and future problems.  OpenGL could really make big progress if they would be willing to just release a clean new API in which you simply know the whole time you are using features from this version and only this version.  Nothing deprecated or poorly supported or something that will cause it to go into software mode (as pixel buffers are known to do).

This is one thing OpenGL ES 2.0 does right.  It’s still a state machine and uses the bind-to-edit model, but it’s a compact API with no feature support used just as carry-on.  They don’t try to just give you the option of using shaders, they force you into it.  And that is a good thing.

 

If am correct OpenGL 3.3+ Core profile Removed all of the decaprecated features in that were present in the older OpenGL version's. Currently i do not plan to develop for the Mobile game Market because i think it is a joke in my point of view to even consider Mobile phones as capable gaming devices. Can i make desktop games with OpenGL ES 2.0 or just mobile games? If it is just Mobile games then i do not want to learn it and would rather learn D3D9 as you mentioned.

 

 

 

In fact, despite being a state machine and bind-to-edit, if OpenGL ES 2.0 is an option for you I would recommend learning it equally as much as I would recommend Direct3D 9.  And I would definitely recommend it before learning desktop OpenGL.

 

No i think i will try to learn Direct3D9 but if i still don't understand as much as creating a simple triangle after a month then i am going to go with OpenGL. I also do not think that Microsoft will last that long and i am a linux person but i use Windows for game development due to the excellent support it has.

 

I enjoy having discussions with you because they are quite detailed and helpful. I also noticed one thing, you seem to be against OpenGL a lot, you mentioned some good points but at the end of the day you can achieve the same graphics that are on Direct3D on OpenGL as well. I do not want to get into an conflict on which is better since it is a very LONG discussion and takes a lot of time to discuss. I think learning both is better.  Anyway thank's again L.Spiro, you are quite helpful alway's.

 

 

 

 


Edited by Zero_Breaker, 16 January 2014 - 05:40 PM.


#8 L. Spiro   Crossbones+   -  Reputation: 13163

Like
3Likes
Like

Posted 16 January 2014 - 06:34 PM

I hope you mean PS4

I do.  My mistake.
 

Sony does not use Direct 3D11

The API for PlayStation 4 is basically Direct3D 11 with a different naming convention/prefix on functions.
 

So i guess OpenGL's performance and support on Window's is sub-par to Direct3D.

Performance depends on what you are doing and how you are doing it, if you are talking about Direct3D 9 (you didn’t specify). Direct3D 11 is faster than both of them in virtually all cases even if you abuse it the way I was when I was emulating Direct3D 9 via Direct3D 11. Now that I am emulating Direct3D 11 via OpenGL 4.0, OpenGL 3.2, OpenGL ES 2.0, OpenGL ES 3.0, and Direct3D 9, I expect all of them to gain performance (faster early-outs on redundant state changes and better sorting opportunities).

But support, yes.
 

I also noticed one thing, you seem to be against OpenGL a lot

My ability to fully accept and even endorse OpenGL ES 2.0 and OpenGL ES 3.0 shows my bias isn’t just bias. I am experienced enough not to get bitten in the ass by their bind-to-edit model and state-machine ways, so I really don’t have a problem with those and sometimes enjoy it (the API is small and concise etc.)

My beef with desktop OpenGL is based on actual pains it has caused me, despite enough experience to gracefully handle its state machine and bind-to-edit nature.
For example, VAO’s are introduced as an option. They are widely known to be slower and Valve even released a talk stating not to use them.
Shortly after someone asks about them on the OpenGL section of this site and I advise not to use them. He replies they are required.  phantom and I are aghast but it turns out they somehow somewhere in some version became required, not just optional.

 

Every time I try to help in the OpenGL section here it ends up being, “No, that was changed in 3.3,” or, “That became deprecated in 4.0.”  I’ve mostly just given up even posting there anymore.

 

Since they try to keep as much backwards compatibility as possible most changes to the standard are transparent.  Unless I constantly keep up-to-date with every single change in every single version they release I’m not going to know when something moves from optional to required or if something I have been using all along suddenly becomes deprecated, and I frankly don’t have that much time to be spending just to keep up with all those changes.

 

 

This isn’t about which is better, just about which has caused me more frustration (so no debates please).

If each version was really its own new version, my beef with OpenGL would almost entirely vanish.

Instead of backwards compatibility, I would rather just have a clear and clean API sitting in front of me.  Functions prefixed with gl3* or gl4* instead of just gl*.

And I don’t think that is unreasonable, because how often do you hear of people moving from Direct3D 9 to any newer version and complaining that IDirect3DDevice9 changed to ID3D10Device and then to ID3D11Device and then to ID3D11Device1?

 

 

L. Spiro


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#9 Zero_Breaker   Members   -  Reputation: 363

Like
0Likes
Like

Posted 16 January 2014 - 07:14 PM

 

I hope you mean PS4

I do.  My mistake.
 

Sony does not use Direct 3D11

The API for PlayStation 4 is basically Direct3D 11 with a different naming convention/prefix on functions.

 

So i guess OpenGL's performance and support on Window's is sub-par to Direct3D.

Performance depends on what you are doing and how you are doing it, if you are talking about Direct3D 9 (you didn’t specify). Direct3D 11 is faster than both of them in virtually all cases even if you abuse it the way I was when I was emulating Direct3D 9 via Direct3D 11. Now that I am emulating Direct3D 11 via OpenGL 4.0, OpenGL 3.2, OpenGL ES 2.0, OpenGL ES 3.0, and Direct3D 9, I expect all of them to gain performance (faster early-outs on redundant state changes and better sorting opportunities).

But support, yes.
 

I also noticed one thing, you seem to be against OpenGL a lot

My ability to fully accept and even endorse OpenGL ES 2.0 and OpenGL ES 3.0 shows my bias isn’t just bias. I am experienced enough not to get bitten in the ass by their bind-to-edit model and state-machine ways, so I really don’t have a problem with those and sometimes enjoy it (the API is small and concise etc.)

 

My beef with desktop OpenGL is based on actual pains it has caused me, despite enough experience to gracefully handle its state machine and bind-to-edit nature.
For example, VAO’s are introduced as an option. They are widely known to be slower and Valve even released a talk stating not to use them.
Shortly after someone asks about them on the OpenGL section of this site and I advise not to use them. He replies they are required.  phantom and I are aghast but it turns out they somehow somewhere in some version became required, not just optional.

 

Every time I try to help in the OpenGL section here it ends up being, “No, that was changed in 3.3,” or, “That became deprecated in 4.0.”  I’ve mostly just given up even posting there anymore.

 

Since they try to keep as much backwards compatibility as possible most changes to the standard are transparent.  Unless I constantly keep up-to-date with every single change in every single version they release I’m not going to know when something moves from optional to required or if something I have been using all along suddenly becomes deprecated, and I frankly don’t have that much time to be spending just to keep up with all those changes.

 

 

This isn’t about which is better, just about which has caused me more frustration (so no debates please).

If each version was really its own new version, my beef with OpenGL would almost entirely vanish.

Instead of backwards compatibility, I would rather just have a clear and clean API sitting in front of me.  Functions prefixed with gl3* or gl4* instead of just gl*.

And I don’t think that is unreasonable, because how often do you hear of people moving from Direct3D 9 to any newer version and complaining that IDirect3DDevice9 changed to ID3D10Device and then to ID3D11Device and then to ID3D11Device1?

 

 

L. Spiro

 

So if i were to learn OpenGL, what would your advice be to avoid getting bitten in the ass by it? 



#10 richardurich   Members   -  Reputation: 1187

Like
3Likes
Like

Posted 16 January 2014 - 08:00 PM

For OpenGL, you can use Core instead of Compatibility to drop tons of the deprecated stuff. I think most modern tutorials even have you setting up core and explain it's to drop all the old stuff. For example, opengl-tutorial.org has "glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL".

 

To eliminate even more deprecated functions, set the highest OpenGL version supported. Just make sure you test against your target OpenGL version.



#11 L. Spiro   Crossbones+   -  Reputation: 13163

Like
1Likes
Like

Posted 16 January 2014 - 08:06 PM

So if i were to learn OpenGL, what would your advice be to avoid getting bitten in the ass by it?

Keep track of everything you bind on your own end.  Render targets, framebuffers, textures, VBO’s, IBO’s, etc.
When you finish a bind-to-edit, restore what was supposed to be bound.
 
Extensively wrap things inside your own wrapper calls.

I won’t go into too much detail here because I am already in the middle of my revised graphics engine and will be posting code that shows how to use OpenGL to simulate Direct3D 11, and it that source code will end up being the most useful resource for studying “proper” and efficient usage of OpenGL.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#12 frob   Moderators   -  Reputation: 20102

Like
3Likes
Like

Posted 17 January 2014 - 10:50 PM

So if i were to learn OpenGL, what would your advice be to avoid getting bitten in the ass by it?

Keep track of everything you bind on your own end.  Render targets, framebuffers, textures, VBO’s, IBO’s, etc.When you finish a bind-to-edit, restore what was supposed to be bound. Extensively wrap things inside your own wrapper calls.I won’t go into too much detail here because I am already in the middle of my revised graphics engine and will be posting code that shows how to use OpenGL to simulate Direct3D 11, and it that source code will end up being the most useful resource for studying “proper” and efficient usage of OpenGL.L. Spiro
Which all brings us back to the first reply on the thread:

OpenGL's design decision is to allow access to all functionality in the core, and allow you access to any functionality you request. That functionality may not be optimal, it may have horrible performance consequences, it may vary between cards, but the choice is to give you EVERYTHING.

Direct3D's design decision is to allow access to a specific family of functionality designed for high performance and broad uniformity. You ask for a family of interfaces and either you get the full set of interfaces or you get nothing.

There are pros and cons to each.

For example, if you want to use D3D9 and get an instance of it you will have a consistent set of functions, but if you later want to use some bit of functionality on newer cards it may be inaccessible even if the card supports it. On the opposite side, with OpenGL you can still push everything through the bus every frame, or you may have slight differences in similar functionality between different families of cards, but you can take advantage of new functionality without rewriting large segments of your code base.

There are many, many, many tradeoffs like that. As broad generalizations nether choice is right or wrong. In a specific situation one might be a better choice than another, and in a different situation the wise choice might be different.

Both of them are fully-featured. Both of them can be used to render beautiful, high performance graphics that take full advantage of the graphics cards.

Either way you choose to go, if you want to take advantage of the latest and greatest graphics technologies you will have a very long journey before reaching mastery. Taking advantage of the incredible power of a modern GPU to its fullest extent is something that can require many years of study.
Check out my personal indie blog at bryanwagstaff.com.

#13 Zero_Breaker   Members   -  Reputation: 363

Like
0Likes
Like

Posted 20 January 2014 - 03:14 PM

 

 

So if i were to learn OpenGL, what would your advice be to avoid getting bitten in the ass by it?

Keep track of everything you bind on your own end.  Render targets, framebuffers, textures, VBO’s, IBO’s, etc.When you finish a bind-to-edit, restore what was supposed to be bound. Extensively wrap things inside your own wrapper calls.I won’t go into too much detail here because I am already in the middle of my revised graphics engine and will be posting code that shows how to use OpenGL to simulate Direct3D 11, and it that source code will end up being the most useful resource for studying “proper” and efficient usage of OpenGL.L. Spiro
Which all brings us back to the first reply on the thread:

OpenGL's design decision is to allow access to all functionality in the core, and allow you access to any functionality you request. That functionality may not be optimal, it may have horrible performance consequences, it may vary between cards, but the choice is to give you EVERYTHING.

Direct3D's design decision is to allow access to a specific family of functionality designed for high performance and broad uniformity. You ask for a family of interfaces and either you get the full set of interfaces or you get nothing.

There are pros and cons to each.

For example, if you want to use D3D9 and get an instance of it you will have a consistent set of functions, but if you later want to use some bit of functionality on newer cards it may be inaccessible even if the card supports it. On the opposite side, with OpenGL you can still push everything through the bus every frame, or you may have slight differences in similar functionality between different families of cards, but you can take advantage of new functionality without rewriting large segments of your code base.

There are many, many, many tradeoffs like that. As broad generalizations nether choice is right or wrong. In a specific situation one might be a better choice than another, and in a different situation the wise choice might be different.

Both of them are fully-featured. Both of them can be used to render beautiful, high performance graphics that take full advantage of the graphics cards.

Either way you choose to go, if you want to take advantage of the latest and greatest graphics technologies you will have a very long journey before reaching mastery. Taking advantage of the incredible power of a modern GPU to its fullest extent is something that can require many years of study.

 

Beatiful post. I also think that both API's do the same thing and it is a matter of preference over which one you use, i also think that it is up to the developer with what he does with that API. For example despite the PS3 being hard to develop for, Hideo Kojima's team managed to take advantage of the PS3 to create MGS4.






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