PDA

View Full Version : VRML97 to OpenGL



kieranatwork
10-30-2000, 03:32 AM
I've written a VRML97 to opengl scenegraph parser. Up until now, I haven't needed to do anything with the texture/texture coordinate data - but now I need to add textures to the scenegraph.
My scenegraph can use either indexed vertex arrays or interleaved vertex arrays. The problem is, OpenGL doesn't seem to allow you to have a texture coordinate per entry in the indices array (which would be damn useful). If this is true (and it seems to be), how the hell do I specify different texture coordinates for the same vertex? I don't seriously have to duplicate vertices just to have different texture coordinates do I?!
All I want is to have a single texture spread across a mesh. But in a cylinder (for example) there is a problem with the last polygon in the curve of the cylinder, where it joins to the first one. For example, along the U axis of the texture I have the following coordinates (0, 1, 2, 3, 4). Obviously, where the texture is drawn from 4 - 0 , I get the texture repeated 5 times through the single polygon as it joins to 0.
I need the last poly to draw from tex coord 4 to tex coord 5, but not have to create another vertex (it's already there in 0).

Also,
I'm a bit puzzled as to how I deal with the texture indices node in VRML. What the hell is that all about?

10-30-2000, 09:04 AM
>how the hell do I specify different texture
>coordinates for the same vertex?

I don't know. Here on earth, though, we have
to specify the vertex twice. Think about it:
if you're using different texture coordinates
chances are you want a different normal and
possibly a different vertex color, too. Thus
you're really dealing with two different
surfaces, and they just happen to have
vertexes that share the same 3D space.

Oh, and say hi to the devil from me; she
looked real sharp in Bedazzled.

kieranatwork
10-31-2000, 12:43 AM
Originally posted by bgl:

Think about it:
if you're using different texture coordinates
chances are you want a different normal and
possibly a different vertex color, too. Thus
you're really dealing with two different
surfaces, and they just happen to have
vertexes that share the same 3D space.
B]

I don't see that to be true. I'm dealing with the same surface (in essence), it's a texture laid on a mesh that wraps round on itself. A mesh should be considered a single surface.
Why can't the OpenGL board introduce some kind of extension whereby you can specify a texture coordinate for every index in the indices array? (instead of for every vertex in the vertex array which the indices refers to)

Maybe there's a reason for this limitation, but I can't think of one. But then again, I haven't written any texture mapping functions in software, so maybe a texture coordinate needs information gathered at the time of transformation to work properly.

Really like the hell theme, by the way.