This topic is now archived and is closed to further replies.


Projection on the screen (en français)

Recommended Posts

I am sorry but i don''t speak speak very well english. So i can''t explain my problem in english. But if you have a solution for me you can answer me in english. It''s esier to read than to write thx Je vais essayé d''expliquer la chose le mieux possible. J''ai un objet composé de plusieurs sphères. Ce que j''aimerais savoir c''est le poucentage d''espace d''affichage qu''utilise une sphère par rapport à ma fenetre d''affichage. Pour faire cela il me faut les coordonnées écran du centre de la sphère et d''un point sur le bord de la sphère. Je possède les coordonnées du centre de la sphère dans son repère et le rayon de la sphère dans son repère. Mon problème est donc de récupérer les coordonées du centre de la sphère en coordonnée écran. J''ai fait un truc avec les matrices GLMODELVIEW et GLPROJECTION mais je n''arrive pas a obtenir de résultats satisfaisants. Car je suppose que les coordonnées écrans sont du genre x=250 y=250 z=0. Si mon point se situe au centre de ma fenetre qui va de x=0 y=0 à x= 500 y=500 En ce qui concerne GLPROJECTION je fais un : gluPerspective(45.0f, aspect_ratio, 0.1f, 200.0f). Je sais aussi qu''il y a une affaire avec les coordonées homogènes à cause de la projection. Voilà j''espère que ta science de l''open gl pourra m''aider. T''es pas obligé de te creuser la tête si tu a trop de boulot c''est pas grave je me démerderais.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
I think it''s going to be easier, if you don''t use OpenGL for this particular problem at all, since you allready have all the coordinate points you need in object space. Just take a vector from the eyepoint to the center of a sphere, and a second vector from the eyepoint to a point on the sphere''s surface. Both of them in objectspace. Now just project them ''by hand''. That''s quite easy, if you know the FOV (45) and screen dimensions you took at gluPerspective. It''s also going to be faster and more accurate than reprojecting through the OpenGL projection matrix, and you won''t be bothered by homogeneous coords.

Share this post

Link to post
Share on other sites
bable fish gave me this mess:

I go tried to explain the thing the best possible one.
I have an object made up of several spheres. What
I would like to know it is the poucentage of space of display
what uses a sphere compared to my fenetre of display.

To do that I need the co-ordinates screen of the center
sphere and of a point on the edge of the sphere.

I have the co-ordinates of the center of the sphere in sound
locate and the ray of the sphere in its reference mark.

My problem is thus to recover coordonées of the center
sphere in co-ordinate screen. I made a trick with
the matrices GLMODELVIEW and GLPROJECTION but I do not arrive
not has to obtain satisfactory results. Because I suppose
that the co-ordinates screens are kind x=250 y=250 z=0.
If my point is at the center of my fenetre which goes from x=0
y=0 with X = 500 y=500

With regard to GLPROJECTION I do one:
gluPerspective(45.0f, aspect_ratio, 0.1f, 200.0f).

I also know that there is a business with coordonées
homogeneous because of projection.

Here I hope that your science of the open gl will be able to help me.
Be not obliged to you to grow hollow the head if you has too much of
job it is not serious I démerderais itself.

I think something was lost in translation What ever that says, the answer probably requires the use of gluProject or gluUnproject.

Share this post

Link to post
Share on other sites