当前位置: 首页>>代码示例>>C++>>正文


C++ ofFbo::bind方法代码示例

本文整理汇总了C++中ofFbo::bind方法的典型用法代码示例。如果您正苦于以下问题:C++ ofFbo::bind方法的具体用法?C++ ofFbo::bind怎么用?C++ ofFbo::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ofFbo的用法示例。


在下文中一共展示了ofFbo::bind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateTexture

	void updateTexture(ofFbo & videoFrame){
		if(!fbo.isAllocated()){
			fbo.allocate(videoFrame.getWidth(),videoFrame.getHeight(),videoFrame.getTextureReference().texData.glInternalFormat);
		}
		videoFrame.bind();
		glReadBuffer(GL_COLOR_ATTACHMENT0);
		glBindTexture(fbo.getTextureReference().texData.textureTarget, (GLuint)fbo.getTextureReference().texData.textureID);
		glCopyTexImage2D(fbo.getTextureReference().texData.textureTarget,0,fbo.getTextureReference().texData.glInternalFormat,0,0,fbo.getWidth(),fbo.getHeight(),0);
		videoFrame.unbind();
		glReadBuffer(GL_BACK);
	}
开发者ID:jurcello,项目名称:ofxPlaymodes,代码行数:11,代码来源:VideoFrame.cpp

示例2: draw

	//----------
	void Scene::draw(ofFbo & fbo) {
		fbo.bind();
		
		ofPushMatrix();
		//ofScale(1.0f, -1.0f);
		//ofTranslate(0.0f, -ofGetHeight());
		
		this->draw();
		ofPopMatrix();
		
		fbo.unbind();
	}
开发者ID:elliotwoods,项目名称:ofxGrabScene,代码行数:13,代码来源:Scene.cpp

示例3: readToFloatPixels

bool ofxFastFboReader::readToFloatPixels(ofFbo &fbo, ofFloatPixelsRef pix, ofImageType type)
{
	genPBOs();
	
	int channels;
	int glType;
	
	if (type == OF_IMAGE_COLOR)
	{
		channels = 3;
		glType = GL_RGB;
	}
	else if (type == OF_IMAGE_COLOR_ALPHA)
	{
		channels = 4;
		glType = GL_RGBA;
	}
	else if (type == OF_IMAGE_GRAYSCALE)
	{
		channels = 1;
		glType = GL_LUMINANCE;
	}
	else
	{
		return false;
	}
	
	const int width = fbo.getWidth();
	const int height = fbo.getHeight();
	
	if (async)
	{
		index = (index + 1) % num_buffers;
		nextIndex = (index + 1) % num_buffers;
	}
	else
	{
		index = nextIndex = 0;
	}
	
	size_t nb = width * height * channels * sizeof(float); // LS: don't just deal with 8-bit color channels..
	
	if (nb != num_bytes)
	{
		num_bytes = nb;
		setupPBOs(num_bytes);
	}
	
	glReadBuffer(GL_FRONT);
	
	fbo.bind();
	
	glBindBuffer(GL_PIXEL_PACK_BUFFER, pboIds[index]);
	glReadPixels(0, 0, width, height, glType, GL_FLOAT, NULL);
	
	glBindBuffer(GL_PIXEL_PACK_BUFFER, pboIds[nextIndex]);
	float* mem = (float*)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
	
	if (mem)
	{
		pix.setFromPixels(mem, width, height, channels);
		//pix.setFromAlignedPixels(mem, width, height, channels, width*channels); // stride = nr of elements (float, char, etc) in a row, including padding for alignment. we assume no padding..
		glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
	}
	
	glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
	
	fbo.unbind();
	
	return mem != NULL;
}
开发者ID:galsasson,项目名称:ofxFastFboReader,代码行数:71,代码来源:ofxFastFboReader.cpp

示例4: readToPixels

bool ofxFastFboReader::readToPixels(ofFbo &fbo, ofPixelsRef pix, ofImageType type)
{
	genPBOs();
	
	int channels;
	int glType;
	
	if (type == OF_IMAGE_COLOR)
	{
		channels = 3;
		glType = GL_RGB;
	}
	else if (type == OF_IMAGE_COLOR_ALPHA)
	{
		channels = 4;
		glType = GL_RGBA;
	}
	else if (type == OF_IMAGE_GRAYSCALE)
	{
		channels = 1;
		glType = GL_LUMINANCE;
	}
	else
	{
		return false;
	}
	
	const int width = fbo.getWidth();
	const int height = fbo.getHeight();
	
	if (async)
	{
		index = (index + 1) % num_buffers;
		nextIndex = (index + 1) % num_buffers;
	}
	else
	{
		index = nextIndex = 0;
	}
	
	size_t nb = width * height * channels;
	
	if (nb != num_bytes)
	{
		num_bytes = nb;
		setupPBOs(num_bytes);
	}
	
	glReadBuffer(GL_FRONT);
	
	fbo.bind();
	
	glBindBuffer(GL_PIXEL_PACK_BUFFER, pboIds[index]);
	glReadPixels(0, 0, width, height, glType, GL_UNSIGNED_BYTE, NULL);
	
	glBindBuffer(GL_PIXEL_PACK_BUFFER, pboIds[nextIndex]);
	unsigned char* mem = (unsigned char*)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
	
	if (mem)
	{
		pix.setFromPixels(mem, width, height, channels);
		glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
	}
	
	glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
	
	fbo.unbind();
	
	return mem != NULL;
}
开发者ID:galsasson,项目名称:ofxFastFboReader,代码行数:70,代码来源:ofxFastFboReader.cpp


注:本文中的ofFbo::bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。