mesh from blender to opengl

Hi All,

I have a mesh from blender in a text file :
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
s off
f 2 3 4
f 8 7 6
f 5 6 2
f 6 7 3
f 3 7 8
f 1 4 8
f 1 2 4
f 5 8 6
f 1 5 2
f 2 6 3
f 4 3 8
f 5 1 8

Problem is if my meshes get bigger eg with a Sphere how do I attach the letter f (as float) to the end of the vertices numbers?
Is there a quick way of doing this?

This is not an OpenGL question. The mesh you’ve created from Blender is in .obj format. These are not OpenGL commands. The lines simply define the vertices and polygons making up a model. This is a modeling (or CAD) format. Because .obj is a simple, ASCII format, it is common from people to import models in this format into OpenGL programs. But that requires writing quite a bit of OpenGL code in C, C++, or some other programming language. There is no need to attach the letter ‘f’ to the vertex coordinates.

Thanks for your reply Carmine.

What I am trying to do is add a Sphere mesh from blender to OpenGL ES 2.0.
Are you saying Carmine that if I copied these vertices into my OpenGL Renderer they would not work?.
I am using Android Studio and Java.
I don’t understand why I would not need to add the letter “f” at the end of these vertices numbers as Java requires this for floats.
When I copied a Sphere mesh into notepad it looked like thousands of vertices in it.
To then start putting the letter f on each vertices would be a laborious task.
Obviously if I decided to create a mesh in just OpenGL alone I believe that is a huge amount of work!

Regards

I have not worked with OpenGL ES, though I assume it’s a subset of OpenGL.
I’ve only worked a little bit with Java. So I’m a little hazy on what you’re asking.
Can your ‘OpenGL Renderer’ display anything yet - perhaps a simple cube?
If so, post the part of the code that specifies the vertices, lines, and faces of the cube.
I might be able to help you after seeing that.

Sounds like you’re trying to cut and paste vertex definitions into your renderer.
As you say, this would be cumbersome with large, complex models.
What’s usually done is that a subroutine is written which reads in the .obj file
and calls the appropriate GL commands to render it.