Jump to content
  • Advertisement
Sign in to follow this  
M_D_K

OpenGL Weird FBO problem

This topic is 3630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I've been working with FBOs on GNU/Linux, I wrote code that worked on my nVidia card. And when I moved to my desktop(which has an ATI card) the code stopped working. I know its not lack of support of extensions or anything like that. It seams to be when I tell the texture to generate mipmaps glCheckFramebufferStatusEXT returns GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT. It should be easy to fix but the weird thing is the FBO example from here has the same FBO init code and it works. The differences between the example and mine is that it uses GLUT, I use SDL. It uses extensions directly(I'm pretty sure), I do it through GLEW(I also tried GLee, didn't help). well here is the offending code
[source lang=c]
	GLuint tex_id, fbo_id, rbo_id;
	glGenTextures(1, &tex_id);
	glBindTexture(GL_TEXTURE_2D, tex_id);

	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, (GLsizei)width, (GLsizei)height, 0,
		GL_RGBA, GL_UNSIGNED_BYTE, 0);

	glBindTexture(GL_TEXTURE_2D, 0);

	//create RBO
	glGenRenderbuffersEXT(1, &rbo_id);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbo_id);

	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
				(GLsizei)width, (GLsizei)height);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);

	//create FBO
	glGenFramebuffersEXT(1, &fbo_id);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_id);

	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
				GL_TEXTURE_2D, tex_id, 0);

	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
				GL_RENDERBUFFER_EXT, rbo_id);


	bool status = glCheck();
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

BTW my graphics card is an ATI Radeon X1650 and it supports all the extensions I need for this(GL_EXT_framebuffer_object, GL_SGIS_generate_mipmaps, etc). And I am running on the latest ATI drivers. Thanks in advance for any help.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!