Perspective

I don’t have any experience with perspective but i understand the system. My problem is when i define my environnement with gluPerspective or with glFrustum i have very weird view of my objects on screen, somewhat dark and my pieces look very weird (there is full of line that appears an disappears in place of filled polygons) When i’m in glOrtho mode there is no problems. So do i had forgot to add lines or it’s my light or what?? thanks!

What kind of calls to gluPerspective and glOrtho do you use? Paste some code here. And no, it is definitely not a lighting problem

You should find all you need to know on this site.
<http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/@Generic__BookView;cs=fullhtml;lang=sv&gt;

The chapter 3 is on Viewing…

PS: J’ai vu dans ton profile que tu reste à chicoutimi (et que tu dois donc parler français aussi) moi je viens de Jonquière ça fait drôle de voir du monde de la région dans ce forum. Salut!!!

Here is an exemple of my init code for gluPerspective

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,1,0,10);
gluLookAt(0,0,0,0,0,-15,0,1,0);
glMatrixMode(GL_MODELVIEW);

My object is at (0.0,0.0,-10.0) i see it but not the way it should be.

P.S. Salut Popol c’est vrai que sa fait drole de voir quelqu’un de la region c cool!

First of all i think gluPerspective only take 4 parameters (not 5).
Here a exemple of what i but normally in my program:

gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);

Width and Height are the Width and Height of my window.

Here a reference to this function:

void gluPerspective(GLdouble fovy,
GLdouble aspect,
GLdouble zNear,
GLdouble zFar)
PARAMETERS
fovy
Specifies the field of view angle, in degrees, in the y direction.

aspect
Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).

zNear
Specifies the distance from the viewer to the near clipping plane (always positive).

zFar
Specifies the distance from the viewer to the far clipping plane (always positive).

Hope it’s help you!

I know all that but it doesn’t work, I define my gluperspective on an older version where the lightning system was not enabled (i use glcolor3d, and glortho) and i just replace glortho by gluperspective and it work just fine. When i try on my final version it sucks a lot even if i don’t init my lightning it s a very weird bug i think or i forgot a fondamental fucntion anyone have an idea?!!

the zNear MUST NEVER be 0, if you want it close to 0 you 0.1 :

the reason is : zNear divides some components in the Projection matrix.