mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
fix RTM_bind_or_copy
This commit is contained in:
parent
58c54ef085
commit
6e72268787
@ -314,15 +314,19 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
|
|||||||
// which has system-imposed restrictions on size).
|
// which has system-imposed restrictions on size).
|
||||||
tex->set_size_padded(get_x_size(), get_y_size());
|
tex->set_size_padded(get_x_size(), get_y_size());
|
||||||
|
|
||||||
if (mode == RTM_bind_or_copy && !support_render_texture) {
|
if (mode == RTM_bind_or_copy) {
|
||||||
mode = RTM_copy_texture;
|
if (!_gsg->get_supports_render_texture() || !support_render_texture) {
|
||||||
}
|
// Binding is not supported or it is disabled, so just fall back
|
||||||
else {
|
// to copy instead.
|
||||||
if (_gsg -> get_supports_render_texture ( )) {
|
mode = RTM_copy_texture;
|
||||||
tex->set_render_to_texture (true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode == RTM_bind_or_copy) {
|
||||||
|
// If we're still planning on binding, indicate it in texture
|
||||||
|
// properly.
|
||||||
|
tex->set_render_to_texture(true);
|
||||||
|
}
|
||||||
|
|
||||||
RenderTexture result;
|
RenderTexture result;
|
||||||
result._texture = tex;
|
result._texture = tex;
|
||||||
|
@ -720,7 +720,15 @@ get_compression() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Texture::get_render_to_texture
|
// Function: Texture::get_render_to_texture
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description:
|
// Description: Returns a flag on the texture that indicates whether the
|
||||||
|
// texture is intended to be used as a direct-render
|
||||||
|
// target, by binding a framebuffer to a texture and
|
||||||
|
// rendering directly into the texture.
|
||||||
|
//
|
||||||
|
// Normally, a user should not need to set this flag
|
||||||
|
// directly; it is set automatically by the low-level
|
||||||
|
// display code when a texture is bound to a
|
||||||
|
// framebuffer.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE bool Texture::
|
INLINE bool Texture::
|
||||||
get_render_to_texture() const {
|
get_render_to_texture() const {
|
||||||
|
@ -840,7 +840,19 @@ set_compression(Texture::CompressionMode compression) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Texture::set_render_to_texture
|
// Function: Texture::set_render_to_texture
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description:
|
// Description: Sets a flag on the texture that indicates whether the
|
||||||
|
// texture is intended to be used as a direct-render
|
||||||
|
// target, by binding a framebuffer to a texture and
|
||||||
|
// rendering directly into the texture.
|
||||||
|
//
|
||||||
|
// This controls some low-level choices made about the
|
||||||
|
// texture object itself. For instance, compressed
|
||||||
|
// textures are disallowed when this flag is set true.
|
||||||
|
//
|
||||||
|
// Normally, a user should not need to set this flag
|
||||||
|
// directly; it is set automatically by the low-level
|
||||||
|
// display code when a texture is bound to a
|
||||||
|
// framebuffer.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void Texture::
|
void Texture::
|
||||||
set_render_to_texture(bool render_to_texture) {
|
set_render_to_texture(bool render_to_texture) {
|
||||||
|
@ -118,7 +118,7 @@ close_buffer() {
|
|||||||
_active = false;
|
_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsBuffer::close_buffer();
|
_is_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user