Closed sasmaster closed 10 years ago
Hi,
from the .Bind() without arguments I'm assuming that are DSA textures, right? If so did you set the target properly?
_gfboTex0.Active(0);
_gfboTex0.target = TextureTarget::_2D;
_gfboTex0.Bind();
_gfboTex1.Active(1);
_gfboTex1.target = TextureTarget::_2D;
_gfboTex1.Bind();
or equivalent but shorter:
_gfboTex0.Active(0);
_gfboTex0.Bind(TextureTarget::_2D);
_gfboTex1.Active(1);
_gfboTex1.Bind(TextureTarget::_2D);
I assumed this is done internally when. Active () is called. Will try it out, but why not to hide it behind Active and bind? Active can implicitly activate a unit and. Bind () would bind the id of the caller. Also it's clear if the texture is defined as 2d it's target is 2d. Setting it's target to anything else will probably cause driver exception . On Jan 17, 2014 8:59 PM, "Matus Chochlik" notifications@github.com wrote:
Hi,
from the .Bind() without arguments I'm assuming that are DSA textures, right? If so did you set the target properly?
_gfboTex0.Active(0); _gfboTex0.target = TextureTarget::_2D; _gfboTex0.Bind(); _gfboTex1.Active(1); _gfboTex1.target = TextureTarget::_2D; _gfboTex1.Bind();
or equivalent but shorter:
_gfboTex0.Active(0); _gfboTex0.Bind(TextureTarget::_2D); _gfboTex1.Active(1); _gfboTex1.Bind(TextureTarget::_2D);
— Reply to this email directly or view it on GitHubhttps://github.com/matus-chochlik/oglplus/issues/48#issuecomment-32636098 .
Well, after construction the target member variable of DSA texture is uninitialized and you must set it manually. Once you set it it is used automatically. It would be possible to set the target in the _Image_D() member functions in some cases but not always, you can for example use Texture2D to set cube map faces.
OK,I will clean up that code and then if you wish , you can add it to the examples. I took the reference from OpenGL superbible as it uses latest api approach. On Jan 17, 2014 9:12 PM, "Matus Chochlik" notifications@github.com wrote:
Well, after construction the target member variable of DSA texture is uninitialized and you must set it manually. Once you set it it is used automatically. It would be possible to set the target in the _Image_D() member functions in some cases but not always, you can for example use Texture2D to set cube map faces.
— Reply to this email directly or view it on GitHubhttps://github.com/matus-chochlik/oglplus/issues/48#issuecomment-32637212 .
Nice work, Thanks!
Since which version this
_gfboTex0.Bind(TextureTarget::_2D);
works?I am on .39 and it has no such an argument
On Fri, Jan 17, 2014 at 9:17 PM, Matus Chochlik notifications@github.comwrote:
Nice work, Thanks!
— Reply to this email directly or view it on GitHubhttps://github.com/matus-chochlik/oglplus/issues/48#issuecomment-32637625 .
Michael Ivanov Independent Pixel Commander onlygraphix.com Tel:+972 54 4962254
In fact,having updated to the latest one see no methods with such a signature...
Have a look here (line 160):
The Target type is a typedef for TextureTarget. I don't remember exactly when I've added it but it's been there for some time.
Ah,you mean I need to use DSATextureEXT
Instead of Texture ?
On Fri, Jan 17, 2014 at 11:50 PM, Matus Chochlik notifications@github.comwrote:
Have a look here (line 160):
The Target type is a typedef for TextureTarget. I don't remember exactly when I've added it but it's been there for some time.
— Reply to this email directly or view it on GitHubhttps://github.com/matus-chochlik/oglplus/issues/48#issuecomment-32651874 .
Michael Ivanov Independent Pixel Commander onlygraphix.com Tel:+972 54 4962254
Hmm, I assumed you already were using DSA texture. But anyway (non-DSA) Texture also has a Bind(Target) member function. Also note that, Texture::Active(i) is a static member function, it does not work on any particular instance of Texture.
Generally: If you are using Texture then you must make one of the texture units active by
Texture tex;
Texture::Active(i);
then you must bind the texture to one of the targets:
tex.Bind(TextureTarget::_2D);
and then you operate on the texture using static member functions and the same target
Texture::Image2D(TextureTarget::_2D, ...);
Texture::GenerateMipmaps(TextureTarget::_2D);
If you are using DSATextureEXT the you may operate on the texture instance directly without binding it, but you must specify a target:
DSATextureExt tex;
tex.target = TextureTarget::_2D;
tex.Image2D(...);
tex.GenerateMipmaps();
and if you want to access the texture in a GPU program then you must bind it to the (previously-specified) target on active texture unit:
Texture::Active(i);
tex.Bind();
Have a look at the examples/oglplus/*.cpp examples, quite lot of them use textures so you should be able to figure it out. HTH.
B.T.W. there is also a third option the Bound
lines 163-170.
Hi Matus.I have implemented DR in OGLPlus.But one thing I seems to be failed to do with the API and that's MRT bindings.For example:
Doesn't bind correctly.Probably doesn't bind at all to units 0 and 1. While this works fine: