1
\$\begingroup\$

I'm currently learning opengl but it seems quite complicated so i considered using some library like sdl or allegro. I noticed that allegro has some built in functions to create and attach shaders.

But my question is: do my shaders "shade" everything i render with allegro or they are only functions to ease the work of loading shaders with opengl/directx?

Any help apreciated!

\$\endgroup\$
2
\$\begingroup\$

They work in a similar, if not identical, way as in openGL/DirectX shaders... The only difference is that an ALLEGRO_SHADER needs to contain both a fragment and vertex shader for rendering to work.

The way they work is that you attach a shader program to the device or display and then all drawings done in it will pass through the shader, so to achieve different effects you can detach the previous shader and then attach the new one on run-time as necessary.

\$\endgroup\$
  • \$\begingroup\$ cool, I might give it a try, right now I'm using libgdx and I'm quite happy with it. This is a nice feature to have, though. \$\endgroup\$ – twkmz Sep 18 '15 at 13:18
  • 1
    \$\begingroup\$ @ochi12 in case you get stuck when you try it, the source code of allegro has some examples showing the usage of shaders, as the docs only define the functions available but shown no example. \$\endgroup\$ – rlam12 Sep 18 '15 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.