1

DXF ファイルを読み取ることができるようになりましたが、Android UI で画像を描画することに感銘を受けました。

DXFファイル形式はこちらで確認しました。

OpenGL API を使用して描画する必要があることはわかっています。しかし、DXFファイルを読みながらどこから描き始めたらいいのか混乱。

誰かが私にリンクを教えてくれますか、またはその方法を教えてくれますか?

4

1 に答える 1

0

Not sure how to answer such a general question... Here's a catch-all responseL

OpenGL ES is limited in how it can draw data. You are restricted to drawing points, lines, triangles, triangle strips, and triangle fans. It cannot draw Quads or NGons. Assuming your DXF files have to support NGons, you have a few options:

  1. make assumptions about the NGon faces (like they aren't too concave), calculate a center for the face and use that to draw each face as a triangle_fan
  2. build your own ngon subdivision methods and display as triangles
  3. display only the wireframes
  4. combine ((1 | 2) & 3)

As for actually using openGL to draw, I'd recommend the great tutorials in the Android Development Reference:

OpenGL ES 1.0

OpenGL ES 2.0

Using the GL ES 2.0 example, you would modify the initShapes() method to load your DXF data into the bytebuffer (check out the documentation here). Then you'd modify the onDrawFrame method in your Renderer class to use the byteBuffer with the proper parameters and draw the arrays in the preferred method (GL_LINES or GL_LINE_STRIP for wireframe as one example).

Hopefully that helps

于 2012-05-09T18:23:43.273 に答える