dy1217

10-01-2000, 04:57 AM

Given view window of 768x768 pixel, what is the viewport tansformation matrix for transform the 3D object coordinate to 2D window coordinate? Thanks!!!

View Full Version : Viewport Transformation matrix

dy1217

10-01-2000, 04:57 AM

Given view window of 768x768 pixel, what is the viewport tansformation matrix for transform the 3D object coordinate to 2D window coordinate? Thanks!!!

dy1217

10-01-2000, 10:57 AM

if anyone know how to transform the Nomalized device coordinates to Widow coordinates implemented manually by program, could you please answer? it's urgent! Thanks a lot!!!

Originally posted by dy1217:

Given view window of 768x768 pixel, what is the viewport tansformation matrix for transform the 3D object coordinate to 2D window coordinate? Thanks!!!

Originally posted by dy1217:

Given view window of 768x768 pixel, what is the viewport tansformation matrix for transform the 3D object coordinate to 2D window coordinate? Thanks!!!

zed

10-02-2000, 12:26 AM

im not really understanding your question but have u looked in gluUnProject(..) or gluProject(..)

dy1217

10-02-2000, 05:28 AM

At last, there is somebody concerning my problem. thanks.

What I'm doing is as following:

1. Extract the tranformation matrix including the modelview matrix projection matrix and viewport transformation, since w=1, so I don't need perspective division.

2.Apply this transformation matrix to the original coordinate by program NOT by OpenGL's function, so that I can know the exact correspoinding relation between the original coordinate and the screen coordinate, that means given a point coordinate on the object, I can know exactly where this point put on the screen.

my problem is as following:

I have multiplied the modelview and projection matrices and apply it to the original coordinate and got the normalized device coordinate, then the next step should be applying the viewport transformation, but I have no idea about this. yesterday I think it over, is the viewport transformation like this given Screen Pixel(Wx,Wy,Wz) and Normalized Device Point(Nx,Ny,Nz) and if viewport is 680x680:

Wx=(Nx+1.0)*680/2

Wy=(Ny+1.0)*680/2

Wz=(Nz+1.0)/2

all in all, the screen coordinate computed by my program is a little different with what computed by OpenGL's function, but the little different make work not go on.

If somebody happens know the trick about the this, would you pls be kind answere it , thanks for your coming help.

Originally posted by zed:

im not really understanding your question but have u looked in gluUnProject(..) or gluProject(..)

What I'm doing is as following:

1. Extract the tranformation matrix including the modelview matrix projection matrix and viewport transformation, since w=1, so I don't need perspective division.

2.Apply this transformation matrix to the original coordinate by program NOT by OpenGL's function, so that I can know the exact correspoinding relation between the original coordinate and the screen coordinate, that means given a point coordinate on the object, I can know exactly where this point put on the screen.

my problem is as following:

I have multiplied the modelview and projection matrices and apply it to the original coordinate and got the normalized device coordinate, then the next step should be applying the viewport transformation, but I have no idea about this. yesterday I think it over, is the viewport transformation like this given Screen Pixel(Wx,Wy,Wz) and Normalized Device Point(Nx,Ny,Nz) and if viewport is 680x680:

Wx=(Nx+1.0)*680/2

Wy=(Ny+1.0)*680/2

Wz=(Nz+1.0)/2

all in all, the screen coordinate computed by my program is a little different with what computed by OpenGL's function, but the little different make work not go on.

If somebody happens know the trick about the this, would you pls be kind answere it , thanks for your coming help.

Originally posted by zed:

im not really understanding your question but have u looked in gluUnProject(..) or gluProject(..)

dy1217

10-02-2000, 10:56 AM

That's it. I got it. Thanks, Zed.

Originally posted by dy1217:

At last, there is somebody concerning my problem. thanks.

What I'm doing is as following:

1. Extract the tranformation matrix including the modelview matrix projection matrix and viewport transformation, since w=1, so I don't need perspective division.

2.Apply this transformation matrix to the original coordinate by program NOT by OpenGL's function, so that I can know the exact correspoinding relation between the original coordinate and the screen coordinate, that means given a point coordinate on the object, I can know exactly where this point put on the screen.

my problem is as following:

I have multiplied the modelview and projection matrices and apply it to the original coordinate and got the normalized device coordinate, then the next step should be applying the viewport transformation, but I have no idea about this. yesterday I think it over, is the viewport transformation like this given Screen Pixel(Wx,Wy,Wz) and Normalized Device Point(Nx,Ny,Nz) and if viewport is 680x680:

Wx=(Nx+1.0)*680/2

Wy=(Ny+1.0)*680/2

Wz=(Nz+1.0)/2

all in all, the screen coordinate computed by my program is a little different with what computed by OpenGL's function, but the little different make work not go on.

If somebody happens know the trick about the this, would you pls be kind answere it , thanks for your coming help.

Originally posted by dy1217:

At last, there is somebody concerning my problem. thanks.

What I'm doing is as following:

1. Extract the tranformation matrix including the modelview matrix projection matrix and viewport transformation, since w=1, so I don't need perspective division.

2.Apply this transformation matrix to the original coordinate by program NOT by OpenGL's function, so that I can know the exact correspoinding relation between the original coordinate and the screen coordinate, that means given a point coordinate on the object, I can know exactly where this point put on the screen.

my problem is as following:

I have multiplied the modelview and projection matrices and apply it to the original coordinate and got the normalized device coordinate, then the next step should be applying the viewport transformation, but I have no idea about this. yesterday I think it over, is the viewport transformation like this given Screen Pixel(Wx,Wy,Wz) and Normalized Device Point(Nx,Ny,Nz) and if viewport is 680x680:

Wx=(Nx+1.0)*680/2

Wy=(Ny+1.0)*680/2

Wz=(Nz+1.0)/2

all in all, the screen coordinate computed by my program is a little different with what computed by OpenGL's function, but the little different make work not go on.

If somebody happens know the trick about the this, would you pls be kind answere it , thanks for your coming help.

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.