Hello all

i posted a post prior to this one on implementing a 3d api but noone responded. Hopefully someone will respond to this. Well as i said I am implementing my own 3d api just for the sake of understanding of the inner workings. I want to creae the camera transformation. This is what i have done so far.

- Created the lookAT function to know the camera eye, lookAt point and up direction. I use this function to get the camera vectors u,v,n.

2)Created the perspecive function to create the perspective transformation. The matrix i use is as follows

```
cot(fov) 0 0 0
0 cot(fov) 0 0
0 0 f+n/f-n -1
0 0 2fn/f-n 0
```

where f is the far clippping plane and n is the near clip plane.

Now i simply copncatenate the two matrices one from the lookat function (that I have previously given in my post on gluLookAt function) and other the abve matrix. Then I multiply all the geometry with this concatenated matrix. Now the problem is this.

1)I only see flat version of primitives no 3d depth. I am even renormalizing the matrix after multiplication with the concatenated matrix by dividing all the points x and y values by the z value. Where do you think the problem is. Am i missing anything here. Doyou have any good reference on this stuff.

Thanx

MMMovania

I don’t think the perspective projection matrix is correct. What is cot(), by the way? Check out the Opengl Red book. The projection matrix in opengle is:

2n/(r-l),0,(r+l)/(r-l),0

0,2n/(t-b),(t+b)/(t-b),0

0,0,-(f+n)/(f-n),-2fn/(f-n)

0, 0, -1, 0

Originally posted by surfel17:

[b]I don’t think the perspective projection matrix is correct. What is cot(), by the way? Check out the Opengl Red book. The projection matrix in opengle is:

2n/(r-l),0,(r+l)/(r-l),0

0,2n/(t-b),(t+b)/(t-b),0

0,0,-(f+n)/(f-n),-2fn/(f-n)

0, 0, -1, 0[/b]

Hello there thanx for your reply

I am not doing this in opengl but am writing my own api based on the info given here

```
http://graphics.cs.ucdavis.edu/GraphicsNotes/Viewing-Transformation/Viewing-Transformation.html
```

cot is the cotangent a trignometric identity which is = 1/tan

I have already dissected the opengl camera fucntions gluperspective and gluLookAt. Now i want to go ahead and see how it is actually multiplied by the vertices. For that I am doing a simple 3d api of my own cos opengl does the real work under the hood.

THanx for your response.

MMM

have you tried the shading language…?

you can set up a vertex shader to play around with matrix stuff.

the standard transformation is:

```
vertex_pos * ModelView * Projection
```

(the matrix multiply functions are built into the shading language, and the matrix values can be passed in as parameters…)

the two main sources i used were:

The Orange Book (“OpenGL Shading Language” - Randi Rost)

and

Clockwork Coders website tutorials.

also, you could try using Render Monkey (can be downloaded from developer site in www.ATI.com )

sorry, been away for a while…

the graphics board has to support shader programs to use rendermonkey etc.

i think you need to use a geForce 3 or newer.

the newer (more advanced) the board, the more support for extra features and longer programs you get.