OpenGL 实验二 纹理映射

OpenGL 实验二 纹理映射一、创建工程(同实验一)1.1 用VS2015创建exp_21.2 建立OpenGL开发环境:复制头文件,静态库文件,动态库文件1.3 配置VS,指定OpenGL头文件路径,连接OpenGL库文件1.4 为避免在连接glaux.lib时出现无法解析的外部符号_sscanf,配置属性->链接器->输入->附加依赖项中添加依赖项legacy_...
摘要由CSDN通过智能技术生成

OpenGL 实验二 纹理映射

一、创建工程

(同实验一)

1.1 用VS2015创建exp_2

1.2 建立OpenGL开发环境:复制头文件,静态库文件,动态库文件

1.3 配置VS,指定OpenGL头文件路径,连接OpenGL库文件

1.4 为避免在连接glaux.lib时出现无法解析的外部符号_sscanf,配置属性->链接器->输入->附加依赖项中添加依赖项legacy_stdio_definitions.lib

二、创建资源文件

在exp_2目录下创建文件夹/Data,复制图片Create.bmp

在这里插入图片描述
(我截图后用画图软件保存为bmp文件)

三、源文件

// exp_2.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <windows.h>
#include <GL\GL.h>      //Header File For The OpenGL32 Library
#include <GL\GLU.h>     //Header File For The GLu32 Library	
#include <GL\GLAUX.H>   //Header File For the Glaux Library
#define GLUT_DISABLE_ATEXIT_HACK
#include "GL\GLUT.H"

#pragma warning (disable:4996);
GLfloat rtri;
GLfloat rquad;

GLfloat LightAmbient[] = { 0.5f,0.5f,0.5f,1.0f };  //外界环绕
GLfloat LightDiffuse[] = { 1.0f,1.0f,1.0f,1.0f };
GLfloat LightPosition[] = { 0.0f,0.0f,2.0f,1.0f };

GLuint filter;      //Which Filter to Use
GLuint texture[3];  //Storage For 3 Textures

int InitGL(int width, int height);
void DrawGLScene(void);
void myReshape(int w, int h);
void myKeyboard(int key, int x, int y);
void myMovedMouse(int x, int y);
AUX_RGBImageRec *LoadBMP(char *Filename);
int LoadGLTextures();

int main(int argc,char **argv)
{
	glutInit(&argc, argv); //Initialize GLUT function callings

	glutInitWindowSize(800, 600);//Set window size(width,height) in number of pixels

	//Set window position, from the left and top of the screen, in numbers of pixels
	glutInitWindowPosition(200, 100);

	//Specify a window creation event
	glutCreateWindow("3D Graph");

	//Specify the drawing function that is called when the window is created or redrew
	glutDisplayFunc(DrawGLScene);
	glutReshapeFunc(myReshape);
	glutSpecialFunc(myKeyboard);
	glutMotionFunc(myMovedMouse);

	InitGL(800, 600);   //Invoke this function for initialization

	glutMainLoop();     //Enter the event processing loop

	return 0;           //Indicate normal te
  • 2
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值