Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Per Vertex Color to Texture

35 views
Skip to first unread message

shkumar

unread,
Feb 14, 2013, 9:16:48 PM2/14/13
to
I have a .obj mesh which has per vertex color information stored in it. There are no texture associated with this mesh.
Does someone know a method/source code/algorithm which can help me generate a texture image from per vertex color ?

bob smith

unread,
Feb 21, 2013, 2:08:54 PM2/21/13
to
On Thursday, February 14, 2013 8:16:48 PM UTC-6, shkumar wrote:
> I have a .obj mesh which has per vertex color information stored in it. There are no texture associated with this mesh.
>
> Does someone know a method/source code/algorithm which can help me generate a texture image from per vertex color ?

Are you sure you need a texture image?

Most people would just turn off GL_TEXTURE and use the vertex colors without a texture when drawing.

Linda Li

unread,
Feb 22, 2013, 3:26:19 PM2/22/13
to
I am just now learning GLSL. So if I am wrong, ignore my answer.

Is it possible in the fragment shader to save the color of each pixel into one block of memory and then read it out as a texture image?

On Thursday, February 14, 2013 8:16:48 PM UTC-6, shkumar wrote:

Nobody

unread,
Feb 23, 2013, 11:29:51 AM2/23/13
to
On Fri, 22 Feb 2013 12:26:19 -0800, Linda Li wrote:

> I am just now learning GLSL. So if I am wrong, ignore my answer.
>
> Is it possible in the fragment shader to save the color of each pixel into
> one block of memory and then read it out as a texture image?

Saving the colour of each pixel to a block of memory is what fragment
shaders do. Framebuffer objects can be used to render into a texture, or
data can be copied from a non-texture framebuffer to a texture with
e.g. glCopyTexImage2D().

However: this requires that each face in the mesh is rendered to a
distinct set of pixels. That typically won't be the case if you render the
mesh normally. Back faces will be culled, overlapping faces will result in
only the front-most face (or portions thereof) being rendered.

Which is why the mesh has to be "unwrapped" first.

0 new messages