Log in or register to post comments

Question About obj2opengl

September 15, 2011 - 8:14am #1

Hi all, I'm using this script to convert a model of 1,28 MB, but I have a question....the script will exit or I must force end? and use the .h generated?

thanks

Re: Question About obj2opengl

January 27, 2012 - 1:47am #10

You may have to tweak the script slightly.
I think it was something I had to do before the script worked for me.
It may also be worth contacting the script developer?

Re: Question About obj2opengl

January 3, 2012 - 4:00am #9
Arcer wrote:

I've replaced my obj2opengl script and now it go well....but How can I use the .h generated file?

what did you replace it with? i am stuck for ages on the process of getting .h files i can display :(

Re: Question About obj2opengl

September 16, 2011 - 11:27am #8

Sorry, I don't understand the question. We only provide sample code for importing png or jpg files, but you can write or use any texture solution you'd like.

- Kim

Re: Question About obj2opengl

September 16, 2011 - 12:43am #7

ok :D now is right :D

another question, I have to import object texture (jpg or png ) alway?

Re: Question About obj2opengl

September 15, 2011 - 10:10am #6

If I had to guess I'd say the model is rendering but it's too small. Try increasing kObjectScale.

- Kim

Re: Question About obj2opengl

September 15, 2011 - 10:03am #5

so i'll write all my steps:

1) I've puted in jni folder the banana.h example whit obj2opengl script
2) I've Putted this line

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,	 (const GLvoid*) &bananaVerts[0]);

glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &bananaNormals[0]);

glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &bananaTexCoords[0]);

glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);

glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);

glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
(GLfloat*)&modelViewProjection.data[0] );

glDrawArrays(GL_TRIANGLES, 0, bananaNumVerts);

instead of

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
                              (const GLvoid*) &teapotVertices[0]);
        glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
                              (const GLvoid*) &teapotNormals[0]);
        glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                              (const GLvoid*) &teapotTexCoords[0]);
        
        glEnableVertexAttribArray(vertexHandle);
        glEnableVertexAttribArray(normalHandle);
        glEnableVertexAttribArray(textureCoordHandle);
        
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
        glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
                           (GLfloat*)&modelViewProjection.data[0] );
        glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT,
                       (const GLvoid*) &teapotIndices[0]);

3) I've compiled with ndk-build and clean my eclipse project...
4) I've modifiede in ImageTargets.java in loadTexture with this line:

mTextures.add(Texture.loadTextureFromApk("banana.jpg", getAssets())); 
    	mTextures.add(Texture.loadTextureFromApk("TextureTeapotBrass.png",
    	                                                 getAssets()));
    	mTextures.add(Texture.loadTextureFromApk("TextureTeapotBlue.png

4) I've putted banana.jpg in assets folder...

but when I launch application in my smartphone I see nothing neither with chips nor with stone marker...why?

Re: Question About obj2opengl

September 15, 2011 - 8:59am #4

I've replaced my obj2opengl script and now it go well....but How can I use the .h generated file?

Re: Question About obj2opengl

September 15, 2011 - 8:46am #3

We don't provide support for the use of 3rd party scripts, you may want to post the question on the developer's website. It's possible that your model is too large or complex for that script to handle.

Also, make sure you have triangulated your model before trying to use it.

- Kim

Re: Question About obj2opengl

September 15, 2011 - 8:37am #2

I've looked inside the .h generated file and the script never close the big array, it's interrupted....why?

Log in or register to post comments