OpenGL 太阳系行星拾取例子(GL_SELECT) VS2008 + glut实现
太阳系:Solar System
以太阳(Sun)为中心,由内到外分别是:
水星(Mercury)
金星(Venus)
地球(Earth)
火星(Mars)
木星(Jupiter)
土星(Saturn)
天王星(Uranus)
海王星(Neptune)
冥王星(Pluto)
原来是太阳系九大行星,但是最后一个冥王星被除名,就变成八大行星了~

|
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
//#include <windows.h>
#include <afx.h> #include <gl/gl.h> #include <gl/glu.h> #include <gl/glut.h> #include <math.h> #pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"") #define glRGB(x, y, z) glColor3ub((GLubyte)x, (GLubyte)y, (GLubyte)z) // 太阳 GLfloat fAspect; // Called to draw scene // Save the matrix state and do the rotations // Translate the whole scene out and into view // Initialize the names stack // Set material color, Yellow // Draw Mercury // Draw Venus // Draw the Earth // Draw Mars // Draw Jupiter // Draw Saturn // Draw Uranus // Draw Neptune // Draw Pluto // Restore the matrix state void Display(void) // Present the information on which planet/sun was selected and displayed case MERCURY: case VENUS: case EARTH: case MARS: case JUPITER: case SATURN: case URANUS: case NEPTUNE: case PLUTO: default: // Process the selection, which is triggered by a right mouse void ProcessSelection(int xPos, int yPos) // Hit counter and viewport storeage // Setup selection buffer // Get the viewport // Switch to projection and save the matrix // Change render mode // Establish new clipping volume to be unit cube around // Apply perspective matrix // Draw the scene // Collect the hits // If a single hit occured, display the info. ; i < hits ; i++) // Restore the projection matrix // Go back to modelview for normal rendering void init(void) // Process the mouse click void ChangeSize(int w, int h) // Set Viewport to window dimensions // Calculate aspect ratio of the window // Set the perspective coordinate system // Field of view of 45 degrees, near and far planes 1.0 and 425 // Modelview matrix reset int main(int argc, char *argv[]) glutMainLoop(); ; |

OpenGL 太阳系行星拾取例子(GL_SELECT) VS2008 + glut实现的更多相关文章
- Modern OpenGL用Shader拾取VBO内单一图元的思路和实现
Modern OpenGL用Shader拾取VBO内单一图元的思路和实现 什么意思? 拾取 最简单的理解拾取的方式大概是到(http://www.yakergong.net/nehe/course/t ...
- Modern OpenGL用Shader拾取VBO内单一图元的思路和实现(3)
Modern OpenGL用Shader拾取VBO内单一图元的思路和实现(3) 到上一篇为止,拾取一个VBO里的单个图元的问题已经彻底解决了.那么来看下一个问题:一个场景里可能会有多个VBO,此时每个 ...
- 使用css3的动画模拟太阳系行星公转
本文介绍使用css3的animation画一个太阳系行星公转的动画,再加以改进,讨论如何画椭圆的运行轨迹.然后分析京东和人人网使用animation的实际案例,最后结合css3的clip-path做一 ...
- OpenGL中的拾取模式( Picking)
1. Opengl中的渲染模式有三种:(1)渲染模式,默认的模式:(2)选择模式, (3)反馈模式.如下 GLint glRenderMode(GLenum mode) mode可以选取以下三种模式之 ...
- html+ccs3太阳系行星运转动画之土星有个环,地球有颗小卫星
在上一篇<html+ccs3太阳系行星运转动画>中实现了太阳系八大行星的基本运转动画. 太阳系又何止这些内容,为丰富一下动画,接下来增加“土星环”和“月球”来充盈太阳系动画. 下面是充盈后 ...
- Modern OpenGL用Shader拾取VBO内单一图元的思路和实现(2)
Modern OpenGL用Shader拾取VBO内单一图元的思路和实现(2) 上一篇里介绍了Color-Coded Picking的思路和最基本的实现.在处理GL_POINTS时已经没有问题,但是处 ...
- three.js模拟实现太阳系行星体系
概况如下: 1.SphereGeometry实现自转的太阳: 2.RingGeometry实现太阳系星系的公转轨道: 3.ImageUtils加载球体和各行星贴图: 4.canvas中createRa ...
- html+ccs3太阳系行星运转动画
做一个太阳系八大行星的运转动画,不包括行星的卫星,所有行星围绕太阳公转,行星采用纯色,暂时没有自转. 效果静态图: 动画中包括:太阳及各行星,运行轨道,行星公转动画. 先画好草图,设计好大小和位置,根 ...
- OpenGL红宝书例子2.2 uniform变量的使用
1. 简单介绍一下OpenGL可编程渲染管线的流程 顶点着色 --> 细分着色 --> 几何着色 --> 片元着色 --> 计算着色 一般我们主要参与的阶段是顶点着色和片元着色 ...
随机推荐
- mongodb.mongoose维护内嵌数组元素
运行环境: - Nodejs - MongoDB 文档实例名: ProjectJob 文档格式如下: { "_id" : ObjectId("5bc69eb0b298b3 ...
- cordova性能优化方法
做了几个cordova的项目,觉得webapp性能的确是比不上原生,在IOS上还好,安卓上特别的明显.技术群里面很多人都在说cordova是个渣,没用之类的.其实只是很多人没有深入去了解,做点小优化, ...
- Python 文件夹及文件操作
import os import os.path from shutil import copy def copyfile(src, dst): count = 1 for filename in o ...
- 七周七语言之Ruby
1.安装 Ubuntu 14.04 sudo apt-get install ruby version 1.9.1 2.命令行运行: irb 3.文挡查看:man RDoc 4.猜数字 2.2.7程序 ...
- 学习Spring-Session+Redis实现session共享
1.添加依赖 <dependency> <groupId>org.springframework.session</groupId> <artifactId& ...
- java 获取系统当前时间并格式化
java 获取系统当前时间并格式化 CreateTime--2018年5月9日11:41:00 Author:Marydon 实现方式有三种 updateTime--2018年7月23日09点32 ...
- (原)Show, Attend and Translate: Unsupervised Image Translation with Self-Regularization and Attention
转载请注明出处: https://www.cnblogs.com/darkknightzh/p/9333844.html 论文网址:https://arxiv.org/abs/1806.06195 在 ...
- Springmvc 整合 jetbrick 实例
应用环境: <jetbrick.version>1.2.8</jetbrick.version> <antlr4-runtime.version>4.2.2< ...
- 茗洋Easy UI 1.3.5 部分问题解决系列专题[自定义alert关闭时间,自动关]
[评论,楼层数为30的倍数的,我送你我自己的博客园的皮肤,该博客参与活动] 这次我又给大家带来的EasyUI的我研究拓展的新特性 我使用的是 EasyUI 1.3.5版本的,项目是ASP.NET M ...
- Linux说明书 - man浅谈
原文链接: http://www.cnblogs.com/xuxn/archive/2011/08/26/linux-manual-man-command.html 所有学过Linux的同学都应该知道 ...