Skip to main content
GameDev.net gamedev.net
🔒 Locked

ATI card issues

Started by Vilem Otte Mar 30, 2009 at 10:14 AM 1 replies 2k views
Original Post
Vilem Otte
Vilem Otte
Hello, I was making another demo, when I gone into very strange issues (of course on ATI card). I installed newest drivers and tried it again, but without any success. So whats the problem? The problem is quite simple - I'm using FBOs like I used thousand times before, but I'm not getting any texture from them (and even glCopyTexSubImage2D procedure does NOT work). I tried to recompile some my older applications with this stuff, and they recompiled successfully without any issue - so probably there is some mistake in code (though I wasn't able to find any) - maybe someone who decides to help me a little will have better luck:

// Initialization of my framebuffer after initializing OpenGL
	char* ext = (char*)glGetString(GL_EXTENSIONS);
	if( strstr( ext, "EXT_framebuffer_object" ) == NULL )
	{
		MessageBox(NULL,"EXT_framebuffer_object extension was not found",
			"ERROR",MB_OK|MB_ICONEXCLAMATION);
		exit(-1);
	}
	else
	{
		glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)wglGetProcAddress("glIsRenderbufferEXT");
		glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)wglGetProcAddress("glBindRenderbufferEXT");
		glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)wglGetProcAddress("glDeleteRenderbuffersEXT");
		glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
		glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
		glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)wglGetProcAddress("glGetRenderbufferParameterivEXT");
		glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC)wglGetProcAddress("glIsFramebufferEXT");
		glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)wglGetProcAddress("glBindFramebufferEXT");
		glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT");
		glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress("glGenFramebuffersEXT");
		glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)wglGetProcAddress("glCheckFramebufferStatusEXT");
		glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)wglGetProcAddress("glFramebufferTexture1DEXT");
		glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)wglGetProcAddress("glFramebufferTexture2DEXT");
		glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)wglGetProcAddress("glFramebufferTexture3DEXT");
		glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
		glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)wglGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
		glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)wglGetProcAddress("glGenerateMipmapEXT");

		if( !glIsRenderbufferEXT || !glBindRenderbufferEXT || !glDeleteRenderbuffersEXT || 
			!glGenRenderbuffersEXT || !glRenderbufferStorageEXT || !glGetRenderbufferParameterivEXT || 
			!glIsFramebufferEXT || !glBindFramebufferEXT || !glDeleteFramebuffersEXT || 
			!glGenFramebuffersEXT || !glCheckFramebufferStatusEXT || !glFramebufferTexture1DEXT || 
			!glFramebufferTexture2DEXT || !glFramebufferTexture3DEXT || !glFramebufferRenderbufferEXT||  
			!glGetFramebufferAttachmentParameterivEXT || !glGenerateMipmapEXT )
		{
			MessageBox(NULL,"One or more EXT_framebuffer_object functions were not found",
				"ERROR",MB_OK|MB_ICONEXCLAMATION);
			exit(-1);
		}
	}

	glGenFramebuffersEXT(1, frameBuffer);
	glGenRenderbuffersEXT(1, depthBuffer);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBuffer);
	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, FBOWidth, FBOHeight);

	GLenum status = glCheckFramebufferStatusEXT(GL_RENDERBUFFER_EXT);

	switch(status)
	{
	case GL_FRAMEBUFFER_COMPLETE_EXT:
		break;
	case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
		MessageBox(hWnd, "Blah blah", "Error", MB_OK|MB_ICONINFORMATION);
		return false;
		break;
	}

	glGenTextures(1, texture);
	glBindTexture(GL_TEXTURE_2D, texture);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, FBOWidth, FBOHeight, 0, GL_RGBA, GL_FLOAT, 0);
	glTexParameteri(textype, GL_TEXTURE_MAG_FILTER, tex_filter);
	glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, tex_filter);

// Now comes code to set framebuffer as active (of course in rendering part, not in initialization part
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBuffer);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture, 0);
	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBuffer);

	glViewport(0, 0, FBOWidth, FBOHeight);

	glClearColor(0, 0, 0, 0);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);	
	glLoadIdentity();

// And after I do some rendering i set is as inactive
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
I can't see any issue in code - maybe that "some rendering" do the issues (I will play now a little with it), but I just can't see what could be wrong with this code. Anyway the most strange thing is, that for another application with almost same code (my Fliegerlied demo - it differs in just some rendering code (rendering different stuff, etc.) + it has ray tracing code - but that's not affecting FBOs at all) this works perfectly.
zedz
zedz
surely that shouldnt compile

eg

glGenFramebuffersEXT(1, frameBuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer);

the first requires a pointer to the fb object IDs,
&frameBuffer + frameBuffer should work
Vilem Otte
Vilem Otte
#zedz
- ye i know, I was deleting some this-> in the code (it is purely object based) and I now realised that I deleted some pointers too while copying here onto page (whooops ... sorry)
anyway thanks for looking at code

Solved,

some issues with settings on GPU (so I was right, something about fixed setting of (not application driven) antialiasing, anisotropic filtering, mipmapping, etc.), dunno if they have been set while reinstalling (or if I set them wrong) - anyway problem is now solved.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.