Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fbo + multitexturing + glsl problem



Its an intel machine (santa rosa), macbook pro. As for the fbo setup, it says its created successfully. It works fine too for single textures passed to the glsl shader and rendered via framebuffer. I downloaded the fbo class from gpgpu.org and used it instead of my code, just to be sure its not my code, but I have the same problem. Thanks for reading.


On Nov 1, 2007, at 12:38 PM, Greg Keech wrote:

Is this on a PPC or an Intel machine?
I've managed to get FBO, shaders and multi floating point textures working on my Mac Pro but have ran into similar problems on my PPC.
Greg Keech


On 1-Nov-07, at 9:29 AM, Patrick O'Brien wrote:

I've been having a lot of problems using multiple textures sent to a glsl shader when using the framebuffer. Here is the basic problem:

I create two checkers textures that are floating point textures. I send the textures to a glsl shader. The result (combines the textures) is fine when not using the framebuffer. However I get black when using the framebuffer.

I'm using OpenGL 2.0 on a Mac with OSX 10.4.10. I'm using the FBO class from this site. I use GL_TEXTURE_2D and GL_RGBA32F_ARB (I tried GL_RGBA16F_ARB, but it doesn't change anything). It works fine when I download it and run it with the sample program (edge filter on the teapot and tori). It works [i]fine[/i] with a [i] single checkers texture[/i] as well. It's just when I try to do multiple texturing.

The shader looks like this:

uniform sampler2D texUnit;
uniform sampler2D texUnit2;
void main(void)
{
const float offset = 1.0 / 512.0;
vec2 texCoord = gl_TexCoord[0].xy;
vec4 c = texture2D(texUnit, texCoord);
vec4 c2 = texture2D(texUnit2, texCoord);
vec4 bl = texture2D(texUnit, texCoord + vec2(-offset, - offset));
vec4 l = texture2D(texUnit, texCoord + vec2(-offset, 0.0));
vec4 tl = texture2D(texUnit, texCoord + vec2(-offset, offset));
vec4 t = texture2D(texUnit, texCoord + vec2( 0.0, offset));
vec4 ur = texture2D(texUnit, texCoord + vec2( offset, offset));
vec4 r = texture2D(texUnit, texCoord + vec2( offset, 0.0));
vec4 br = texture2D(texUnit, texCoord + vec2( offset, offset));
vec4 b = texture2D(texUnit, texCoord + vec2( 0.0, - offset));
gl_FragColor = c2 + (8.0 * (c + -0.125 * (bl + l + tl + t + ur + r + br + b)));
}



The texture activation looks like:

	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, _iTexture[2]);
        glUniform1i(_texUnit, 0);
	glActiveTexture(GL_TEXTURE1);
	glBindTexture(GL_TEXTURE_2D, _iTexture[3]);
	glUniform1i(_texUnit2, 1);

Any help is greatly appreciated. I've been at this for two weeks with no proress and its driving me crazy.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/keech% 40conversionworks.com


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/patrick% 40patrickobrienart.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >fbo + multitexturing + glsl problem (From: Patrick O'Brien <email@hidden>)
 >Re: fbo + multitexturing + glsl problem (From: Greg Keech <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.