Azure Product
浏览模式: 普通 | 列表
分类: OpenGL | < | 1 | 2 | 3 | 4 | 5 | >

绘制线框圆环

[ 2007-01-17 12:24:31 | 作者: Admin ]
uploads/200701/17_152357_wiretorus.jpg

/*
 *
 */
void renderWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
 double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
 double *vertex, *normal;
 int i, j;
 double spsi, cpsi, sphi, cphi ;

 /*
 * Allocate the vertices array
 */
 vertex = (double *)calloc(
...

阅读全文...

绘制线框圆柱体

[ 2007-01-17 12:21:23 | 作者: Admin ]
uploads/200701/17_152230_wirecylinder.jpg


需要使用到前面的SIN,COS查表函数。
/*
 * Draws a wire cylinder
 */
void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
{
 int i,j;

 /* Step in z and radius as stacks are drawn. */

 double z = 0.0;
 const double zStep = height/stacks;

 /* Pre-computed circle */

 double *sint,*cost;
...

阅读全文...

绘制实心的圆柱体

[ 2007-01-17 11:36:34 | 作者: Admin ]
uploads/200701/17_152104_solidcylinder.jpg


需要使用到前面的SIN,COS查表函数
/*
 * Draws a solid cylinder
 */
void renderSolidCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
{
 int i,j;

 /* Step in z and radius as stacks are drawn. */

 double z0,z1;
 const double zStep = height/stacks;

 /* Pre-computed circle */

 double *sint,*cost;
...

阅读全文...

绘制线框圆锥体

[ 2007-01-17 11:32:04 | 作者: Admin ]
uploads/200701/17_152012_wirecone.jpg


需要使用前面的SIN,COS表查询函数。
/*
 * Draws a wire cone
 */
void renderWireCone( GLdouble base, GLdouble height, GLint slices, GLint stacks)
{
 int i,j;

 /* Step in z and radius as stacks are drawn. */

 double z = 0.0;
 double r = base;

 const double zStep = height/stacks;
 const double rStep = base/stacks;

 /* Scaling factors for vertex normals */
...

阅读全文...

绘制实心圆锥体

[ 2007-01-17 10:34:19 | 作者: Admin ]
uploads/200701/17_151708_solidcone.jpg


使用到前面的,SIN,COS查询表函数。
这里就不写了
/*
 * Draws a solid cone
 */
void renderSolidCone( GLdouble base, GLdouble height, GLint slices, GLint stacks )
{
 int i,j;

 /* Step in z and radius as stacks are drawn. */

 double z0,z1;
 double r0,r1;

 const double zStep = height/stacks;
 const double rStep = base/stacks;
...

阅读全文...

绘制线框球体

[ 2007-01-17 10:29:35 | 作者: Admin ]
uploads/200701/17_151621_wiresphere.jpg


首先建立SIN,COS查询表,这样算的快。
/*
 * Compute lookup table of cos and sin values forming a cirle
 *
 * Notes:
 * It is the responsibility of the caller to free these tables
 * The size of the table is (n+1) to form a connected loop
 * The last entry is exactly the same as the first
 * The sign of n can be flipped to get the reverse loop
...

阅读全文...

绘制实心球体

[ 2007-01-17 10:24:16 | 作者: Admin ]
uploads/200701/17_151513_solidsphere.jpg


首先建立SIN,COS查询表,这样算得快
/*
 * Compute lookup table of cos and sin values forming a cirle
 *
 * Notes:
 * It is the responsibility of the caller to free these tables
 * The size of the table is (n+1) to form a connected loop
 * The last entry is exactly the same as the first
 * The sign of n can be flipped to get the reverse loop
...

阅读全文...

绘制实心立方体

[ 2007-01-17 10:23:04 | 作者: Admin ]
uploads/200701/17_151358_solidcube.jpg

/*
 * Draws a solid cube. Code contributed by Andreas Umbach <marvin@dataway.ch>
 */
void renderSolidCube( GLdouble dSize )
{
 double size = dSize * 0.5;

# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );

 /*
 * PWO: Again, I dared to convert the code to use macros...
...

阅读全文...

绘制线框立方体

[ 2007-01-17 10:18:48 | 作者: Admin ]
uploads/200701/17_151307_wirecube.jpg

/*
 * Draws a wireframed cube. Code contributed by Andreas Umbach <marvin@dataway.ch>
 */
void renderWireCube( GLdouble dSize )
{
 double size = dSize * 0.5;

# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );

 /*
 * PWO: I dared to convert the code to use macros...
...

阅读全文...

推荐日志 OpenGL版本与OpenGL扩展机制

[ 2006-01-26 22:51:49 | 作者: Admin ]
OpenGL版本比较

1 opengl的版本区别(在opengl官方文档中有详细说明)
针对Opengl不同版本的升级是主要是扩展指令集。

1.1 opengl1.1

1995年,SGI推出了更为完善的OpenGL 1.1版本。OpenGL 1.1的性能比1.0版提高甚多。其中包括改进打印机支持,在增强元文件中包含OpenGL的调用,顶点数组的新特性,提高顶点位置、法线、颜色、色彩指数、纹理坐标、多边形边缘标识的传输速度,引入了新的纹理特性等等。

1.2 opengl1.3

2001年8月,ARB发布OpenGL 1.3规范,它增加了立方纹理贴图、纹理环境、多重采样、纹理框架压缩等扩展指令,但是改进程度非常有限。

1.3 opengl1.4

2002年7月,ARB正式发布OpenGL 1.4,它也只加入了深度纹理/阴影纹理、顶点设计框架、自动纹理贴图等简单的功能。
...

阅读全文...
ħ˽ ħ˽ : ϲ ϲվ ϲʿ ϲʿ ϲʿ ϲվ ϲ ϲվ ϲ ϲ ͸۾ ˽ ѾѾַ document.write("");