- Sort Posts
- 3 replies
- Last post
Transparent object
Transparent object
As I understand I should enable Alpha Blending with the following lines :
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
but (for imageTargets sample) :
-Should I do that in Renderer Source code? (for example imageTargetsRenderer.java)
if yes,
between which lines exactly should I implement these lines?
or am I on the wrong way to solution?
Thanks
Transparent object
This is more of an OpenGL question than a "Vuforia specific" one.
You can render transparent models so long as:
- you enable Alpha Blending in your OpenGL pipeline: https://www.opengl.org/archives/resources/faq/technical/transparency.htm
- you implement a Fragment Shader that sets the opacity (alpha component) of your fragment color, either based on a per-vertex attribute passes from the Vertex Shader, or through a Uniform shader parameter set by the application
Yes, those 2 lines enable alpha blending; typically you'll want to add those lines right before rendering the augmentation (your transparent objects), right after drawing the video background.
You'll also want to disable GL_BLEND after rendering the augmentation.
The relevant source code is in ImageTargetsRenderer class, if you are using the Image Targets sample app as a starting point; look in the Render() method.