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可编程渲染管线的流程 顶点着色 --> 细分着色 --> 几何着色 --> 片元着色 --> 计算着色 一般我们主要参与的阶段是顶点着色和片元着色 ...
随机推荐
- javaweb中为mysql的curd多个值的语句
更新语句 String sql = "update student set num=?,name=?,birthday=?,score=?,password=? where id=?&quo ...
- mxnet安装及NDArray初体验
一.mxnet安装 (以下均为mac环境) 有二种方式: 1.1 用conda安装 #创建gluon目录 mkdir gluon-tutorials && cd gluon-tutor ...
- 在Windows环境下使用docker
Widows下的Docker工具有两个:Docker Toolbox,和Docker Desktop,其中后者是在win10下才能使用的,提供了更强大的功能.由于我个人的电脑是win7环境,用的就是d ...
- FMDB使用简介
转:http://my.oschina.net/youzaiyouzaie/blog/92325 源码地址:https://github.com/ccgus/fmdb 这次要分享的是在iOS中使用SQ ...
- 百度Apollo无人驾驶入门课程下载
本文提供 百度Apollo官网的无人驾驶入门课程下载,主要为视频文件. 视频数量:101个:文件格式:MP4:视频总时长:2小时40分钟:文件总大小:约1.13GB: 马上下载 关注公众号罗孚传说(R ...
- GraphQL入门3(Mutation)
创建一个新的支持Mutation的Schema. var GraphQLSchema = require('graphql').GraphQLSchema; var GraphQLObjectType ...
- Duplicate复制数据库并创建物理StandBy(pfile版本)
1设定环境如下: Primary数据库 IP 172.17.22.16 SID orcl Standby数据库 IP 172.17.22.17 SID orcl 设置提示,以区分操作的位置 prima ...
- 一道笔试题:给定编码规则,实现decode()方法
public class CodeDecode { /*变换函数encode()顺序考察已知字符串的字符,按以下规则逐组生成新字符串: (1)若已知字符串的当前字符不是大于0的数字 ...
- Android开发中adb启动失败adb连接异常的解决办法
一.情况描述: 我们在使用eclipse开发有时候会出现adb连接异常中,有时候控制台会打印出来 adb connect异常 比如会出现下面这样 : [2014-12-18 16:18:26 ...
- Ubuntu 下搭建 Android 开发环境(图文)
转自 http://dawndiy.com/archives/153/ 1.安装JDK 1.下载JDK 目前最新的JDK版本是:Java SE Development Kit 7u5 下载地址: 查看 ...