资源简介
opengl进行配置的必备,包含了gltools的头文件和库。
代码片段和文件信息
// Block.cpp
// OpenGL SuperBible Chapter 1
// Demonstrates an assortment of basic 3D concepts
// Program by Richard S. Wright Jr.
#include “../../shared/gltools.h“ // OpenGL toolkit
#include “../../shared/math3d.h“
#include
#include
// 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 materialColor[] = { 0.8f 0.0f 0.0f };
GLfloat vLightPos[] = { -80.0f 120.0f 100.0f 0.0f };
GLfloat ground[3][3] = { { 0.0f -25.0f 0.0f }
{ 10.0f -25.0f 0.0f }
{ 10.0f -25.0f -10.0f } };
GLuint textures[4];
// Called to draw scene
void RenderScene(void)
{
M3DMatrix44f mCubeTransform;
M3DVector4f pPlane;
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glShadeModel(GL_SMOOTH);
glEnable(GL_NORMALIZE);
glPushMatrix();
// Draw plane that the cube rests on
glDisable(GL_LIGHTING);
if(nStep == 5)
{
glColor3ub(255255255);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D textures[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f 0.0f);
glVertex3f(-100.0f -25.3f -100.0f);
glTexCoord2f(0.0f 1.0f);
glVertex3f(-100.0f -25.3f 100.0f);
glTexCoord2f(1.0f 1.0f);
glVertex3f(100.0f -25.3f 100.0f);
glTexCoord2f(1.0f 0.0f);
glVertex3f(100.0f -25.3f -100.0f);
glEnd();
}
else
{
glColor3f(0.0f 0.0f 0.90f); // Blue
glBegin(GL_QUADS);
glVertex3f(-100.0f -25.3f -100.0f);
glVertex3f(-100.0f -25.3f 100.0f);
glVertex3f(100.0f -25.3f 100.0f);
glVertex3f(100.0f -25.3f -100.0f);
glEnd();
}
// Set drawing color to Red
glColor3f(1.0f 0.0f 0.0f);
// Enable disable lighting
if(nStep > 2)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_COLOR_MATERIAL);
glLightfv(GL_LIGHT0 GL_AMBIENT lightAmbient);
glLightfv(GL_LIGHT0 GL_DIFFUSE lightDiffuse);
glLightfv(GL_LIGHT0 GL_SPECULAR lightSpecular);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glMaterialfv(GL_FRONT GL_SPECULARlightSpecular);
glMaterialfv(GL_FRONT GL_AMBIENT_AND_DIFFUSE materialColor);
glMateriali(GL_FRONT GL_SHININESS128);
}
// Move the cube slightly forward and to the left
glTranslatef(-10.0f 0.0f 10.0f);
switch(nStep)
{
// Just draw the wire framed cube
case 0:
glutWireCube(50.0f);
break;
// Same wire cube with hidden line removal simulated
case 1:
// Front Face (before rotation)
glBegin(GL_LINES);
glVertex3f(25.0f25.0f25.0f);
glVertex3f(25.0f-25.0f25.0f);
glVertex3f(25.0f-25.0f25.0f);
glVertex3f(-25.0f-25.0f25.0f);
glVertex3f(-25.0f-25.0f25.0f);
glVertex3f(-25.0f25.0f25.0f);
glVertex3f(-25.0f25.0f25.0f);
glVertex3f(25.0f25.0f25.0f);
glEnd();
// Top of cube
glBegin(GL_LINES);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 255 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\simple.vs
文件 468 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\specular.vs
文件 503 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\3lights.vs
文件 713 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\specular.fs
文件 904 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\3lights.fs
文件 127 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\simple.fs
文件 274 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\diffuse.fs
文件 466 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\shaders\diffuse.vs
文件 905 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\lighting.sln
文件 3872 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\lighting\lighting.vcproj
文件 177 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\passthrough.fs
文件 558 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\sharpen.fs
文件 560 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\blur.fs
文件 417 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\erosion.fs
文件 418 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\dilation.fs
文件 841 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\sobel.fs
文件 566 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\laplacian.fs
文件 821 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\shaders\prewitt.fs
文件 3878 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\imageproc.vcproj
文件 907 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\imageproc\imageproc.sln
文件 2175 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\shaders\beachball.fs
文件 544 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\shaders\toyball.vs
文件 555 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\shaders\checkerboard.vs
文件 552 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\shaders\beachball.vs
文件 1273 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\shaders\checkerboard.fs
文件 2634 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\shaders\toyball.fs
文件 903 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\proctex.sln
文件 3866 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\proctex\proctex.vcproj
文件 495 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\fragmentshaders\shaders\fog.fs
文件 184 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\fragmentshaders\shaders\colorinvert.fs
文件 313 2007-04-24 02:33 SB-WinSrc\examples\projects\microsoft\chapt17\fragmentshaders\shaders\heatsig.fs
............此处省略636个文件信息
- 上一篇:实时计算机图形学中文
- 下一篇:STM32F4XX的FOC5.0工程,已经编译通过
评论
共有 条评论