Topic locked

Problem with texturing

June 12, 2014 - 9:28am #1

Hello everyone,

I'm developing an app using vuforia library. I changed the 3d model to mine, I was able to integrate the library with the app, but I'm having problem with the texture of the object.

 

As you can see in the images attached, inside the Blender the texture is perfect, but when I show the 3d model it just doesnt fit correctly in the 3d model.

I've already searched on google, in the forum, but nothing worked.

Some people said to rotate my image in 90 degrees, but that didn't work as well, I've already tried to keep the same object scale in blender and in ImageTargets.cpp, but that also didn't work.

Can somebody help me on this? I've been trying to solve it for weeks!

I also attached my .obj file and it's texture image.

 

Best Regards

 

Problem with texturing

June 13, 2014 - 3:11pm #6

I do appreciate your help!

It finally worked!

The problem was the software I was using to flip my image!

It has a ****** bug so it didn't flip the image correctly!

I used this website to flip my images: http://flipapicture.com/  and everything worked fine!

So again thanks very much for your help :)

Best regards.

Problem with texturing

June 13, 2014 - 1:37pm #5

Sorry about the script thing.

So, after rotating my texture image, my 3d book finally worked,the one I attached at the beginning of this post.

After that, I tried the same thing with a more complex 3d model, like a chair, but I couldn't get the same result, I flipped my texture image over and over, but I still didn't get the texture properly. 

As you can see in the image attached, it seems to be the same problem I had with the book, but I've already flipped the image to all positions, and nothing worked, can you imagine why this is happening?

About the code, I checked the website you mentioned, and the only thing that it's different is this part:

My ImageTargets.cpp

 glDrawArrays(GL_TRIANGLES, 0, book2NumVerts);

Sample Code:

glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT,
               (const GLvoid*) &teapotIndices[0]); 

 

Could it be the problem? I followed some posts here about changing the 3d model and they said that I should use glDrawArrays function instead of glDrawElements.

Thanks for the help!

Best regards.

Problem with texturing

June 13, 2014 - 11:19am #4

Please don't attach script that you find in other websites; you can instead point to the website where you downloaded it from.

Also, have a look at this:

https://developer.vuforia.com/resources/dev-guide/replacing-teapot

and see if there is anything in your OpenGL code that looks suspicious.

 

Problem with texturing

June 13, 2014 - 10:54am #3

Yes, I've already tried that too, but also didnt work. 

I forgot to mention that I'm using this script " obj2opengl.pl " to convert my 3d model to openGL. Is there another way to convert my .obj to .h? I'm starting to think that it might be the problem. I think this script is not generating my .h file properly.

I run the following command: perl obj2opengl.pl book2.obj

I attached it here.

Best regards.

Problem with texturing

June 13, 2014 - 1:07am #2

Have you tried flipping the texture image vertically ? This is usually the culprit (as we have seen from other reports in the past), as the Android / OpenGL sample code might read the image top-down and get you an incorrect texture mapping.

 

 

Topic locked