# OpenGL vertex sorting

HI all,

i have an issue , i hope anyone could help.

My idear of the project , is to “pixelate” 3D objects ( Voxel )

I need to get all global position XYZ of vertex use in an SCENE, and store them all.

of course if i use my own object is easy. but if i use a GLUSPHERE ?
if i use the ofx3DModelLoader , i guess probably there will be a vertext list, but probably local, if i need X,Y,Z after transfmartion martix are applied ?
how to do ?

thanks all

to apply a transformation matrix to a point, you multiply the point vector by the transformation matrix. the resulting vector is the point transformed by the matrix. you can multiply matrices together to represent multiple transformations, but note that the order matters: translation followed by rotation is not the same as rotation followed by translation.

so essentially, if you’ve got a collection of points that make up a mesh, and you have or can construct the transformation matrix to bring those points from object-space to the desired world-space, then you just need to loop through all the points and multiply each point by the transformation matrix.

this may or may not help:
http://en.wikipedia.org/wiki/Translation-(geometry)

Thanks Damian !

Well yes this is the basis of OpenGL. My trouble is more to access all vertex of a scene. For exemple if i use a GluSphere, how to know how many vertex are used, and their position ( before of after transformation matrix , wich is different according to several multiplication )

thanks again

Getting the vertexes from the scene is difficult likely because gluSphere just passes that stuff to openGL directly, you’re better off using ofx3DModelLoader.

That will hopefully give you the location of each vertex in model-space, and just substituting in cubes for those points will give you the desired result when it gets passed through your model-view and projection matricies, it would be counter-productive to try and multiply them on the cpu side then put them in world-space because it would be slower and it doesn’t really gain you anything.

you just confirm what i was thinking , thanks