Some stencil fbo code runs on ati but not on nvidia

I have written a very simple program but with fbos.
That program can run smoothly under ati card pcs but report error on nvidia card pcs.

I have tested it on several nvidia cards installed machines. The cause of the program seems to be the blit between stencil buffers.

The following code is the creation of this fbo.


       enum {Color,Depth,Stencil,NumRenderbuffers};

       GLuint framebuffer,screenImageFramebuffer, renderbuffer[NumRenderbuffers], screenImageRenderbuffer[NumRenderbuffers];

	glGenRenderbuffersEXT(NumRenderbuffers,renderbuffer);
	CHECK_ERR;

	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,renderbuffer[Color]);
	CHECK_ERR;

	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_RGBA8,256,256);
	CHECK_ERR;

	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,renderbuffer[Stencil]);
	CHECK_ERR;

	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_STENCIL_INDEX8,256,256);
	CHECK_ERR;

	glGenFramebuffersEXT(1, & framebuffer);
	CHECK_ERR;
	
	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,framebuffer);
	value=glExtCheckFramebufferStatus(ErrorMessage);
	CHECK_ERR;

	glFramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_RENDERBUFFER_EXT,renderbuffer[Color]);
	CHECK_ERR;

	glFramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER_EXT,GL_STENCIL_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,renderbuffer[Stencil]);
	value=glExtCheckFramebufferStatus(ErrorMessage);                         //Here reported "GL_FRAMEBUFFER_UNSUPPORTED_EXT" on a GTX 650 Ti card.
	CHECK_ERR;

Any one can give any hint or another way to write code about blitting between stencil buffers.
Thanks in advance and good day! :tired:

p.s.
Personally I have no bias on any graphics card products or manufactories. I’m just an individual developer and just want my idea and program can run on as many hardwares as possible!

Best regards,

newbiecow

glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_STENCIL_INDEX8,256,256); -> glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8,256,256);

[QUOTE=newbiecow;1247900]I have written a very simple program but with fbos.
That program can run smoothly under ati card pcs but report error on nvidia card pcs.

I have tested it on several nvidia cards installed machines. The cause of the program seems to be the blit between stencil buffers.

The following code is the creation of this fbo.


       enum {Color,Depth,Stencil,NumRenderbuffers};

       GLuint framebuffer,screenImageFramebuffer, renderbuffer[NumRenderbuffers], screenImageRenderbuffer[NumRenderbuffers];

	glGenRenderbuffersEXT(NumRenderbuffers,renderbuffer);
	CHECK_ERR;

	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,renderbuffer[Color]);
	CHECK_ERR;

	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_RGBA8,256,256);
	CHECK_ERR;

	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,renderbuffer[Stencil]);
	CHECK_ERR;

	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_STENCIL_INDEX8,256,256);
	CHECK_ERR;

	glGenFramebuffersEXT(1, & framebuffer);
	CHECK_ERR;
	
	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,framebuffer);
	value=glExtCheckFramebufferStatus(ErrorMessage);
	CHECK_ERR;

	glFramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_RENDERBUFFER_EXT,renderbuffer[Color]);
	CHECK_ERR;

	glFramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER_EXT,GL_STENCIL_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,renderbuffer[Stencil]);
	value=glExtCheckFramebufferStatus(ErrorMessage);                         //Here reported "GL_FRAMEBUFFER_UNSUPPORTED_EXT" on a GTX 650 Ti card.
	CHECK_ERR;

Any one can give any hint or another way to write code about blitting between stencil buffers.
Thanks in advance and good day! :tired:

p.s.
Personally I have no bias on any graphics card products or manufactories. I’m just an individual developer and just want my idea and program can run on as many hardwares as possible!

Best regards,

newbiecow[/QUOTE]

p.p.s.
I forgot to remind, the most important, my question is only relevant to opengl coding skills, perhaps referring some hardware but nothing else such as my program or idea. So if you think my idea or program is nonsense and should be tossed into bin, just send me private message to insult as you wish. But as for the question in this thread, please observe the forum guidelines and save the manners.

Best regards,

newbiecow

that’s not the first time here then you get a suggestion, and instead of checking it and reporting result(my post points at exact line containing mistake and the line you should use instead), you posting some irrelevant rubbish. your questions are easy to answer and could be solved with search queries like “opengl stencil fbo”. and i could post exact code for blitting stencil between FBO’s with some guidelines. but i don’t see any point. everyone will just ignore your topics.

Well. I’m very gratitude to you for your help. After I checked your answer and modified it to something like GL_DEPTH24_STENCIL8, I get my code run smoothly again. But this is not wholy my fault at all. I have an ATI version of such code where if you want to blit between stencil buffers, you have no way of using GL_DEPTH24_STENCIL8 but have to use GL_STENCIL_ATTACHMENT.

Obviously, I can guess out you are an nvidia developer or at least not tried to do blitting stencil buffers on ATI card. So you know your way but I just the inverse.

Best regards,

newbiecow

yes, it looks like it is a remaining problem. these topics have some info on how it is usually handled;

according to second topic, method of blitting i supplied to you hereshould work

also, just blitting stencil buffer doesn’t work for you? you may report it to amd, to remind them.
you can send a test case to devrel@amd.com (with pierre.boudier@amd.com in CC)