Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flat2D Shader - Alpha (transparency) Support? #32

Closed
miguelmartin75 opened this issue Dec 12, 2013 · 5 comments
Closed

Flat2D Shader - Alpha (transparency) Support? #32

miguelmartin75 opened this issue Dec 12, 2013 · 5 comments

Comments

@miguelmartin75
Copy link
Contributor

Is the Flat2D shader supposed to have transparency support? It seems that it doesn't on my machine, and I'm not sure if it's supposed to or not. Either way it would be lovely to have alpha support without having to create another shader.

Evidence of no alpha support:

screen shot 2013-12-12 at 12 41 19 pm

Running Mac OS X 10.9.

Compiler:

Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

OpenGL context information:

Vender: Intel Inc.
Renderer: Intel HD Graphics 3000 OpenGL Engine
Version: 3.3 INTEL-8.18.27
@miguelmartin75
Copy link
Contributor Author

This issue had nothing to do with the flat shader, and instead, me not enabling blending, with the following code:

Magnum::Renderer::setFeature(Magnum::Renderer::Feature::Blending, true);
Magnum::Renderer::setBlendFunction(Magnum::Renderer::BlendFunction::SourceAlpha, Magnum::Renderer::BlendFunction::OneMinusSourceAlpha);
Magnum::Renderer::setBlendEquation(Magnum::Renderer::BlendEquation::Add, Magnum::Renderer::BlendEquation::Add);

LibRocket Integration is complete! Now I just have to get it working completely with SDL 2. :)

screen shot 2013-12-12 at 6 11 43 pm

The cropped image in the background of the libRocket window is just a triangle with the texture of libRocket's GUI. I forgot to remove the code to render that triangle.

@miguelmartin75
Copy link
Contributor Author

If you would like to see the code used to integrate Magnum with libRocket, you can look at my recently added repository on github. Here: https://github.com/miguelishawt/Magnum-libRocket.

@Jmgr
Copy link

Jmgr commented Dec 12, 2013

Great, this will save me a lot of time. Thank you!

@mosra
Copy link
Owner

mosra commented Dec 12, 2013

Awesome :-) Is there anything that can be done on Magnum side to simplify the integration (i.e. conversion between libRocket and Magnum vector types)? Or the integration class is all you need on the C++ side and everything else is done in HTML?

@miguelmartin75
Copy link
Contributor Author

Is there anything that can be done on Magnum side to simplify the integration (i.e. conversion between libRocket and Magnum vector types)?

The only thing that I can think of is that libRocket supplies vertices that contain a colour component within them. And Flat2D does not support colour per vertex. But it seems that it does not affect the resulting images rendered.

The conversion between magnum and libRocket's vector types are not required, but it may be if sizeof(Magnum::Vector2) != sizeof(Rocket::Core::Vector2f). This may be the case if you are using a vector with double's in the implementation within magnum (that is a Magnum::Vector2<double> within the Flat2D shader's implementation for the attributes).

Or the integration class is all you need on the C++ side and everything else is done in HTML?

On magnum's side yes, but you do require a system interface, which basically handles the input for libRocket. I have implemented a SystemInterface with SDL 2, which is located here on GitHub: https://github.com/miguelishawt/SDL2-libRocket-SystemInterface.

@mosra mosra added the invalid label Jul 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants