i have a bunch of quads i need to fully transform and then sort them manually.
so, i would like to use the normal opengl matix stack pushes, glbegin(GL.GL_QUADS), etc. and then once i call glEnd(), read the transformed quad information (1 vertex at a time if i have to).
any idea how to do this?
[quote]i have a bunch of quads i need to fully transform and then sort them manually.
so, i would like to use the normal opengl matix stack pushes, glbegin(GL.GL_QUADS), etc. and then once i call glEnd(), read the transformed quad information (1 vertex at a time if i have to).
any idea how to do this?
[/quote]
I would say, it’s impossible the way you are trying to do it.
A different solution might be to grab the OpenGL modelview matrix right where you would put the glBegin and do the matrix multiplication yourself (if you are using javax.vecmath, you have to change the row/column order in the array, I think).
Btw: what do you want with the homogenous vertex-coordinates (all scaled to be in [0,1], etc).
If you just want the world-coordinates, you somehow have to only get the world-matrix without the view-projection.
Which probably means, you have to track your transforms on the matrix stack for yourself.
Jan
i have a bunch of transparent quads to manually sort and then display. the sorting of course has to happen after the quads have been rotated around the camera but before they are projected.
i have all of the matrices involved but i was hoping to use the hardware of my video card to do the transformations instead of writing my own calculations, which will certainly not use the hardware.
[quote]the sorting of course has to happen after the quads have been rotated around the camera but before they are projected.
[/quote]
Why? Can’t you just use the distance to the camera?
you wont know the distance of the quad from the camera until it has been rotated/translated within its own system and then the camera.
the quads are not static. they move every rendered frame.
this is a visualization of scientific data over time.
AHA!
my solution might be glRenderMode(GL.GL_FEEDBACK)
it works similarly to glRenderMode(GL.GL_SELECT)
which is used for picking.
you examine the buffer of returned values.
feedback returns information about the transformed primitives, including vertices.
neato. ill keep you posted.
Cool, I didn’t know this existed. I definitly have to keep that in mind.
Jan