Ok, so i came up with an idea. I don’t think it’s that good though.
For the sake of my proposal let us say we have a GLObject class.
class GLObject {
public:
GLuint id
GLfloat z
Engine *engine
Primitive *primitive
bool transparent
}
Now let us say that the GLEngine class has the following functions:
QList<QObject *> generateObjects(QList<Primitive *>);
void enqueueObject(QObject);
void processQueue();
How does this work. Well, it’s supposed to work by only updating the
display lists when there is an update. It also means that we can thread
the engines. Here is data flow.
GLWidget::setMolecule()
{
foreach active engine {
engine.generateObjects(all primitives of molecule);
addtorenderqueue();
}
}
GLWidget::primitiveUpdated(Primitive *p)
{
foreach QObject qo
{
if qo.primitive == p { add qo.engine.enqueueObject(qo) }
}
}
GLWidget::primitiveAdded(Primitive *p)
{
qlist<Primitive *> ql.append(p)
foreach active engine
{
engine.generateObjects(ql);
}
}
…
Pros:
-updateing of display lists is can be done in a separate thread
-easy to add/remove rendering options for individual atoms etc
-transparency can be handled easy.
-GLWidget is responsible for actually doing the rendering rather than
engines.
Cons:
-Complicates the engines
Middle Ground:
-a view that is constantly updating will cost us depending on
implementation
(eg, Let us consider the ball and stick engine.
We have two options: render the entire molecule under one display
list or rendering each primitive as it's own display list.
In the first option we save memory; 1 moelcule DL instead of 300k
individual ones. Now if i'm moving an atom each time the position
gets updated i have to recompile that display list.
In the second option we would see a speedup because only the DL of
the objects being changed need to be updated. Although i'm still
having to recompile the DL for each object.
I’ve got some other ideas brewing too. I’ll see how that goes. If we
rely on DisplayLists i think we’re going to be in trouble because they
ahve to be compiled then executed. It’s almost like double the work.
I’ve been trying to get ahold of some OGL people here on campus but
nothing back from them so far. I feel like this is a problem i’m unable
to solve and it’s pissing me off.
It would be interesting to know how this is handled in professional
gaming systems.
-Donald
(Tue, Apr 10, 2007 at 11:47:16AM -0400) Geoffrey Hutchison geoff.hutchison@gmail.com:
On Apr 10, 2007, at 11:06 AM, Benoit Jacob wrote:
If you want to paint translucent ribbons using z-sorting, you’re
facing
some nontrivial issues.
…
But yes, it seems reasonably doable.
I haven’t seen many calls for a translucent ribbon. Most people show
an opaque ribbon. I’m going to try to code up a real ribbon render
soon – otherwise we’re just going to question how that might work.
It’s better to give it a try and see what problems we face.
I think we may face some issues with molecular surfaces. On the other
hand, those are usually chopped into triangles already, so it’s not
as big an issue. (This does raise the question: should we use an
external mesh/surface library?)
On Apr 10, 2007, at 11:45 AM, Donald Ephraim Curtis wrote:
vector arrays. This way we could subclass a single “GLObject” and
based
on how it was generated have the GLWidget render it.
In my original proposal, I said there would be a render queue for the
OpenGL view. Primitives would be subclassed for things like atoms,
bonds, residues, surfaces, etc. The user could specify a specific
pair of engines and primitives – for example, using balls-and-sticks
for most of the molecule, but highlighting one specific atom (dunno,
maybe it’s the key piece of the molecule) and making that huge.
Primitives could then be in the queue multiple times – for example
having both wireframe and ribbon views of a protein.
I think Donald is suggesting that engines could return something (a
GLObject) which could be directly handled by GLWidget rather than
continually going through the queue.
Personally, I’m not sure that’s necessary. How would returning a
GLObject be different from creating a display list and returning that?
Cheers,
-Geoff
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options