-2
$\begingroup$

I have to draw cubes with faces of different colors (each per face), but I don't know how to accomplish this task: I draw cubes using CPU and GPU meshes (no vertexBuffer or three.js "style") and I don't know how to assign to each vertex different colors (I don't even know if this is possible). I can upload my code to GitHub if my problem isn't clear enough, let me know. All of this is coded in JavaScript and WebGL.

$\endgroup$
3
  • $\begingroup$ It's probably easier to do it with 3 copies of each vertex - with the appropriate colour on each copy. $\endgroup$
    – Simon F
    Dec 13, 2018 at 13:31
  • $\begingroup$ Welcome to the site. Please elaborate on your specific problem and show what you have so far. A code dump is not a proper way to do this. Extract the minimal and meaningful parts and post them in the question. $\endgroup$
    – bernie
    Dec 14, 2018 at 14:23
  • $\begingroup$ This page describes drawing faces in different colors. $\endgroup$
    – gman
    Jul 10, 2019 at 15:01

1 Answer 1

-2
$\begingroup$

There are many tutorials covering this - Google is your friend. Maybe this covers your demands?

$\endgroup$
1
  • 2
    $\begingroup$ I'm not familiar with javascript, but it looks to me like that is using a separate transformation per face. It might be ok for a trivial example, but please don't try to scale that to larger models. $\endgroup$
    – Simon F
    Dec 14, 2018 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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