Quick question summary: how do I make openGL take 4 coordinates per point into the vertex shader from an array? I will then convert these to 3 coordinates (glPosition.xyz).

More detailed explanation: I'm creating a 3sphere simulation: How would the world look if we lived on a 4D sphere? is the question I am aiming to answer with my WebGL simulation. I will render planets around the player (who can move) in 3D space, based on how light travels on surfaces. (it's a 3D spherical surface in 4D coordinates) For the algorithms I've made to work, webgl needs to take 4 coordinates per vertex (because 4D) and convert this to 3 coordinates in the vertex shader based on the player position and other factors. Problem is, how do I tell it that each vertex is 4 floats?

I know I'll sort of be using GL_TRIANGLES...

Any ideas?

EDIT I've had one: will glVertexAtribPointer with size=4 do the job?

  • \$\begingroup\$ " will glVertexAtribPointer with size=4 do the job?" — what results do you observe when you test this out? \$\endgroup\$
    – DMGregory
    Aug 26 '21 at 0:46

You must log in to answer this question.

Browse other questions tagged .