Adding vertices to appendGeometry()

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

hermit purple
Just popping in
Just popping in
Posts: 13
Joined: Wed Oct 21, 2009 20:21

Adding vertices to appendGeometry()

Postby hermit purple » Wed Oct 28, 2009 23:41

When ImageSet:: draw() calls appendGeometry, it pass six vertices. The last 2 being the diagonal vertex. Is there a particular reason why we pass 6 vertex instead of 4. My system will be using quad so the last 2 vertices seems redundant. Am I safe to just ignore the last 2 vertices?

Also, correct me if I'm wrong, this looks like the only place appendGeometry getting called, meaning the only place vertices are added.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Adding vertices to appendGeometry()

Postby Jamarr » Mon Nov 02, 2009 21:32

I believe CEGUI uses GL_TRIANGLES for drawing, thus why you need 6 verticies to draw a quad. If you only supply 4, your textures will not be mapped properly. You'll have to wait for CE to get back for a definitive answer.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: Adding vertices to appendGeometry()

Postby scriptkid » Thu Nov 05, 2009 08:40

I managed to tackle CE about this, and this is a reply on his behalf:

Currently the GeometryBuffer only supports the concept of a triangle
list for the added geometry. This was chosen for the initial
implementation for simplicity reasons and because it matches the
rendering approach in the pre 0.7.x versions; or to put it another way,
initially we've only been interested in getting it to do what CEGUI
needed in a way that would be supported by the maximum number of APIs
and engines.

If you're going to be adding your own custom geometry to GeometryBuffer
objects, then currently the data passed in must also be in the form of a
triangle list - because this is the only primitive type understood by
the current implementations of GeometryBuffer. At some stage the
interface for GeometryBuffer will be enhanced to accept other primitive
types and probably a facility for indexed data also (though no ETA is
given for such enhancements).

You are correct that within the core CEGUI components, the
Imageset::draw function is currently the only place geometry is added to
GeometryBuffer objects. This basically highlights the way rendering is
done within CEGUI; that currently everything drawn is Imageset based.

HTH :)
Check out my released snake game using Cegui!

jays
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Mon Apr 26, 2010 23:47

Re: Adding vertices to appendGeometry()

Postby jays » Wed Jun 02, 2010 22:57

Good evening,

I'm writing a renderer Geometry Buffer class and wanted to check if this information is still accurate.
I assumed the vertices passed to me in appendGeometry() were a list of triangles.
Can I also assume they are all built in the same order so I don't need to worry about unifying all the normals?
I wouldn't want half of it to be invisible because I'm looking at the backs of the triangles.

Thanks!
-- Doctor Doctor, it hurts when I ....

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Adding vertices to appendGeometry()

Postby CrazyEddie » Thu Jun 03, 2010 09:00

The info quoted by scripkid is still current.

You shouldn't have to worry about normals and such, though you should also not do back-face culling for the GUI content, because you may have rotated content and such which gives the possibility of requiring back faces to be seen.

HTH

CE.

jays
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Mon Apr 26, 2010 23:47

Re: Adding vertices to appendGeometry()

Postby jays » Fri Jul 23, 2010 17:29

Thanks for the help CE and ScriptKid.

The docs I've read say " The GeometryBuffer is passed Vertex objects to be added to the internal buffer(s). The
geometry that CEGUI supplies is position independent, with the origin being the top-left corner"

The OpenGL origin is typically lower left corner. Looking at the OpenGl renderer I don't see any code to adjust the origin.
What did I miss?
-- Doctor Doctor, it hurts when I ....

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Adding vertices to appendGeometry()

Postby CrazyEddie » Sat Jul 24, 2010 07:18

IIRC it's inverted as part of the projection.

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 10 guests