Creating skybox / cubemap textures programatically

I'm looking for info on how to go about creating a skybox texture.

I'm going to be generating 3d data (star positions) at runtime. I then want to produce a cubemap that I can use for a skybox. I have no idea how to do the mapping from 3d coordinates to the six 2D cube faces. I really just need some guidance on the math, don't need source code or details on specific cube map formats (yet!) though that would work too.

find the component with the highest absolute value and then project the coordinate onto the plane in that direction

aka if it's the x component and it is negative then the coordinates on the -x plane is (-y/x, -z/x)

(do double check how the order of coordinates works out)
ratchfreak beat me to it but here is a little longer expiation of the same processes

http://imgur.com/a/wG9EA
Well, that turns out to be easier than expected!

Thanks to you both.
For more formal description, read the OpenGL spec how it projects cubemap texture.
See "Section 3.8.10 "Texture Application" in https://www.opengl.org/registry/specs/ARB/texture_cube_map.txt
ratchetfreak
find the component with the highest absolute value and then project the coordinate onto the plane in that direction

aka if it's the x component and it is negative then the coordinates on the -x plane is (-y/x, -z/x)

(do double check how the order of coordinates works out)


Summoning this thread back up, now that I am actually doing this.
I assume that when I project onto the *positive* x plane it would be (y/x,z/x)?

And the y plane would be x/y,z/y

and the z plane would be x/z,y/z ?
wooo, I haven't verified if the stars are really in the right positions, but I just spewed a ton of code and sure enough a nice starfield skybox appeared!

next up - do the same for close stars, but with some sort of bitmap and not just a white pixel
add some color based on star type
and then some sort of background glow for the galaxy based on stellar density



you can check the textures end up in the right place/orientation using a debug texture with colored lines crossing boundaries
ratchetfreak
you can check the textures end up in the right place/orientation using a debug texture with colored lines crossing boundaries


good call.
I may need to also create a test galaxy sector where it is obvious if things are right or wrong. 4 stars on the left, 3 on the right, 2 on top, 1 on bottom or something.