Jump to content
  • Advertisement
Sign in to follow this  

OpenGL OpenGl - shape from a file

This topic is 2819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a problem with loading a shape from a file.
Beginning of the file (which is 5MB) is as follows:

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!

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!