how to unbind a texture which is attach to framebuffer as a rendertarget.

in directx, if i set a rendertarget which is still bind as a shader resource texture, it will cause a render error.
so, if we want to use that surface as a rendertarget, we must unbind this texture, like directx api:
DX9->SetTexture(i, NULL);

i want to know, is there any same question in opengl, if i create a texture2d and attach to a framebuffer, and then render something on it.
next step i use this texture as a normal texture, if it is still bind when the next frame, is it cause any errors? may be cause glClear failure by Invalid Operation?

[QUOTE=sczybt;1258114]if i create a texture2d and attach to a framebuffer, and then render something on it.
next step i use this texture as a normal texture, if it is still bind when the next frame, is it cause any errors?[/QUOTE]
If you try to use a texture that is attached to the framebuffer object you are rendering to, you will get undefined behaviour (i.e. depends on your implementation).
It might work as expected, it might not.

If you want to unbind the texture in order to render to it, call glBindTexture( <binding>, 0 )

The 3.x/4.x man pages don’t indicate an invalid operation error for glClear, however if you are using compatibillity profile or an older GL version and calling glClear within a begin/end block, GL_INVALID_OPERATION is generated.

[QUOTE=Agent D;1258124]If you try to use a texture that is attached to the framebuffer object you are rendering to, you will get undefined behaviour (i.e. depends on your implementation).
It might work as expected, it might not.

If you want to unbind the texture in order to render to it, call glBindTexture( <binding>, 0 )

The 3.x/4.x man pages don’t indicate an invalid operation error for glClear, however if you are using compatibillity profile or an older GL version and calling glClear within a begin/end block, GL_INVALID_OPERATION is generated.[/QUOTE]

thank you very much.