Coloring Polygon Face using glDrawElements

Please Help,

I am new to JOGL VBOs and am having some difficulty coloring shared vertices - I really need to color by polygon face. For example I have a file of triangles that are connected and as such will have some shared vertices. Example file:

TRIANGLES:

Tri1 vert1 vert2 vert3 color_red

Tri2 vert3 vert2 vert4 color_blue

...

VERTICES:

vert1 X-coord Y-coord Z-coord

vert2 X-coord Y-coord Z-coord

...

So, the "shared" vertex (vert2 and vert3) are both Red and Blue so how can this be done with JOGL using glDrawElements and glColorPointer. I know that I should make copies of the shared vertices to properly display the colors using the glDrawElements() and glColorPointer() but am unsure of the correct execution.

Can I just append the newly duplicated, shared nodes to the already existing Color and vertex arrays? Do I also need to append a new indice for the array being passed to the glDrawElements()? It seems that I should also have a duplicate polygon indice to render the polygon with the duplicate node also but I don't know if this is the case.

Any hints/help or some simple and quick pseudo-code would be great. Like I said, I am a newbie with regards to JOGL VBOs.

Thanks in advance.

Message was edited by:

pooh145

[1329 byte] By [pooh145a] at [2007-11-26 13:57:55]
# 1

i dont see a problem... probably because YOU are making this harder than it really is...

Lets see.

Here are the steps

1) Load the data from the files...

2) Save vert data into a 3dVert class (with x,y,z)

3) Save vert triangle data into a Triangle class

4) The Triangles class will have three 3dVert variables (one for each vert)

5) On initzilization of Triangle object set the three 3dVert variables AND THE COLOR

6) blah blah blah draw...

If thats not what you need then I'll be a potato

....

Your welcome

ArikArikArika at 2007-7-8 1:38:03 > top of Java-index,Other Topics,Java Game Development...