probably relating to this post
http://forum.openframeworks.cc/t/fbo-addon-for-0.06/1866/0
here is a simple do nothing shader (thanks memo)
------ fragment
uniform sampler2D tex0;
void main()
{
gl_FragColor = texture2D(tex0, gl_TexCoord[0].st);
}
------- vert
void main() {
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
In my app I do:
------- setup
myfbo.allocate(1024, 768, true);
testShader.loadShader("data/basic");
------- draw
// draw something into the fbo
myfbo.swapIn();
myfbo.setupScreenForMe();
ofCircle(50,50,20);
myfbo.swapOut();
myfbo.setupScreenForThem();
// bind shader then draw fbo
ofSetColor(255,255,255);
testShader.setShaderActive(true);
myfbo.draw(0,0,1024,768);
testShader.setShaderActive(false);
It draws nothing. Ive already tested the fbo drawing without shader, works fine.
In the fbo addon, if I comment out GLEE_ARB_texture_rectangle so that it uses:
//allocate
texData.tex_w = ofNextPow2(w);
texData.tex_h = ofNextPow2(h);
texData.tex_t = 1.0f;
texData.tex_u = 1.0f;
The fbo is now showing when I draw it with the shader, but it is coming out slightly fuzzy.
texData.tex_w = ofNextPow2(w);
texData.tex_h = ofNextPow2(h);
is coming out as
texData.tex_w = 1024;
texData.tex_h = 1024;
Any thoughts as to whats going on?
Many thanks
sth
May 11, 2009, 5:33pm
#2
Hi Chris,
if you are using GL_TEXTURE_RECT-textures you’ll have to use samplerRECT/textureRECT to access the pixels of your texture.
something along this lines should work
Code:
------ fragment
#extension GL_ARB_texture_rectangle : enable
uniform samplerRECT tex0;
void main()
{
gl_FragColor = textureRECT(tex0, gl_TexCoord[0].st);
}
------- vert
void main() {
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
this is from the top of my head, and untested code, so your mileage may vary
accessing 1D- or 3D-textures is analogous, use sampler1D/sampler3D and texture1D/texture2D.
cheers,
Stephan
I get in the console…
fragmentShader reports:
(2) warning c7508: extension GL_ARB_texture_rectangle not supported
(2) warning C7506: opengl does not define the global type samplerRECT
(5) error C1008: undefined variable “textureRECT”
(5) error C1105: cannot call a non-function
sth
May 11, 2009, 6:06pm
#4
[quote author=“chrisoshea”]I get in the console…
fragmentShader reports:
(2) warning c7508: extension GL_ARB_texture_rectangle not supported
(2) warning C7506: opengl does not define the global type samplerRECT
(5) error C1008: undefined variable “textureRECT”
(5) error C1105: cannot call a non-function
[/quote]
as noted, this was from my memory, try sampler2DRect / texture2DRect instead
cheers,
Stephan
Nope, doesnt work. Same error.
Maybe my graphics card isn’t good enough.
Strange though, as I’ve downloaded lots of different compiled glsl and cg examples that work fine.
sth
May 11, 2009, 6:36pm
#6
What hardware are you using?
I tested the sampler2DRect / texture2DRect on my MacBookPro / OS X with GLSLEditorSample, and it worked,
cheers,
Stephan
my graphics card is nvidia geforce go 7400.
updating to power book later this week.