/*
*
*/
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(
...*
*/
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(
阅读全文...
需要使用到前面的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;
...* 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;
阅读全文...
需要使用到前面的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;
...* 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;
阅读全文...
需要使用前面的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 */
...* 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 */
阅读全文...
使用到前面的,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;
...* 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;
阅读全文...
首先建立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
...* 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
阅读全文...
首先建立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
...* 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
阅读全文...
/*
* 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...
...* 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...
阅读全文...
/*
* 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...
...* 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,它也只加入了深度纹理/阴影纹理、顶点设计框架、自动纹理贴图等简单的功能。
...
阅读全文...
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,它也只加入了深度纹理/阴影纹理、顶点设计框架、自动纹理贴图等简单的功能。
...
阅读全文...



















