Jump to content
  • Advertisement
Sign in to follow this  

texture coord and scale

This topic is 2747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to create a sketchup importer , This is the first chunk of code :

double fu, fv, fw;
double fub , fvb, fqb;
fub = fvb = fqb = 0.;
fu = fv = fw = 0.;
m_pApi->ImportVertexUV(&fu, &fv, &fw, &fub, &fvb, &fqb);
ptUV->U = fu *0.78;
ptUV->V = (1 - fv);
ptUV->W = fw;


ptUVb->U = fub;
ptUVb->V =( 1 -fvb);
ptUVb->W = fqb;


m_pApi->ImportVertexUV(&fu, &fv, &fw, &fub, &fvb, &fqb);
&fu, &fv, &fw are the first UV for front face
&fub, &fvb, &fqb are the coord of back face .

I have for each texture an x scale and an y scale

if(pTexture != NULL)
BSTR texturePath = NULL;
hr = pTexture->get_Filename(&texturePath);
std::string bstrFilename = GetFileName(texturePath);
_bstr_t szTexturePath(bstrFilename.c_str());

double width = 0;
double height = 0;
hr = pTexture->get_XScale(&width);
hr = pTexture->get_YScale(&height);

the resulting textures are not precises , may be the problem are the x and y scale?
I must multiply the scale for the uv coord ?


Share this post

Link to post
Share on other sites
Keeping in mind that I know nothing about sketchup, I am extremely skeptical that you're supposed to the multiplying the u/v/w coordinates by anything, and that reversing v seems to imply that you're loading your textures upside down.

Share this post

Link to post
Share on other sites
Also, why would you multiply the front U by 0.73 and not the back U, if at all?

Probably unrelated to your issue: a front and back UV set??? Im new to programming but not 3d and although you can have more than one UV set, having a front and back UV is something Ive not seen. Is this specific to something your doing? Then again a backface UV set would just be the numerical reverse of the front set. . .

Share this post

Link to post
Share on other sites
On a side note, is there any particular reason you're allocating 'texture coordinate' objects dynamically?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!