Location:
Search - opengl_qt
Search list
Description: windows下的qt的opengl库的入门编程例子,是一个立方体,可以通过鼠标旋转,放大缩小操作。-under windows the qt library entry programming opengl example, is a cube, the mouse can rotate, zoom operation.
Platform: |
Size: 61440 |
Author: 李焕 |
Hits:
Description: 在这一节中主要简单介绍下怎样给平面几何着色,以及怎样让绘制出来的几何图形旋转起来。在上一节OpenGL_Qt学习笔记之_02(绘制简单平面几何图形) 中已经介绍了如何利用opengl画一些简单的图像,那么这一节就在上面的基础上给它着色,且让他旋转。-The main brief in this section under how to plane geometry shader, and how to draw out geometry rotation. A OpenGL_Qt study notes _02 (draw a simple plane geometry) describes how to use opengl draw some simple image, then this section to it on the basis of the above, coloring, and let his rotation.
Platform: |
Size: 301056 |
Author: wuwei |
Hits:
Description: 四棱锥由5个面构成一个封闭的立体图,其中4个共顶点的侧面是三角形,底面是个四边形。如果我们要绘制一个3D的四棱锥只需要绘制这5个面即可,绘制的方法和前一篇文章OpenGL_Qt学习笔记之_03(平面图形的着色和旋转)的相同。只不过这里的顶点坐标是3维的,所以图像深度那一维不一定为0。因此我们可以事先计算好四棱锥各个顶点的坐标,这对学过立体几何的人来说应该是小case了。然后绘制每个面就可以。
注意,在opengl中绘制每个面时,所有面给出的顶点的顺序都要按照逆时针或者顺时针(我这里采用的是逆时针),这样才能保证所绘制出来的图像时正确的。
现在我们在paintGL中开始绘制四棱锥,如果按照NeHe的教程,它只是绘制了个金字塔,并没有底面,只有4个侧面,这里,我采用它的方法,代码如下: -A closed perspective view of four-sided pyramid is constituted by 5 surface, wherein the side of vertex 4 is triangular, the bottom surface is a quadrangle. If we want to draw a 3D pyramid only need to draw the five faces can, the drawn and former article OpenGL_Qt study notes _03 (planar graph coloring and rotation). But here vertex coordinates of a three-dimensional, so the image depth that dimension is not necessarily 0. So we can be calculated in advance the good four-sided pyramid coordinates of each vertex should learn solid geometry, is a small case. Then you can draw each face. Opengl in draw each surface, all surface given vertex order must be in accordance with the counterclockwise or clockwise (I used counterclockwise), so as to ensure the drawn image. Now we start drawing in paintGL four pyramid NeHe tutorial, it just draws a pyramid and the bottom surface of only four sides, here, I adopt its methods, the code is as follows:
Platform: |
Size: 309248 |
Author: wuwei |
Hits:
Description: 纹理映射简单的讲,就是把一个纹理(其实说白了,纹理可以理解为一幅图像)映射到空间物体的表面上,因此纹理映射也叫贴图,这个表明不一定是矩形,比如说我可以是球面,或者是任意曲面。在上一篇文章OpenGL_Qt学习笔记之_04(3D图形的绘制和旋转)中,我们绘制的空间体的表面都是一些光滑的颜色,如果要在其表面采用那种方法绘制图像的话,则必须利用微分的思想,一个一个的绘制小图像,然后拼接起来,可想而知,这个过程是多么的复杂,opengl的纹理映射就可以很好的解决这一问题。
这个实验室在上一篇博文OpenGL_Qt学习笔记之_04(3D图形的绘制和旋转) 绘制的立方体上贴每个面上贴上一张纹理(即图片)。-Simple texture mapping, a texture (in fact, white, and texture can be understood as an image) is mapped to the surface of the space objects, texture mapping, also known as maps, this show that is not necessarily a rectangle, for example, I can spherical, or any surface. In the previous article OpenGL_Qt study notes _04 (3D graphics rendering and rotation), the space we draw the body surface are smooth color, if you want to kind of method to draw the image on its surface, you must the idea of using the differential, a draw small image, then stitching together, we can imagine how complex this process is opengl texture mapping can be a good solution to this problem. This laboratory cube drawn on the blog post OpenGL_Qt study notes _04 (3D graphics rendering and rotation) posted each the surface paste a texture (picture).
Platform: |
Size: 391168 |
Author: wuwei |
Hits: