PDA

View Full Version : Storing Lines in Obj File



miztaken
05-26-2010, 01:00 PM
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.

thanks
miztaken

carsten neumann
05-26-2010, 02:03 PM
I don't know the answer to your question regarding the .obj file format, however you can use



glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);


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

miztaken
05-28-2010, 07:04 AM
yes we can use this.. but how do i specify that in my OBJ or MTL file?

Mikkel Gjoel
05-28-2010, 07:37 AM
http://local.wasp.uwa.edu.au/~pbourke/dataformats/obj/

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

But all it displays is point, not line.
how can i store and display line from obj file into openGL.
You store lines in an obj-format like you say

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

And display it in your program like carsten says

glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

miztaken
05-28-2010, 08:01 AM
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?

Alfonse Reinheart
05-28-2010, 10:03 AM
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.