fix RTM_bind_or_copy

This commit is contained in:
David Rose 2008-08-10 17:00:17 +00:00
parent 58c54ef085
commit 6e72268787
4 changed files with 33 additions and 9 deletions

View File

@ -314,15 +314,19 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
// which has system-imposed restrictions on size).
tex->set_size_padded(get_x_size(), get_y_size());
if (mode == RTM_bind_or_copy && !support_render_texture) {
mode = RTM_copy_texture;
}
else {
if (_gsg -> get_supports_render_texture ( )) {
tex->set_render_to_texture (true);
if (mode == RTM_bind_or_copy) {
if (!_gsg->get_supports_render_texture() || !support_render_texture) {
// Binding is not supported or it is disabled, so just fall back
// to copy instead.
mode = RTM_copy_texture;
}
}
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;
result._texture = tex;

View File

@ -720,7 +720,15 @@ get_compression() const {
////////////////////////////////////////////////////////////////////
// Function: Texture::get_render_to_texture
// 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::
get_render_to_texture() const {

View File

@ -840,7 +840,19 @@ set_compression(Texture::CompressionMode compression) {
////////////////////////////////////////////////////////////////////
// Function: Texture::set_render_to_texture
// 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::
set_render_to_texture(bool render_to_texture) {

View File

@ -118,7 +118,7 @@ close_buffer() {
_active = false;
}
GraphicsBuffer::close_buffer();
_is_valid = false;
}
////////////////////////////////////////////////////////////////////