• Advertisement
Sign in to follow this  

opengl my own model format loading

This topic is 4348 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 made something wrong probably... I wrote an exporter for blender which exports vertexes, every face like: 1.0 0.5 0.7 -1.0 -0.2 0.9 0.7 0.5 0.3 and I made a GLUT program to load this model. here's the drawing part void renderScene() { float x,y,z; ifstream fin("c:\\export.txt"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBegin(GL_QUADS); while (fin.good()) { fin >> x; fin >> y; fin >> z; glVertex3f(x,y,z); } glEnd(); glutSwapBuffers(); } for me it looks ok, but really, some faces aren't rendered, and I don't know why... Here is how it looks (it is supposed to be without these holes, full smooth shape). http://i2.tinypic.com/so73pj.jpg

Share this post


Link to post
Share on other sites
Advertisement
Are you sure blender exports your models to triangles?

It is possible that it exports it as faces , consider the following two quads
// Quad one
a
b
c
d
// Quad two
z
x
y
u
// Quad three
f
..


Can also double to mean
// Triangle 1
a
b
c
// Triangle 2
d
z
x
// Triangle 3
y
u
f


Also make sure backface checking is off!

Share this post


Link to post
Share on other sites
Quote:
Original post by dawidjoubert
Also make sure backface checking is off!



I was going to say something similar, except that for performance reasons, you may want to make sure all the vertices are wound correctly rather than turning backface culling off.

-AJ

Share this post


Link to post
Share on other sites
Blender exports as quads, exactly as I posted glBegin(GL_QUADS)... how do you turn backface off?

EDIT: Nevermind, I fixed it. The problem was with my exporter, I was using old version and he exported just vertexes, not faces... ;/
*problem solved*

Share this post


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

  • Advertisement