Jump to content

  • Log In with Google      Sign In   
  • Create Account

OpenGl - shape from a file


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 melol   Members   -  Reputation: 100

Like
0Likes
Like

Posted 27 January 2012 - 04:21 AM

Hello!
I've got a problem with loading a shape from a file.
Beginning of the file (which is 5MB) is as follows:
v
from 0.1 0.1 0.25
at -0.01 0.085 0.02
up 0 1 0
angle 50
hither 1
resolution 1024 1024
b 0.0 0.0 0.0
l 0.4 0.3 0.2 0.25 0.25 0.25
f 0.753 0.753 0.753 1 0 0 0 1
p 3
-0.092314 0.132364 0.018222
-0.092180 0.132348 0.017224
-0.092767 0.130992 0.017231
p 3
-0.087168 0.110390 0.018362
-0.088961 0.111861 0.018336
-0.087443 0.110454 0.017341
p 3
-0.087840 0.105023 0.014367
-0.087237 0.106355 0.014359
-0.087251 0.106353 0.013364

I don't have any idea how to load it in OpenGL project or even what keywords to google.
So far I have a OpenGL project, with a teapot rendered thanks to glutWireTeapot()
Does anyone know if I could in a simple way comment in my code the glutWireTeapot(), an write instead a function which loads my shape form file.

I will appreciate your help very much!

Sponsor:

#2 Relfos   Members   -  Reputation: 318

Like
0Likes
Like

Posted 27 January 2012 - 05:44 AM

Yes, just learn how to draw a triangle in openGL, and write a function to do it, using glBegin glEnd etc, it is easy.
Parsing your fle should be easy too, you should be familiar with the file format, looking at it it seems that each p 3 means a polygon with 3 sides, followed by a list of 3 vertices positions. Possibly the format allows for n-sides polygons, in that case write a function that can draw a polygon with a variable number of sides.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS