Painter API for drawing quads, triangle strips etc

Hi,

I just wanted to get some opinions on a general painter API. I have been
testing it and it seems reasonable but I didn’t know if any of you guys might
know of a better way to do this.

When drawing OpenGL quads, triangle strips etc they need surface normals too.
Most of the time you should supply normals along with the vertices although
it can be enough to use one normal for flat surfaces. I was thinking of an
API such as,

bool drawTriangleStrip(QList vertices, QList normals);
bool drawTriangleStrip(QList vertices, const Vector3d& normal);

Is there a better way to handle this or does it seem reasonable? I didn’t want
to end up going round and round in circles and would really appreciate a
second opinion. Obviously for lines etc we don’t need to worry about normals.

Then there is all of the enable and disable stuff that is still in the
engines. glEnable and glDisable could be replaced with Painter functions or
should we just expose the options we want to offer,

void enableBlending(bool enable);

Calling enableBlending(true) would enable and calling enableBlending(false)
would disable. This could also be done for lighting, depth testing, back face
culling etc. The painters that do not implement these things, such as POV-Ray
can just silently return in those functions and do nothing.

Again I would appreciate second opinions on this approach if anyone has any.

Thanks,

Marcus

On Saturday 18 August 2007 01:27:51 pm Marcus D. Hanwell wrote:

Hi,

I just wanted to get some opinions on a general painter API. I have been
testing it and it seems reasonable but I didn’t know if any of you guys
might know of a better way to do this.

When drawing OpenGL quads, triangle strips etc they need surface normals
too. Most of the time you should supply normals along with the vertices
although it can be enough to use one normal for flat surfaces. I was
thinking of an API such as,

bool drawTriangleStrip(QList vertices, QList normals);
bool drawTriangleStrip(QList vertices, const Vector3d& normal);

Is there a better way to handle this or does it seem reasonable? I didn’t
want to end up going round and round in circles and would really appreciate
a second opinion. Obviously for lines etc we don’t need to worry about
normals.

I’m not sure the best way to do it but i definitely think that we need some
sort of parameter like that, although, it’s probably possible to calculate
some normals for default parameters. I’d like to hear from Benoit too.

Then there is all of the enable and disable stuff that is still in the
engines. glEnable and glDisable could be replaced with Painter functions or
should we just expose the options we want to offer,

void enableBlending(bool enable);

Calling enableBlending(true) would enable and calling enableBlending(false)
would disable. This could also be done for lighting, depth testing, back
face culling etc. The painters that do not implement these things, such as
POV-Ray can just silently return in those functions and do nothing.

Again I would appreciate second opinions on this approach if anyone has
any.

This is true! We’ve needed this for a while. It would mean we could optimize
a lot better behind the scenes (not worry about un-needed push/popping) so
yes, i totally think anything like gl* should be handled by the painter.

Thanks,

Marcus


This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options