opengl my own model format loading

Started by
2 comments, last by Hand_Of_Destruction 18 years ago
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
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!
----------------------------

http://djoubert.co.uk
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
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
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*

This topic is closed to new replies.

Advertisement