When using part_render there is one problem left, and that is that the object (the circle in the example) gets drawn with default values at the center,and is not actually a particle (You can check this by setting the part_size value in the 07.render.pd examples of the particle patches to a small value like 0.1)
To get rid of that problem, some chances in GemBase.cpp have to be introduced. There are several possibilities:
1) make gem_renderMess a virtual function and reimplement it in part_render.cpp without the problematic gem_state message
drawback: virtual functions are slow
2) provide some mechanism to suppress the message (setting a flag in the GemBase class)
drawback: a bit hacky
3) call continueRender at the end of every render() call
drawback: lots of work
I have implemented the first version already, could commit it, but I want to hear what you think first.
Guenter
guenter geiger wrote:
To get rid of that problem, some chances in GemBase.cpp have to be introduced. There are several possibilities:
- make gem_renderMess a virtual function and reimplement it in
part_render.cpp without the problematic gem_state message
drawback: virtual functions are slow
- provide some mechanism to suppress the message
(setting a flag in the GemBase class)
drawback: a bit hacky
- call continueRender at the end of every render() call
drawback: lots of work
and don't forget the simplest solution:
4) suppress the last continueRender() call <snip> if(i<(cnt-1)){ continueRender(state); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } } } void part_render :: postrender(GemState*){ glMatrixMode(GL_MODELVIEW); glPopMatrix(); } </snip>
so the last particle is rendered by the normal GemBase-call. to restore the matrices, postrender() has to be added.
I have implemented the first version already, could commit it, but I want to hear what you think first.
if there is another good reason to make gem_renderMess() virtual, why not. (although i cannot think of one right now, there might be a future)
Guenter
mfg.as.r IOhannes
On Tue, 22 Jul 2003, IOhannes m zmoelnig wrote:
- suppress the last continueRender() call
<snip> if(i<(cnt-1)){ continueRender(state); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } } } void part_render :: postrender(GemState*){ glMatrixMode(GL_MODELVIEW); glPopMatrix(); } </snip>
thats actually a cool solution. A bit hacky too, but fast and easy. The good thing about it is that other files don't have to be touched, and we avoid the virtual function.
if there is another good reason to make gem_renderMess() virtual, why not. (although i cannot think of one right now, there might be a future)
no, lets keep it this way until we might need it.
Guenter