Storing Lines in Obj File

Hi i m trying to store Line i.e 3 lines for a triangle in an obj file. I am doing so by using element option l ( just like we use f for face)
The reason i am using l is that if i use f option it fills my triangle but i don’t want to fill it. i just want to store wireframe triangle in obj file.
how can i do so.

my obj file looks like this:-

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
l 1 2
l 2 3
l 3 4

But all it displays is point, not line.

how can i store and display line from obj file into openGL.


I don’t know the answer to your question regarding the .obj file format, however you can use


to have triangles/quads/polygons rendered as wireframe instead of filled (GL_FILL), perhaps that helps you.

yes we can use this… but how do i specify that in my OBJ or MTL file?

l v1/vt1 v2/vt2 v3/vt3 . . .

You store lines in an obj-format like you say

And display it in your program like carsten says


i think i m confused here… please bear with me.
obj file are supposed to be standard, isnt it?

I want to generate the obj file that can be read by other application for eg. MeshLab etc. correctly. Every information that i want to display should be there in obj.

When i tried displaying my obj file in MeshLab it displayed point only. Now i don’t think i can input glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) in MeshLab can i?

When i tried displaying my obj file in MeshLab it displayed point only.

That sounds like a problem with MeshLab. Maybe it doesn’t implement all of the .obj format. The MeshLab page suggests that it is primarily for dealing with 3D scanning data. I don’t imagine that 3D scanners generate line data.