PDA

View Full Version : blending



darren
02-12-2003, 09:22 AM
Hi,

I'm working on a program that creates a relatively high poly-count object from some data. This object is static (for now). I qsort the polys of the object based on z distance before drawing, so I can do some blending.

The problem is I can not rotate the object without getting artifacts with glBendFunc(GL_SRC_ALPA,GL_ONE_MINUS_SRC_ALPHA). It seems apparent that the original draw ordering is being used as glRotate rotates the object.

Is there a cheap / fast way of modifying the drawing order relative to rotation?

thx,
D

Nick Nougat
02-12-2003, 09:50 AM
I haven't looked into the topic in detail, so I don't know if there is any cunning technique to do this directly.
But while surfing I found this article (http://www.gamedev.net/reference/articles/article675.asp) which might offer almost O(n) sorting times at the expense of memory. Which should be better than QS with big n.

Hope this helps
Nick

darren
02-12-2003, 12:23 PM
Thanks, this looks like basic linked-list sorting and is cool.

...but, I don't think I want to translate the original data (polygons) in my object. The way I understand the glRotate command is I don't have to change the original data in my object type. Basicly an ordered link-list of polygons.

I guess what I am asking now is, is there a way to modify the glRotate command or mobel matrix in OpenGL to order correctly (based on z) relative to rotation of the object taking place.

Hmmm that did not sound to clear. Is there a stratagy for rotating an object yet keep the z ordering correct? It seems like if the sort is done once (qsort is fine for this), there should be a way to modify the ordering correctly if the rotation is known.

-D