• 大小: 4.84MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-29
  • 语言: 其他
  • 标签: OpenGL  

资源简介

该文件里面包括OpenGL蓝宝书第五版里面所需的所有库(均已经编译好)

资源截图

代码片段和文件信息

// Block.cpp
// OpenGL SuperBible Chapter 1
// Demonstrates an assortment of basic 3D concepts
// Program by Richard S. Wright Jr.

#include  // OpenGL toolkit
#include 
#include ame.h>
#include 
#include 
#include 

#include 
#ifdef __APPLE__
#include 
#else
#define FREEGLUT_STATIC
#include 
#endif

/////////////////////////////////////////////////////////////////////////////////
// An assortment of needed classes
GLShaderManager shaderManager;
GLMatrixStack modelViewMatrix;
GLMatrixStack projectionMatrix;
GLframe cameraframe;
GLFrustum viewFrustum;
GLBatch cubeBatch;
GLBatch floorBatch;
GLBatch topBlock;
GLBatch frontBlock;
GLBatch leftBlock;

GLGeometryTransform transformPipeline;
M3DMatrix44f shadowMatrix;


// Keep track of effects step
int nStep = 0;

// Lighting data
GLfloat lightAmbient[] = { 0.2f 0.2f 0.2f 1.0f };
GLfloat lightDiffuse[] = { 0.7f 0.7f 0.7f 1.0f };
GLfloat lightSpecular[] = { 0.9f 0.9f 0.9f };
GLfloat vLightPos[] = { -8.0f 20.0f 100.0f 1.0f };

GLuint textures[4];


///////////////////////////////////////////////////////////////////////////////
// Make a cube out of a batch of triangles. Texture coordinates and normals
// are also provided.
void MakeCube(GLBatch& cubeBatch)
{
cubeBatch.Begin(GL_TRIANGLES 36 1);

/////////////////////////////////////////////
// Top of cube
cubeBatch.Normal3f(0.0f 1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 1.0f 1.0f);
cubeBatch.Vertex3f(1.0f 1.0f 1.0f);

cubeBatch.Normal3f(0.0f 1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 1.0f 0.0f);
cubeBatch.Vertex3f(1.0f 1.0f -1.0f);

cubeBatch.Normal3f(0.0f 1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 0.0f 0.0f);
cubeBatch.Vertex3f(-1.0f 1.0f -1.0f);

cubeBatch.Normal3f(0.0f 1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 1.0f 1.0f);
cubeBatch.Vertex3f(1.0f 1.0f 1.0f);

cubeBatch.Normal3f(0.0f 1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 0.0f 0.0f);
cubeBatch.Vertex3f(-1.0f 1.0f -1.0f);

cubeBatch.Normal3f(0.0f 1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 0.0f 1.0f);
cubeBatch.Vertex3f(-1.0f 1.0f 1.0f);


////////////////////////////////////////////
// Bottom of cube
cubeBatch.Normal3f(0.0f -1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 0.0f 0.0f);
cubeBatch.Vertex3f(-1.0f -1.0f -1.0f);

cubeBatch.Normal3f(0.0f -1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 1.0f 0.0f);
cubeBatch.Vertex3f(1.0f -1.0f -1.0f);

cubeBatch.Normal3f(0.0f -1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 1.0f 1.0f);
cubeBatch.Vertex3f(1.0f -1.0f 1.0f);

cubeBatch.Normal3f(0.0f -1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 0.0f 1.0f);
cubeBatch.Vertex3f(-1.0f -1.0f 1.0f);

cubeBatch.Normal3f(0.0f -1.0f 0.0f);
cubeBatch.MultiTexCoord2f(0 0.0f 0.0f);
cubeBatch.Vertex3f(-1.0f -1.0f -1.0f

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

----------- ---------  ---------- -----  ----

             12965963                    1150


评论

共有 条评论