0
\$\begingroup\$

I have webgl 3D scene with background image and few shapes with textures.
I want to add some lines and other shapes and apply on them default color which not affect the shapes with textures.
How can I do this?
this is what I have now:

gl.clearColor(0.0, 0.0, 0.0, 0.0); //alpha=0 for background img
gl.enable(gl.DEPTH_TEST);
\$\endgroup\$
6
  • \$\begingroup\$ Question is ambiguous. Do you want to color the shapes? Or change the depth buffer color? \$\endgroup\$ – Krythic Oct 21 '16 at 13:13
  • \$\begingroup\$ @Krythic, color the shapes that not have textures \$\endgroup\$ – arii Oct 21 '16 at 13:38
  • \$\begingroup\$ It depends on what framework you're using. For OpenTK, GL.Color3(Color.Red); \$\endgroup\$ – Krythic Oct 21 '16 at 13:44
  • \$\begingroup\$ Im using webgl in FireFox @Krythic \$\endgroup\$ – arii Oct 21 '16 at 13:57
  • \$\begingroup\$ Most frameworks of OpenGL are 1:1 in terms of the api. Your case should be gl.color3f(1.0f,0.0f,0.0f); \$\endgroup\$ – Krythic Oct 21 '16 at 13:59
0
\$\begingroup\$

You have to use shaders to apply color to objects..

In fragment shader you can specify it with gl_color = vec3(r,g,b,a);

Glcolor3f it's deprecated..

\$\endgroup\$

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.