Hi Simon,

OpenGL doesn't allow you to change state in the middle of rendering a
primitive, let alone per vertex.  The only way to change material per
vertex would be to have a single vertex per osg::Geometry, but this
isn't going to work if you want you vertices to be meshed in anyway...

What it really sounds like what you need to focus on modifying the
osg::Image assocaited with a Texture that is applied to the geometry.
You could use multi-texturing if you wish to overlay you painted
texture on top.   The osgmovie example has an example of how to get
the texture coordinates from the current mouse position, you could use
this to index into an osg::Image.

Another approach might be to use an FrameBufferObject + Texture
combination where you render into the Texture the brush stroke and
then apply this Texture over the geometry.  This approach you keep
everything down on the GPU until you finally want to read back the
result.

Robert.

On Mon, Nov 1, 2010 at 10:45 PM, Simon Kolciter <simon....@gmail.com> wrote:
> Hi,
>
> I have another problem with this.
>
> In a vertices array assigned to a Geometry object, I want to assign different 
> materials to vertices => use a brush to give this texture to this vertex, 
> that textrue to that vertex etc...just like you in the Crysis Editor, for 
> example.
>
> 1. Is there a way to configure the StateSet object or the Geometry object to 
> somehow "tell" each vertex what texture it should use (given I don't want to 
> change the order of the vertices - which I fear I will have to)?
>
> 2. Won't this be a bit of a problem for the performance?
>
> 3. The edited model has a spherical shape, so I would like the textures to be 
> displayed as in a spherical environment. Is there a way to compute the 
> TexCoord Vec2's in a similar way as UVW Map modifier for max, but in real 
> time?
>
> I know that doing this stuff would be easier in an existing editor and just 
> exporting, but I am making an editor that is supposed to this real time.
>
> Btw thanks Skylark for the answer earlier
> Thank you!
>
> Cheers,
> Simon
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=33281#33281
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to