GenericBuffer.cpp (pymol-open-source-2.2.0) | : | GenericBuffer.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 387 | skipping to change at line 387 | |||
d.height = _size.y; | d.height = _size.y; | |||
tex::data_type type; | tex::data_type type; | |||
switch (d.type) { | switch (d.type) { | |||
case rt_layout_t::UBYTE: | case rt_layout_t::UBYTE: | |||
type = tex::data_type::UBYTE; | type = tex::data_type::UBYTE; | |||
break; | break; | |||
case rt_layout_t::FLOAT: | case rt_layout_t::FLOAT: | |||
type = tex::data_type::FLOAT; | type = tex::data_type::FLOAT; | |||
break; | break; | |||
default: | ||||
printf("Error: %s:%d\n", __FILE__, __LINE__); | ||||
return; | ||||
} | } | |||
tex::format format; | tex::format format; | |||
switch (d.nchannels) { | switch (d.nchannels) { | |||
case 1: | case 1: | |||
format = tex::format::R; | format = tex::format::R; | |||
break; | break; | |||
case 2: | case 2: | |||
format = tex::format::RG; | format = tex::format::RG; | |||
break; | break; | |||
case 3: | case 3: | |||
format = tex::format::RGB; | format = tex::format::RGB; | |||
break; | break; | |||
case 4: | case 4: | |||
format = tex::format::RGBA; | format = tex::format::RGBA; | |||
break; | break; | |||
default: | ||||
printf("Error: %s:%d\n", __FILE__, __LINE__); | ||||
return; | ||||
} | } | |||
_textures.push_back(new textureBuffer_t( | _textures.push_back(new textureBuffer_t( | |||
format, type, tex::filter::LINEAR, tex::filter::LINEAR, | format, type, tex::filter::LINEAR, tex::filter::LINEAR, | |||
tex::wrap::CLAMP, tex::wrap::CLAMP)); | tex::wrap::CLAMP, tex::wrap::CLAMP)); | |||
auto tex = _textures.back(); | auto tex = _textures.back(); | |||
tex->texture_data_2D(d.width, d.height, 0); | tex->texture_data_2D(d.width, d.height, nullptr); | |||
fbo::attachment loc; | fbo::attachment loc; | |||
switch (_textures.size()) { | switch (_textures.size()) { | |||
case 1: | case 1: | |||
loc = fbo::attachment::COLOR0; | loc = fbo::attachment::COLOR0; | |||
break; | break; | |||
case 2: | case 2: | |||
loc = fbo::attachment::COLOR1; | loc = fbo::attachment::COLOR1; | |||
break; | break; | |||
case 3: | case 3: | |||
skipping to change at line 453 | skipping to change at line 459 | |||
} | } | |||
for (auto i : _textures) { | for (auto i : _textures) { | |||
delete i; | delete i; | |||
} | } | |||
_textures.clear(); | _textures.clear(); | |||
delete _fbo; | delete _fbo; | |||
std::vector<rt_layout_t> desc; | std::vector<rt_layout_t> desc; | |||
for (size_t i = 0; i < _desc.size(); ++i) { | for (auto& i : _desc) { | |||
desc.emplace_back(_desc[i].nchannels, _desc[i].type, size.x, size.y); | desc.emplace_back(i.nchannels, i.type, size.x, size.y); | |||
} | } | |||
layout(std::move(desc), _rbo); | layout(std::move(desc), _rbo); | |||
} | } | |||
void renderTarget_t::bind(bool clear) const { | void renderTarget_t::bind(bool clear) const { | |||
_fbo->bind(); | _fbo->bind(); | |||
if (clear) { | if (clear) { | |||
glClearColor(0.f, 0.f, 0.f, 0.f); | glClearColor(0.f, 0.f, 0.f, 0.f); | |||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added |