1

I have a Blender .obj-file which gets uploaded to a tomcat webserver.

Now I need to convert and store this file into an Oracle database.

The converted data should be usable by an Android OpenGL Viewer (I don't implement that Android app, so I can't change the way it gets its data), who gets its data somehow from the database.

My question is: how can I convert the .obj-file into something that the OpenGL Viewer will understand and store it to the database?

genpfault
  • 51,148
  • 11
  • 85
  • 139
The.Prophecy
  • 493
  • 2
  • 5
  • 7

2 Answers2

0

I've previously recommended ObjImport from Pixel Nerve for this kind of work. Note that this tool is really just a parse, and you still have to write a ton of code in order to get it to do something useful.

There is another option which I have not used but I have heard good things about - JMonkeyEngine actually integrates with OpenGL. You still have to write quite a bit of code but its closer to the goal post, so to speak.

Perception
  • 79,279
  • 19
  • 185
  • 195
0

Well, just dump the OBJ file into a SQL schema that can represent vertices, faces and a list of faces. For example

CREATE TABLE vertices (object_ID KEY, vert_ID INTEGER, x DOUBLE, y DOUBLE, z DOUBLE);
CREATE TABLE faces(object_ID KEY, vertex_A INTEGER, vertex_B INTEGER, vertex_C INTEGER);

Then to load your object to OpenGL

SELECT x,y,z FROM vertices WHERE objectID = ... ORDER BY vert_ID;

and put the result into a vertex array. Similar for the faces

SELECT vertex_A, vertex_B, vertex_C FROM faces WHERE objectID = ...;

and use the resulting array for calling glDrawElements

If you don't know how to use vertex arrays and glDrawElements, then first learn their use, so that you know how to use the result of a SQL dump for drawing.

datenwolf
  • 159,371
  • 13
  • 185
  • 298