Transformations - Translation, Rotation and Scaling
Translation is nothing but moving along an arbitrary axis. Rotation is spinning about an arbitrary axis. Scaling is increase or decrease in size along an arbitrary axis. One important point to remember is that OpenGL uses a right hand coordinate system where Z-ve goes into the Screen. An object said to be undergoing a transformation could be undergoing a translation, rotation and/or scaling. Understanding how different types of transformations work together is very important.
本文将对地球进行建模,让其围绕着太阳,此外它还会有月球伴随,而在下文中将会加入对鼠标和键盘的事件响应机制。
绘制代码
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->voidCCY457OpenGLView::RenderScene()
{//绘制函数
//DrawSun
glTranslatef(0.0f,0.0f,-5.0f);
glRotatef(6,1.0f,0.0f,0.0f);
glutWireSphere(1.0f,20,20);
//DrawPlanet
glPushMatrix();
glTranslatef(-1.2f,-0.5f,-2.0f);
glRotatef(6,1.0f,0.0f,0.0f);
glutWireSphere(0.5f,20,20);
//DrawMoon
glPushMatrix();
glTranslatef(-1.2f,-0.5f,-2.0f);
glRotatef(6,1.0f,0.0f,0.0f);
glutWireSphere(0.05f,20,20);
glPopMatrix();
glPopMatrix();
}
分享到:
相关推荐
python库,解压后可用。 资源全名:transformations-2019.1.1-cp27-cp27m-win_amd64.whl
资源来自pypi官网。 资源全名:transformations-2019.1.1-cp27-cp27m-win_amd64.whl
资源来自pypi官网。 资源全名:sweden_crs_transformations-1.0.0.tar.gz
opengl qt
Linear-Transformations-and-Vector-stuff:pygame的小型向量库,以及其他内容
Familiarity with OpenGL programming, along with the typical 3D coordinate systems, projections, and transformations is assumed. It can also be useful for experienced GLSL programmers who are looking ...
OpenGL SuperBible: Comprehensive Tutorial and Reference 5th Edition 1008 pages Publisher: Addison-Wesley Professional; 5 edition (August 2, 2010) Language: English ISBN-10: 0321712617 ISBN-13: ...
Graph Transformations and Model-Driven Engineering -- Essays Dedicated to Manfred Nagl on the Occasion of his 65th Birthday Lecture Notes in Computer Science 5765
详解OpenGL的坐标系、投影和几何变换
glide-transformations glide-transformations glide-transformations
OpenGL的坐标系、投影和几何变换,很好的说明资料,大家参考。
黑白棋java源码使用 Map-Reduce 进行字数统计 - 实验室 介绍 现在我们已经看到了 spark 中的 key ...操作符,也知道什么时候使用转换操作符和 ...操作符,我们可以重新讨论我们在本节前面介绍的字数问题。...
黑白棋java源码使用 Map-Reduce 进行字数统计 - 实验室 介绍 现在我们已经看到了 spark 中的 key ...操作符,也知道什么时候使用转换操作符和 ...操作符,我们可以重新讨论我们在本节前面介绍的字数问题。...
Part V - Developing Servlets and JavaServer Pages Chapter 22 - HTTP Servlets Chapter 23 - Servlet Sessions Chapter 24 - WebSphere-Specific Servlet Issues Chapter 25 - JSP Elements Chapter ...
OpenGL ES Tutorial for Android – Part III – Transformations OpenGL ES Tutorial for Android – Part IV – Adding colors OpenGL ES Tutorial for Android – Part V – More on Meshes OpenGL ES Tutorial ...
Readers will find up-to-date, hands-on guidance on all facets of modern OpenGL development, including transformations, texture mapping, shaders, advanced buffers, geometry management, and much more....
1 Introduction to 3D Graphics and OpenGL 2 Using OpenGL 3 Drawing in Space: Geometric Primitives and Buffers 4 Geometric Transformations: The Pipeline 5 Color, Materials, and Lighting: The Basics 6 ...
Glide for eclipse demo
This book supplies a comprehensive overview of specific types of phase ...and exercises drawn from current applications ">This book supplies a comprehensive overview of specific types of phase ...
provides clear explanations of OpenGL functionality and techniques, including processing geometric objects with vertex, tessellation, and geometry shaders using geometric transformations and viewing ...