博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cubeMap转为BMP图片
阅读量:4123 次
发布时间:2019-05-25

本文共 1245 字,大约阅读时间需要 4 分钟。

 

void readCubeMapToHost_forTest(unsigned int cubeMapTexture, int width, int height, GLubyte *dataMap){	GLuint CarrierFBo;	glGenFramebuffers(1, &CarrierFBo);	glBindFramebuffer(GL_FRAMEBUFFER, CarrierFBo);	//cout << "here 1" << endl;	glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapTexture);	for (int i = 0; i < 6; i++)	{		//cout << "here 2" << endl;		//貌似是必须的,不然只能读取POSITIVE_X		glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, cubeMapTexture, 0);		//cout << "here 3" << endl;		glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &dataMap[i*width*height]);	}	//cout << "here 4" << endl;	glBindTexture(GL_TEXTURE_2D, 0);	glBindFramebuffer(GL_FRAMEBUFFER, 0);}int bmp_write_forTest(unsigned char *image, int xsize, int ysize, char *filename){#define BMP_Header_Length 54	FILE*    pDummyFile;	FILE*    pWritingFile;	GLubyte* pPixelData;	GLubyte  BMP_Header[BMP_Header_Length];	GLint    i, j;	GLint    PixelDataLength;	i = xsize * 3;	while (i % 4 != 0)		++i;	PixelDataLength = i * ysize;	unsigned char * grayimage = (unsigned char *)malloc(sizeof(unsigned char)*xsize*ysize * 3);	/*unsigned char f2c = (unsigned char)0.5f;*/	for (int i = 0; i
cubeMapTexture);}

  

转载地址:http://hjopi.baihongyu.com/

你可能感兴趣的文章
「译」在 python 中,如果 x 是 list,为什么 x += "ha" 可以运行,而 x = x + "ha" 却抛出异常呢?...
查看>>
浅谈JavaScript的语言特性
查看>>
LeetCode第39题思悟——组合总和(combination-sum)
查看>>
LeetCode第43题思悟——字符串相乘(multiply-strings)
查看>>
LeetCode第44题思悟——通配符匹配(wildcard-matching)
查看>>
LeetCode第45题思悟——跳跃游戏(jump-game-ii)
查看>>
LeetCode第46题思悟——全排列(permutations)
查看>>
LeetCode第47题思悟—— 全排列 II(permutations-ii)
查看>>
LeetCode第48题思悟——旋转图像(rotate-image)
查看>>
驱动力3.0,动力全开~
查看>>
记CSDN访问量10万+
查看>>
Linux下Oracle数据库账户被锁:the account is locked问题的解决
查看>>
记CSDN访问20万+
查看>>
Windows 环境下Webstorm 2020.3 版本在右下角找不到Git分支切换部件的一种解决方法
查看>>
Electron-Vue项目中遇到fs.rm is not a function问题的解决过程
查看>>
飞机换乘次数最少问题的两种解决方案
查看>>
有向无回路图的理解
查看>>
设计模式中英文汇总分类
查看>>
WPF实现蜘蛛纸牌游戏
查看>>
单例模式
查看>>