[osg-users] Mesh Functionality

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Tue Sep 27 11:41:29 PDT 2016


Hi again,

It seems you need to make sure, that the second vertex in the primitve 
has the color you need:

https://www.opengl.org/sdk/docs/man2/xhtml/glShadeModel.xml

Cheers
Sebastian

> Hi Mike,
> There is no simple way with shared vertices. You need to separate the 
> vertices for your primitives (I'm not sure, but I think flat-shading 
> actually takes the first vertex color in the assembly, but I won't 
> count on it). I'll try to check the specification.
> So basically you need either clone the vertices or resort to advanced 
> techniques. FYI, I'm currently helping Gianni to do something similar, 
> so maybe I'll come up with a geometry shader based solution.
>
> Cheers
> Sebastian
>> Hi,
>>
>> Thank you again,
>>
>> I am using a TRIANGLE_STRIP  and BIND_PER_VERTEX.
>>
>> Then indexing through the array via simple initialization:
>>
>>   for (int r = 0; r < ISLAND_LAND_DEPTH;r++)
>>             {
>>                 (*terrain)[thisIndex][0] = column_x_loc;
>>                 (*terrain)[thisIndex][1] = column_z_loc;
>>                 (*terrain)[thisIndex][2] = column_y_loc;
>>
>>                 (*terrain_colors)[thisIndex][0] = 46.0f/256.0f;
>>                 (*terrain_colors)[thisIndex][1] = 76.0f/256.0f;
>>                 (*terrain_colors)[thisIndex][2] = 100.0f/256.0f;
>>                 (*terrain_colors)[thisIndex][3] = 1.0f;
>>
>>                 column_z_loc += ISLAND_LAND_TRIANGLE_DEPTH;
>>                 thisIndex++;
>>             }
>>
>> But only 1/2 of the face is set to the color I need...
>>
>> I am doing something wrong.  Any suggestions are very welcome.
>>
>>
>> Thank you!
>>
>> Cheers,
>> Mike
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=68799#68799
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list