Hello,

I am trying to get omni-directional shadow mapping to work. However, I can't seem to be able to actually render anything to the cube map FBO. It always remains blank, unless I call glClear (I can change the colors).
I checked this both be rendering a cube map face to the screen and by using gDEBugger.
I am quite certain that the matrices are set up properly.

Here is the relevant code:

Code :
void CubeMapFBO::Create(unsigned int resolution, GLuint internalFormat, GLuint textureFormat, GLuint dataType)
{
#ifdef DEBUG
	int result;
	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &result);
	size_t uResult = static_cast<unsigned>(result);
	assert(resolution > 0 && resolution <= uResult);
#endif
 
 
	m_resolution = resolution;
 
 
	glGenTextures(1, &m_cubeMapID);
 
 
	glBindTexture(GL_TEXTURE_CUBE_MAP, m_cubeMapID);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 
 
	glGenFramebuffers(1, &m_fboID);
	glBindFramebuffer(GL_FRAMEBUFFER, m_fboID);
 
 
	// Create all faces
	for(unsigned int i = 0; i < 6; i++)
	{
		glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internalFormat, m_resolution, m_resolution, 0, textureFormat, dataType, NULL);
		glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, m_cubeMapID, 0);
	}
 
 
	glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
 
 
	// Render buffer creation for depth buffer
	glGenRenderbuffers(1, &m_depthID);
	glBindRenderbuffer(GL_RENDERBUFFER, m_depthID);
	glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_resolution, m_resolution);
	glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthID);
 
 
	// Unbind
	glBindRenderbuffer(GL_RENDERBUFFER, 0);
	glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
 
	// Check that the buffer was properly created
#ifdef DEBUG
	if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
		std::cerr << "Could not create cube map FBO!" << std::endl;
#endif
 
 
	// Set up view matrices
	m_baseViews[0] = Matrix4x4f::CameraDirectionMatrix(Vec3f(1.0f, 0.0f, 0.0f), Vec3f(0.0f, 1.0f, 0.0f));
	m_baseViews[1] = Matrix4x4f::CameraDirectionMatrix(Vec3f(-1.0f, 0.0f, 0.0f), Vec3f(0.0f, 1.0f, 0.0f));
	m_baseViews[2] = Matrix4x4f::CameraDirectionMatrix(Vec3f(0.0f, 1.0f, 0.0f), Vec3f(1.0f, 0.0f, 0.0f));
	m_baseViews[3] = Matrix4x4f::CameraDirectionMatrix(Vec3f(0.0f, -1.0f, 0.0f), Vec3f(1.0f, 0.0f, 0.0f));
	m_baseViews[4] = Matrix4x4f::CameraDirectionMatrix(Vec3f(0.0f, 0.0f, 1.0f), Vec3f(0.0f, 1.0f, 0.0f));
	m_baseViews[5] = Matrix4x4f::CameraDirectionMatrix(Vec3f(0.0f, 0.0f, -1.0f), Vec3f(0.0f, 1.0f, 0.0f));
 
 
	m_created = true;
 
 
	GL_ERROR_CHECK();
}
 
 
void CubeMapFBO::Render(class Scene* pScene, const Vec3f &position, float zNear, float zFar, float distance)
{
	assert(m_created);
 
 
	glBindFramebuffer(GL_FRAMEBUFFER, m_fboID);
 
 
	//glDisable(GL_CULL_FACE);
 
 
	glMatrixMode(GL_PROJECTION);
	Matrix4x4f::PerspectiveMatrix(pif_over_2, 1.0f, zNear, zFar).GL_Load();
	glMatrixMode(GL_MODELVIEW);
 
 
	// Clear all color buffers simultaneously
	GLenum allBuffers[6] = {
		GL_COLOR_ATTACHMENT0,
		GL_COLOR_ATTACHMENT1,
		GL_COLOR_ATTACHMENT2,
		GL_COLOR_ATTACHMENT3,
		GL_COLOR_ATTACHMENT4,
		GL_COLOR_ATTACHMENT5,
	};
 
 
	glDrawBuffers(6, allBuffers);
	glClear(GL_COLOR_BUFFER_BIT);
 
 
	SetViewport();
 
 
	for(unsigned int i = 0; i < 6; i++)
	{	
		glDrawBuffer(GL_COLOR_ATTACHMENT0 + i);
 
 
		glClear(GL_DEPTH_BUFFER_BIT);
 
 
		Matrix4x4f viewMatrix(m_baseViews[i] * Matrix4x4f::TranslateMatrix(-position));
		pScene->SetCustomViewMatrix(viewMatrix);
 
		pScene->ExtractFrustum(Matrix4x4f::GL_Get_Projection() * viewMatrix);
 
 
		pScene->SetWorldMatrix(Matrix4x4f::IdentityMatrix());
 
 
		pScene->Render_Distance(distance);
	}
 
 
	//glEnable(GL_CULL_FACE);
 
 
	// Reset projection
	pScene->m_pWin->SetViewport();
	pScene->m_pWin->SetPerspective();
 
 
	// Reset view matrix
	pScene->SetWorldMatrix(Matrix4x4f::IdentityMatrix());
 
 
	glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

textureFormat is GL_RGB16F and dataType is GL_FLOAT. I tried some other formats as well, but it didn't seem to make a difference.

Thank you for any help you can offer!