开发者

Approach to create complex 3D drawings in OpenGL ES (on Android)?

开发者 https://www.devze.com 2023-01-02 07:12 出处:网络
I\'m new to opengl-es and I wonder how people are able to draw th开发者_如何学Goese much detailed OpenGL ES graphics, e.g. on Android OS. It\'s already hard to draw a single squre, because it\'s compo

I'm new to opengl-es and I wonder how people are able to draw th开发者_如何学Goese much detailed OpenGL ES graphics, e.g. on Android OS. It's already hard to draw a single squre, because it's composed of triangles due to the reason that OpenGL ES obviously cannot draw anything else than triangles. I thought about this approach:

  • Drawing and rendering an object in Blender.
  • Export it somehow as array of vertices and an array of colors
  • Copy this array of vertices into the Java code
  • Run the code

Or are there approaches to solve such problems in a better way? I do not think that people just "draw" their graphics as array of vertices in the code. I'm sure they draw them anywhere else and import it into the code. If there is such a solution with Blender, I would be pleased to know how this is solved.

Regards.


You can save your model from Blender e.g. as Wavefront OBJ file. In Blender, you can also select to triangulate the model for you, which will result in a list of just triangles, ready for drawing. OBJ is a very simple format, it just lists in ASCII the position of each vertex and then which vertices belong to each triangle. Either convert the OBJ to a format specific to your application (e.g. binary buffer you can directly load to OpenGL) or find yourself one of the many OBJ loaders, or write your own reader.

There are a lot of other common formats available, you should take a look at them and see if there is an importer for Android available.


What I've found is that you can Load 3D models with min3D directly to your program using:

min3d

I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消