List<Vec4> ChoiceForm::ReadFrameData(GL::Texture2D tex) { List<Vec4> rs; int w, h; tex.GetSize(w, h); rs.SetSize(w*h); tex.GetData(0, DataType::Float4, rs.Buffer(), rs.Count()*sizeof(Vec4)); return rs; }
UIImage(WinGLSystemInterface* ctx, const CoreLib::Imaging::Bitmap & bmp) { context = ctx; texture = context->glContext->CreateTexture2D(); texture.SetData(bmp.GetIsTransparent() ? GL::StorageFormat::RGBA_I8 : GL::StorageFormat::RGB_I8, bmp.GetWidth(), bmp.GetHeight(), 1, bmp.GetIsTransparent() ? GL::DataType::Byte4 : GL::DataType::Byte, bmp.GetPixels()); w = bmp.GetWidth(); h = bmp.GetHeight(); }
void LightPathtracer::SetScreenSize(const gl::Texture2D& _newBackbuffer) { _newBackbuffer.BindImage(0, gl::Texture::ImageAccess::READ_WRITE); m_lockTexture.reset(new gl::Texture2D(_newBackbuffer.GetWidth(), _newBackbuffer.GetHeight(), gl::TextureFormat::R32UI)); m_lockTexture->ClearToZero(0); m_lockTexture->BindImage(1, gl::Texture::ImageAccess::READ_WRITE); // Rule: Every block (size = m_localSizeLightPathtracer) should work with the same initial light sample! int numPixels = _newBackbuffer.GetWidth() * _newBackbuffer.GetHeight(); m_numRaysPerLightSample = std::max(m_localSizeLightPathtracer, (numPixels / m_rendererSystem.GetNumInitialLightSamples() / m_localSizeLightPathtracer) * m_localSizeLightPathtracer); //m_numRaysPerLightSample = 1<<16; if(m_lightpathtraceUBO) { gl::MappedUBOView mapView(m_lightpathtraceUBOInfo, m_lightpathtraceUBO->Map(gl::Buffer::MapType::WRITE, gl::Buffer::MapWriteFlag::NONE)); mapView["NumRaysPerLightSample"].Set(static_cast<std::int32_t>(m_numRaysPerLightSample)); m_lightpathtraceUBO->Unmap(); } }
void Pathtracer::SetScreenSize(const gl::Texture2D& _newBackbuffer) { _newBackbuffer.BindImage(0, gl::Texture::ImageAccess::READ_WRITE); }