RESOLVED: Bug in c++ texcoord

that looks like a bug to me …

should be … TexCoord& …

// Set texture coordinate data for existing points.
// the numLayers is the texcoord size and can be from 1 up to 8 for texture layers
// the pointIdx specifies the point index with the texture coords

!!! virtual bool setTexCoord(const TexCoord& tex, int32_t numLayers, int32_t pointIdx) = 0;
//virtual bool setTexCoord(const TexCoord* tex, int32_t numLayers, int32_t pointIdx) = 0;

// Set texture coordinate data for existing points.
// the numLayers is the texCoord size and can be from 1 up to 8 for texCoord layers.
// The startPointIdx indicates the start index of the points to set texCoord for.
virtual	bool	setTexCoords(const TexCoord* t, int32_t numPoints, int32_t numLayers, int32_t startPointIdx) = 0;

The current declaration for that function is correct. You are passing us one or more TexCoords, and the argument points to the start of that memory.

but when i wanna call the function with

output->setTexCoord(TexCoord(tu, tv, tw), layers, idc);

and i have it declaired as it is: (with the pointer)
virtual bool setTexCoord(const TexCoord* tex, int32_t numLayers, int32_t pointIdx) = 0;

it does not work.

when i change the declaration to; (with the reference)
virtual bool setTexCoord(const TexCoord& tex, int32_t numLayers, int32_t pointIdx) = 0;

it works as it does with color and add point to group …

or do i do something wrong?
tried also to feed a std::vector with the uvw - but with the pointer, that also failed …

For clarity you should declare your TexCoord on the line above as a variable, and pass a pointer to it via the & operator.

TexCoord tc(tu, tv, tw);
output->setTexCoord(&tc, layers, idc);
1 Like

thank you a lot!!!

quit new to all that c++ stuff :slight_smile: