Jump to content

  • Log In with Google      Sign In   
  • Create Account


RTT with working on ATI but not nVidia (OpenGL)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 rocklobster   Members   -  Reputation: 415

Like
0Likes
Like

Posted 26 August 2013 - 08:27 AM

Hey guys,

 

Since the start of my hobby project, I've been using one PC for development which is using an ATI card. I've just tried to run my project on my friends computer and my laptop (both have nVidia cards) and nothing renders, the screen is the same colour as the glClear(...) with nothing showing. 

 

I did some debugging with glGetError and I'm not getting any errors showing up. I removed my render target and just rendered my scene to the default framebuffer and then things started drawing (minus the post-processing). So this leads me to believe my framebuffer object is not created correctly for nVidia cards?

bool Graphics::CreateRenderTarget( RenderTarget* target )
	{
		GLuint fbo;
		glGenFramebuffers(1, &fbo);
		glBindFramebuffer(GL_FRAMEBUFFER, fbo);
		target->SetFrameBufferId(fbo);

		for (uint32 i = 0; i < target->GetNumSources(); i++)
		{
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

			GLuint tex;
			glActiveTexture(GL_TEXTURE0 + i);
			glGenTextures(1, &tex);
			glBindTexture(GL_TEXTURE_2D, tex);
			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, target->GetWidth(), target->GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
			glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, tex, 0);
			target->SetSourceId(i, tex);
		}

		if (target->UseDepth())
		{
			GLuint depth;
			glGenRenderbuffers(1, &depth);
			glBindRenderbuffer(GL_RENDERBUFFER, depth);
			glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, target->GetWidth(), target->GetHeight());
			target->SetDepthBufferId(depth);
			glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);
		}

		glDrawBuffers(target->GetNumSources(), target->GetDrawBuffers());

		if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
		{
			return false;
		}
		return true;
	}

Anything obviously incorrect? I can post more info If needed.



Sponsor:

#2 jcabeleira   Members   -  Reputation: 669

Like
1Likes
Like

Posted 26 August 2013 - 09:38 AM


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

 

This should be done after the texture was created and bound.This is a texture state so it needs an active texture to be applied to. ;)



#3 rocklobster   Members   -  Reputation: 415

Like
0Likes
Like

Posted 27 August 2013 - 03:39 AM

Bingo! Thanks mate.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS