| further reading | more topics » |
| programs | 3D theory | physics | maths | software | technology | about site | sitemap |
| index | language | dev tools | games | structure | platforms | OOAD | information |
| index | setup | 2d | 3d |
| index | dx9vb | dx9C# | OpenGL C++ |
| index | introduction | first | shapes | 3D | rotation | textures | camera |
| keyboard | moving |
|
This toturial was written for me by Imran Khan (imranahmedkhan82@hotmail.com,
iak1982@yahoo.com). |
|||
|
3D Rotation : This Section will add rotationally motion to the
3d Objects we will use ' glRotatef ' method for rotation. 'glRotatef ' got 4 arguments , 1 st is the angle of rotation , 2nd is x-axis , 3rd is y-axis,4th is z-axis. here is the code...
We have just add one line " glRotatef(rtri,0.0f,1.0f,0.0f); " . rtri is an float type variable.We will use this variable so that the pyramid will be in rotation all the time.We only want rotation on Y-axis thats why we pass " 1.0f " in the 3rd argument. Same as above we add one line for Cube rotation.
We want rotation on X and on Z-axis as well thats why we pass "1.0f" in 2nd and 4th argument. Now here is the increament and decrement for the 2 variable , " rtri" & "rquad", so that both object remain in rotation.
Simple we increament,decrement everytime when the method run. You can change its value to check the effent.Higer the value more fast it wil rotate. Here will be the Output.
|
|
metadata block
|
|
| see also: | |
| Correspondence about this page | |
|
Book Shop - Further reading. Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them. |
|
|
Commercial Software Shop Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them. |
|
|
Can this page be improved? Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page. |
|
|
progam I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here: |
for kdgame programming: http://sourceforge.net/projects/kdgame/ |
This site may have errors. Don't use for critical systems.
Copyright (c) 1998-2010 Martin John Baker - All rights reserved - privacy policy.