Registriert: Sa Jan 01, 2005 17:11 Beiträge: 2067
Programmiersprache: C++
If you are in modelview the coords haven't changed because of the translation afterward.
If you are in projection the coords minus the vector from translation.
But I think, that this isn't your question.
If you are only moving and rotating in modelview, then you can get the modelview_matrix and take the values from it:
Code:
/------------------\
|r_11|r_21|r_31| x |
|r_12|r_22|r_32| y |
|r_13|r_23|r_33| z |
|----|----|----|---|
\------------------/
r is the rotatematrix, you can get the rotation out of it, but don't ask me how, even I should know. (x, y, z)^T is the translationvector, after rotating you add this vector to your original points.
In an example: You haven't rotated or scaled, but moved (3,2,1)^T before drawing the vertex at coords (1,1,1)^T. The matrix should look like:
Code:
/-------\
|1|0|0|3|
|0|1|0|2|
|0|0|1|1|
|-|-|-|-|
\-------/
The - are values that could be ignored, the should be zero, but I'm not sure of it. The calculation for the coords will be:
Code:
/1|0|0\ /1\ /3\ /4\
|0|1|0|*|1|+|2|=|3|
\0|0|1/ \1/ \1/ \2/
Another thing at last: The matrix is stored as an array with 16 elements, indexes and matrixelements will look like this:
Sorry it's not the point i wanna know, btw thanks alot 4 ur explanation.
Is there any functions that OpenGL has to get a vertex location/coordinates?
Example:
if i click a vertex using mouse then the app returns the vertex coordinate value. Do i have to make my own data structure and function or i just use OpenGL function( if it's available)?
I think it's not that easy to click a vertex, as a vertex itself is invisible. You may click a Point defined by a Vertex oder part of a Triangle defined by a vertex.
E.G.: if you wanna click a point with a certain vertex you should have a look at the selectiontutorial but its in german so maybe you find somebody who is willing to translate it.
PS: if you don't think of Clicking a Point or something else but really clicking into the drawn scene and hope there is any possibility to get that points vertex, you will get some thousand vertices or more (i don't know) because if you click you have only 2 coords (x,y) but in 3D you need the third one, so you get the vertices of a lot of Points with the same x,y Coords but diffrent zCoords. But all these things are explained in detail in the tutorial.
For all the others, please check whether there are important faults in translation, grammatics or whatever.
The title will be Selection(eng) until anyone wrote a script (PHP) that divides into German and English.
Mitglieder in diesem Forum: 0 Mitglieder und 10 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.