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
opengl my own model format loading
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
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!
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!
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement