Log in or register to post comments

How can i change the 3d object ?

March 5, 2013 - 8:15am #1

Hi,

i had tested and run the imageTargeted file. I am happy that the teapot is shown when i pointed the camera to the marker.

However, i would like to ask, is it possible to change the 3d object?

Can i change the teapot into my desired object?

What should i do?

Is there any step-to-step guidance for the tutorial? I have no idea at all.

Thanks for your help.

How can i change the 3d object ?

May 12, 2013 - 7:13am #21

hey mobiro, glad to hear that.

How can i change the 3d object ?

May 12, 2013 - 12:41am #20

Okey @AlessandroB....
My Rabbit looks like stand on grass image target now.

Thanks for all of your advice.
Have a nice day.

How can i change the 3d object ?

May 11, 2013 - 6:36am #19

@mobiro:

you need to adjust the translation part (see the "translatePoseMatri" line of code) until you find a good result

 

@ snake:

put the rotation code just before the scalePoseMatri line

 

How can i change the 3d object ?

May 11, 2013 - 6:32am #18

Where should I put the code :
 

float angle = 90.0f;
    SampleUtils::rotatePoseMatrix(angle, 1.0f, 0.0f, 0.0f, &modelViewMatrix.data[0]);

 

for rotating the object 90 degrees  in file ImageTarget.cpp?

Because wherever I tried does not work.

How can i change the 3d object ?

May 11, 2013 - 4:49am #17

Yes... it works.
I can rotate my object around X & Y...
Thanks for your advice @AlessandroB.

Yeah, now, I can change the image for target too...
But, I see the object is to high. 
Can you tell me please, how to solve this issue.
I need the object looks like stand on the grass.

AttachmentSize
Image icon rabbit-on-the-grass.png233.71 KB

How can i change the 3d object ?

May 11, 2013 - 2:08am #16

Hi, have you tried setting the angle to 90.0f (or other non null value ?)

 

How can i change the 3d object ?

May 10, 2013 - 11:31pm #15

AlessandroB wrote:

Hi, the Z axis is orthogonal to the trackable plane, while the x and y are aligned with the trackable plane;

if you want to make your model stand, you can try rotating it around X or Y, for instance, a 90 degrees rotation around X would be:

 

float angle = 0.0f; // YOUR ROTATION ANGLE HERE (in degrees)
    SampleUtils::rotatePoseMatrix(angle, 1.0f, 0.0f, 0.0f,
                                 &modelViewMatrix.data[0]);
 
 
 

Hi @AlessandroB,

What file is I have to add that code? and what line?

or how can I do that (rotate the object) for OpenGl ES 1.1

cause I see that code is for OpenGl ES 2.0

 

I try add this code

float angle = 0.f;
glRotatef(angle, 1.f, 0.f, 0.f);

before

glScalef(kObjectScale, kObjectScale, kObjectScale);

It's not working.

 

How can i change the 3d object ?

May 10, 2013 - 5:49am #14

Hi, you can add as many rotations as you want, this should not cause any crash;

if you get a crash, that might be because of some other reasons; for instance, have you tried adding those rotations to the ImageTargets sample without any other code modifications ? that should work.

Other possible crash reasons could be:

- the 3D model that you are using is too large (too many triangles)

- you are calling the rotate functions from outside the OpenGL thread (i.e. not in the renderFrame() function)

 

How can i change the 3d object ?

May 10, 2013 - 3:29am #13

Is it possible for me to modify both X and Z axis rotation? 

I have try the following method:

 

 SampleUtils::rotatePoseMatrix(kObjectRotateX, 1.0f, 0.0f, 0.0f,  &modelViewMatrix.data[0]);
 SampleUtils::rotatePoseMatrix(kObjectRotateZ, 0.0f, 0.0f, 1.0f, &modelViewMatrix.data[0]);
 
But when the 3D object is about to show up , the whole program breaks down with the logcat saying:
 
Fatal signal 11 (SIGSEGV) at 0x5c8c8000(code =2).
 
Any help will be appreciated!!

How can i change the 3d object ?

April 19, 2013 - 11:15am #12

Hi, the Z axis is orthogonal to the trackable plane, while the x and y are aligned with the trackable plane;

if you want to make your model stand, you can try rotating it around X or Y, for instance, a 90 degrees rotation around X would be:

 

float angle = 0.0f; // YOUR ROTATION ANGLE HERE (in degrees)
    SampleUtils::rotatePoseMatrix(angle, 1.0f, 0.0f, 0.0f,
                                 &modelViewMatrix.data[0]);
 
 
 

How can i change the 3d object ?

April 19, 2013 - 10:34am #11

Yea thank you its very helpful :D

 

And for rotatte my object...

you recommend add this code:

 
float angle = 0.0f; // YOUR ROTATION ANGLE HERE (in degrees)
    SampleUtils::rotatePoseMatrix(angle, 0.0f, 0.0f, 1.0f,
                                 &modelViewMatrix.data[0]);
 
Could you explain which angle (float) of x,y,z,w
 
nb:I want to make it stand

How can i change the 3d object ?

April 18, 2013 - 8:37am #10

If the texture is mis-positioned it, I would assume the texture coordinates are not fully exact.

Doe the model look much different if you open it with a 3D modeler ?

Another reason could be that the texture is just flipped vertically (i.e. it could be that it is upside-down);

try editing the texture with any image editor, flip it vertically and save it.

Then use the new texture in your app, perhaps this could solve the issue.

 

How can i change the 3d object ?

April 18, 2013 - 8:32am #9

Hey!..its worked!! Im so happy hehe :D

But my texture  isn't rendered correctly ,its little miss posisition

here SS:

 

How can i change the 3d object ?

April 18, 2013 - 7:38am #8

Hi, NPOT textures are supported on some devices, but it's likely the cause of your issue.

However, you could try changing the OpenGL texture initialization code in the initRendering() function:

 

for (int i = 0; i < textureCount; ++i)
    {
        glGenTextures(1, &(textures[i]->mTextureID));
        glBindTexture(GL_TEXTURE_2D, textures[i]->mTextureID);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        
        // NEW lines of code
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
        /////////    

            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textures[i]->mWidth,
                textures[i]->mHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
                (GLvoid*)  textures[i]->mData);
    }

If you still see black textures even with the changes above, then that is a confirmation that your device does not support NPOT textures.

 
Concerning your second question (using more than one texture):
you probably need to split your 3D model into sub-objects, and render each object separately, using its own texture.
 

How can i change the 3d object ?

April 18, 2013 - 7:27am #7

AlessandroB wrote:

Hi, if you read the tutorial throught the end, it will also show you how to change the OpenGL code so not use the indices

(see glDrawArrays() function at the end of the article)

 

Hi Alessandro...

Thx for that solution...its worked, :D

But now my problem in texture hehe :P , i've 2 object sample

1st objetc :
-My texture is rendered all black..., i assume my device not suport NPOT (My device is Motorola RAZR) ,is there any solution???

 

2nd objext:

- In this case,i've using more than one texture.it can be rendered??how??

 

 

nb:Im not realy understand abaout 3D modeling...im just folowing some tutorial.

How can i change the 3d object ?

April 1, 2013 - 7:39am #6

Hi, if you read the tutorial throught the end, it will also show you how to change the OpenGL code so not use the indices

(see glDrawArrays() function at the end of the article)

How can i change the 3d object ?

March 31, 2013 - 11:43pm #5

AlessandroB wrote:

No, Unity is not required; how to change the OpenGL code is explained in that article (https://developer.vuforia.com/resources/dev-guide/replacing-teapot)

please read it and you'll find all the answers.

 

Note: Unity is not required, however, if you plan to load complex 3D models, you might find it difficult to do it in OpenGL; in that case, we recommend to use Unity as this functionality (and many others) is provided out-of-the-box.

 

 

Hi...sorry i've another qustion again haha

 

im done folowing  this  article (https://developer.vuforia.com/resources/dev-guide/replacing-teapot).Simply we just  change array in teapot.h right??
But i cant find Indices like teapotIndices in myobject.h 
Also what the mean of 
NUM_TEAPOT_OBJECT_INDEX 

regards

How can i change the 3d object ?

March 5, 2013 - 10:28am #4

No, Unity is not required; how to change the OpenGL code is explained in that article (https://developer.vuforia.com/resources/dev-guide/replacing-teapot)

please read it and you'll find all the answers.

 

Note: Unity is not required, however, if you plan to load complex 3D models, you might find it difficult to do it in OpenGL; in that case, we recommend to use Unity as this functionality (and many others) is provided out-of-the-box.

 

How can i change the 3d object ?

March 5, 2013 - 10:23am #3

Hi,

is unity required in order to change the object?

How can i change the opengl code?

How can i change the 3d object ?

March 5, 2013 - 8:39am #2

Hi, yes you can change the teapot;

here is an article explainin how to do that step-by-step:

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

 

Log in or register to post comments