Jump to content
  • Advertisement
Sign in to follow this  
hanhau

OpenGL When are Shaders needed ? (wich context vers.)

This topic is 1048 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I am confused about shaders and for wich version of OpenGL they are needed.
?I created a context with OpenGL 3.2+ with GLEW and I can only clear the screen without doing any drawings.

?So the question:
?When do I need shaders ? Does this "hang together" with the context version ?

?I hope you can understand what I mean, my english is not the best on the planet and
describing? isn´t my biggest strength. Thx !

Share this post


Link to post
Share on other sites
Advertisement

Yeah, so in modern OpenGL nothing will appear without them (3.2+ or?).

?Thanks for the fast response !

Share this post


Link to post
Share on other sites

Exactly.

 

There are only a few things that you can't do with shaders on "core" contexts. Like clearing the screen as you discovered, or blitting one framebuffer to the other with glBlitFramebuffer. But thats it, if you want to actually draw anything, you have to use shaders.

Share this post


Link to post
Share on other sites

Thank you guys,

?this was the only thing that was keeping me away from moving deeper in ogl :)
?for(;;) std::cout << "thx :3 <3"; // ^^

Share this post


Link to post
Share on other sites
https://www.opengl.org/wiki/Core_And_Compatibility_in_Contexts

Basically you can create a context as Core (Lots of old stuff removed) or Compatibility.

The MacOS drivers and the open source Linux drivers only support Core context for higher (meaning >= 3.0) OpenGL versions.

The closed driver blobs on Windows and Linux also support the Compatibility Context. Where you can create a 4.5 Context and then draw stuff with glBegin/glEnd and "without" a active shader, and other horrible outdated stuff.

Share this post


Link to post
Share on other sites

Shaders are needed every render. 

The GPU pipeline uses special code to run its computations.

In the past, this pipeline was fixed. Meaning you could not do any computations, you could change the state to alter the computations.

 

Nowdays, these computations are programmable. This gives you the felxability to put your computations.

This is true for both OpenGL and DirectX.

 

If you really want to know more about the pipeline and gpu, I advise you to read this:

https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/

 

(Btw, if you have anything newer(this is from 2011) , please let me know)

Share this post


Link to post
Share on other sites

I believe you can still draw flat-shaded/solid-color lines and polygons without a custom vertex or pixel shader thru OGL v4.5.

Maybe it's not in the specification but that's the practical behavior of the drivers.

So I think the de facto answer is, "When you want hw accelerated transformation or lighting." (which is almost always).

Edited by Shannon Barber

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!