From 5d86a25f4d04b21559f0d4edbd4e70dc01ea6685 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 19 Oct 2015 18:47:49 -0300 Subject: [PATCH] -some fixes to where screen is read from rasterizer -fixed bug in ogg vorbis looping -properly flushing audiostream rb when stopping --- drivers/gles2/rasterizer_gles2.cpp | 12 ++++++++++-- drivers/vorbis/audio_stream_ogg_vorbis.cpp | 2 +- scene/3d/spatial_stream_player.cpp | 1 + scene/audio/stream_player.cpp | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 3d75ed29f3b..c36f99d78dd 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -9164,7 +9164,11 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); if (framebuffer.scale==1 && !canvas_texscreen_used) { #ifdef GLEW_ENABLED - glReadBuffer(GL_COLOR_ATTACHMENT0); + if (current_rt) { + glReadBuffer(GL_COLOR_ATTACHMENT0); + } else { + glReadBuffer(GL_BACK); + } #endif glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); // if (current_clip) { @@ -9344,7 +9348,11 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); #ifdef GLEW_ENABLED - glReadBuffer(GL_COLOR_ATTACHMENT0); + if (current_rt) { + glReadBuffer(GL_COLOR_ATTACHMENT0); + } else { + glReadBuffer(GL_BACK); + } #endif glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,w,h); // if (current_clip) { diff --git a/drivers/vorbis/audio_stream_ogg_vorbis.cpp b/drivers/vorbis/audio_stream_ogg_vorbis.cpp index ca055c8b620..8c1c05006fa 100644 --- a/drivers/vorbis/audio_stream_ogg_vorbis.cpp +++ b/drivers/vorbis/audio_stream_ogg_vorbis.cpp @@ -361,7 +361,7 @@ void AudioStreamPlaybackOGGVorbis::_clear_stream() { _close_file(); stream_loaded=false; - stream_channels=1; + //stream_channels=1; playing=false; } diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index 346e354df21..7ed2335fcb1 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -171,6 +171,7 @@ void SpatialStreamPlayer::stop() { //AudioServer::get_singleton()->stream_set_active(stream_rid,false); SpatialSoundServer::get_singleton()->source_set_audio_stream(get_source_rid(),NULL); playback->stop(); + resampler.flush(); //set_idle_process(false); } diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index 0ee9d76611f..bffb2de4d49 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -165,6 +165,8 @@ void StreamPlayer::stop() { //_THREAD_SAFE_METHOD_ AudioServer::get_singleton()->stream_set_active(stream_rid,false); playback->stop(); + resampler.flush(); + //set_idle_process(false); }