Log in or register to post comments

Java - Replacing teapot without JNA

March 21, 2014 - 2:00am #1

Hi guys,

I've been trying to replace the teapot for 3 weeks now. All samples and documentation that I find is related to JNA, and I'm not able to integrate it with Vuforia Java sample.

The point is that I managed to control the rotation, translation, scale and almost everything I need to get my project finished... but I can't change the model.


I've been trying what it is said in http://heikobehrens.net/2009/08/27/obj2opengl/ , but without success.


Is there anyone who get his model changed in order to integrate it with the Java project? Any help?


Thank you very much.

Java - Replacing teapot without JNA

October 11, 2017 - 1:06am #10

can you please share the image renderer code of banana.i am struggeling since 3 weeks.

Java - Replacing teapot without JNA

May 19, 2016 - 1:01am #9

Hi did u get any success..Please let me know I want it badly

Java - Replacing teapot without JNA

May 16, 2016 - 6:03am #8

could you please give more info where to set the given java Programes in the pdf fine

Java - Replacing teapot without JNA

June 23, 2014 - 2:25pm #7
Here you are my tutorial. Sorry for the delay... I've been working hard in other projects and I have no time for almost anything!
Let me make you know that I'm not an expert, but I tried my best to do it.
I hope it can be useful for anyone more than for me.

Juan Aguilar.

PDF icon replacingTeapotWithoutJNA.pdf437.15 KB

Java - Replacing teapot without JNA

May 29, 2014 - 2:25am #6

hi atebsy2,

I had a problem with lights . If the model haven't got textures which emulate the lights it seems like a plain 3D-grey-object without any detail on it.

I followed working in other tasks in the project but I'm going to come back to get this done.


Anyway, if you have the textures for the model there is no problem.


I'm very busy right now, but I'll try to do it in PDF as soon as possible.


Thank you for reminding me.


I'll tell you  replying here.


Juan Aguilar.

Java - Replacing teapot without JNA

May 29, 2014 - 2:01am #5

hi Juan Aguilar

did by any chances finally wrote the tutorial on how to convert the .obj file into .java file? 

Java - Replacing teapot without JNA

March 21, 2014 - 3:34am #4


And yes, if you are willing to write  a small tutorial, you are more than welcome, our developers community will benefit from it.


Java - Replacing teapot without JNA

March 21, 2014 - 3:32am #3

Hi Alessandro,

Finally I got  the solution.

I had done everything you told me before  by myself, but the problem was other... However, the fact that you teach me the way what I tried, made me realise that maybe I was in the right way, so I gave this another chance (thank you so much).

The problem was one wrong parameter calling glDrawArrays method, so my Android now shows the bananas in my Activity without using JNA.

What I do is reading from 3 files (locally from the device in "res/raw" folder) one for vertexs, norms and texts. My renderer extracts the arrays from these files and build a Java Object I called "Model", which extends from MeshObject (like the Teapot).

I had to do this because of the limit of Java while declaring static arrays.


I'm going to try other models different from the "Bananas"


I could generate a "tutorial" better detailed with lines of code or whatever if you ask me.

Just make me know.

Thank you very much again,


Juan Aguilar

Java - Replacing teapot without JNA

March 21, 2014 - 2:56am #2

Hi, writing a Java version of the "Replace the teapot" tutorial is in our plans, but for the time being, what I suggest is to follow this approach:

- take the .h opengl file (as you obtain it from the conversion tool),

- then convert the vertex arrays in it to a simple plan text file (in which you list the vertex coordinates and the texture coordinates); you can do that by writing a simple parser in Java, that reads the vertex coordinates C++ .h file and output a text file with those coordinates

- read back the text file in your Java application and fill in the OpenGL vertex arrays.

Note that this requires a bit of coding, but there is no shortcut available at present. The alternative is to use Unity.



Log in or register to post comments