上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: 本文在第9篇文章的基础上,为立方体加入纹理映射的功能。Texture MappingTexture Mapping in OpenGL is a fairly straightforward concept. Every texture is nothing but an image of some sort. Texture mapping is basically applying a texture to a surface. Textures can be 1D, 2D or even 3D. A 1D texture is an image with either a width o 阅读全文
posted @ 2010-11-23 03:25 lcxu2 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Blending and TransparencyBlending in OpenGL provides pixel-level control of RGBA color storage in the color buffer. To enable blending we must first call glEnable(GL_BLEND). We have to set up the blending function glBlendFunc with two arguments: the source and the destination colors. By default thes 阅读全文
posted @ 2010-11-23 03:25 lcxu2 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 本文中将对第5篇文章的太阳系模型进行修改,加入一些动画效果。此外还会加入显示帧速率的代码。加入动画效果最容易的方法是响应WM_TIMER消息,在其消息处理函数中改变一些参数值,比如每过多少毫秒就旋转一定的角度,并且重绘场景。Frame RateFrame rate is nothing but the number of frames that can be rendered per second. The higher this rate, the smoother the animation. In order to calculate the frame rate we retrieve 阅读全文
posted @ 2010-11-23 03:23 lcxu2 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Transformations - Translation, Rotation and ScalingTranslation 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 sys 阅读全文
posted @ 2010-11-23 03:22 lcxu2 阅读(337) 评论(0) 推荐(0) 编辑
摘要: 在上一篇的基础上加入对键盘和鼠标的事件处理程序,以便用其来控制3D物体的旋转和移动。1,首先在CCY457OpenGLView类中为WM_KEYDOWN, WM_LBUTTONDOWN, WM_LBUTTONUP 和 WM_MOUSEMOVE四个事件加入事件处理函数。2,在CCY457OpenGLView.h中加入下列用于控制旋转和移动的变量:并在构造函数中初始化: GLfloat m_xAngle; GLfloat m_yAngle; GLfloat m_xPos; GLfloat m_yPos; CPoint m_MouseDownPoint;CCY457OpenGLView::CCY45 阅读全文
posted @ 2010-11-23 03:22 lcxu2 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 5, 在OnCreate中我们将通过建立像素格式和绘制上下文来初始化OpenGL. 在InitializeOpenGL()中会创建一个设备上下文(DC),为这个DC选择一个像素格式,创建和这个DC相关的绘制上下文(RC),然后选择这个RC.这个函数会调用SetupPixelFormat()来建立像素格式。int CCY457OpenGLView::OnCreate(LPCREATESTRUCT lpCreateStruct) {if (CView::OnCreate(lpCreateStruct) == -1)return -1;//Initialize OpenGL Here Initial 阅读全文
posted @ 2010-11-23 03:21 lcxu2 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 剪裁区域In OpenGL when you create a window to draw in we must specify the coordinate system we want to use and how to map the specified coordinates into physical screen coordinates. We would be using the 2D Cartesian coordinate system with the origin 0,0 at the centre of the screen. Before we can start 阅读全文
posted @ 2010-11-23 03:21 lcxu2 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 视见体Viewing Volume is nothing but the region of 3D Cartesian space in that will occupy the window. It is nothing but the minimum and maximum x, y and z values that are inside the window. So if a vertex is outside this range of x, y and z values then they are clipped by OpenGL before rendering can occ 阅读全文
posted @ 2010-11-23 03:21 lcxu2 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 本文源代码下载:OpenGL_ch2.rar WGL – Windows的 OpenGL扩展层The WGL extension consists of a set of functions (wglCreateContext, wglDeleteContext etc.) and structures (such as PIXELFORMATDESCRIPTOR, GLYPHMETRICSFLOAT) etc. Thus every OpenGL implementation has a platform-specific portion which has to be set up and 阅读全文
posted @ 2010-11-23 03:20 lcxu2 阅读(296) 评论(0) 推荐(0) 编辑
摘要: using System; using System.IO; using System.Diagnostics; namespace Adjust { /// /// Matrix 的摘要说明。 /// 实现矩阵的基本运算 /// public class Matrix { //构造方阵 ... 阅读全文
posted @ 2010-11-16 01:07 lcxu2 阅读(12208) 评论(1) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页