All pastes #813091 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-12 07:25 UTC
rendered paste body
///////////////////////////////// INIT

	// Setup the FBO
	glGenFramebuffersEXT(1, &m_fbo);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);

	// Create the render buffer for depth	
	glGenRenderbuffersEXT(1, &m_depthBuffer);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthBuffer);
	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, m_imgWidth, m_imgHeight);

	// Make the texture
	glGenTextures(1, &m_img);
	glBindTexture(GL_TEXTURE_2D, m_img);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

	// And attach it to the FBO
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_img, 0);

	// Attach the depth render buffer to the FBO
	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthBuffer);
	
	// Unbind the FBO
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);




////////////////////////////////// RITA


	// Bind FBO
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);

	glPushAttrib(GL_VIEWPORT_BIT);
	glViewport(0, 0, 512, 512);

	// Set destination
	glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();


        // Rita mina grejjer