mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Fix extract_texture_data for buffer textures
This commit is contained in:
parent
5ad900a413
commit
441b791e57
@ -1356,6 +1356,8 @@ reset() {
|
|||||||
get_extension_func("glMapBuffer");
|
get_extension_func("glMapBuffer");
|
||||||
_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)
|
_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)
|
||||||
get_extension_func("glUnmapBuffer");
|
get_extension_func("glUnmapBuffer");
|
||||||
|
_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)
|
||||||
|
get_extension_func("glGetBufferSubData");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifndef OPENGLES_1
|
#ifndef OPENGLES_1
|
||||||
@ -1376,6 +1378,8 @@ reset() {
|
|||||||
get_extension_func("glMapBufferARB");
|
get_extension_func("glMapBufferARB");
|
||||||
_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)
|
_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)
|
||||||
get_extension_func("glUnmapBufferARB");
|
get_extension_func("glUnmapBufferARB");
|
||||||
|
_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)
|
||||||
|
get_extension_func("glGetBufferSubDataARB");
|
||||||
}
|
}
|
||||||
#endif // OPENGLES_1
|
#endif // OPENGLES_1
|
||||||
|
|
||||||
@ -12644,6 +12648,11 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
|
|||||||
GLint minfilter, magfilter;
|
GLint minfilter, magfilter;
|
||||||
GLfloat border_color[4];
|
GLfloat border_color[4];
|
||||||
|
|
||||||
|
#ifdef OPENGLES
|
||||||
|
if (true) {
|
||||||
|
#else
|
||||||
|
if (target != GL_TEXTURE_BUFFER) {
|
||||||
|
#endif
|
||||||
glGetTexParameteriv(target, GL_TEXTURE_WRAP_S, &wrap_u);
|
glGetTexParameteriv(target, GL_TEXTURE_WRAP_S, &wrap_u);
|
||||||
glGetTexParameteriv(target, GL_TEXTURE_WRAP_T, &wrap_v);
|
glGetTexParameteriv(target, GL_TEXTURE_WRAP_T, &wrap_v);
|
||||||
wrap_w = GL_REPEAT;
|
wrap_w = GL_REPEAT;
|
||||||
@ -12658,6 +12667,7 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
|
|||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
glGetTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, border_color);
|
glGetTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, border_color);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
GLenum page_target = target;
|
GLenum page_target = target;
|
||||||
if (target == GL_TEXTURE_CUBE_MAP) {
|
if (target == GL_TEXTURE_CUBE_MAP) {
|
||||||
@ -13122,6 +13132,11 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
|
|||||||
tex->set_component_type(type);
|
tex->set_component_type(type);
|
||||||
tex->set_format(format);
|
tex->set_format(format);
|
||||||
|
|
||||||
|
#ifdef OPENGLES
|
||||||
|
if (true) {
|
||||||
|
#else
|
||||||
|
if (target != GL_TEXTURE_BUFFER) {
|
||||||
|
#endif
|
||||||
tex->set_wrap_u(get_panda_wrap_mode(wrap_u));
|
tex->set_wrap_u(get_panda_wrap_mode(wrap_u));
|
||||||
tex->set_wrap_v(get_panda_wrap_mode(wrap_v));
|
tex->set_wrap_v(get_panda_wrap_mode(wrap_v));
|
||||||
tex->set_wrap_w(get_panda_wrap_mode(wrap_w));
|
tex->set_wrap_w(get_panda_wrap_mode(wrap_w));
|
||||||
@ -13129,7 +13144,8 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
|
|||||||
border_color[2], border_color[3]));
|
border_color[2], border_color[3]));
|
||||||
|
|
||||||
tex->set_minfilter(get_panda_filter_type(minfilter));
|
tex->set_minfilter(get_panda_filter_type(minfilter));
|
||||||
// tex->set_magfilter(get_panda_filter_type(magfilter));
|
//tex->set_magfilter(get_panda_filter_type(magfilter));
|
||||||
|
}
|
||||||
|
|
||||||
PTA_uchar image;
|
PTA_uchar image;
|
||||||
size_t page_size = 0;
|
size_t page_size = 0;
|
||||||
@ -13216,6 +13232,13 @@ extract_texture_image(PTA_uchar &image, size_t &page_size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef OPENGLES
|
||||||
|
} else if (target == GL_TEXTURE_BUFFER) {
|
||||||
|
// In the case of a buffer texture, we need to get it from the buffer.
|
||||||
|
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n));
|
||||||
|
_glGetBufferSubData(target, 0, image.size(), image.p());
|
||||||
|
#endif
|
||||||
|
|
||||||
} else if (compression == Texture::CM_off) {
|
} else if (compression == Texture::CM_off) {
|
||||||
// An uncompressed 1-d, 2-d, or 3-d texture.
|
// An uncompressed 1-d, 2-d, or 3-d texture.
|
||||||
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n));
|
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n));
|
||||||
|
@ -801,6 +801,7 @@ public:
|
|||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
PFNGLMAPBUFFERPROC _glMapBuffer;
|
PFNGLMAPBUFFERPROC _glMapBuffer;
|
||||||
PFNGLUNMAPBUFFERPROC _glUnmapBuffer;
|
PFNGLUNMAPBUFFERPROC _glUnmapBuffer;
|
||||||
|
PFNGLGETBUFFERSUBDATAPROC _glGetBufferSubData;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OPENGLES
|
#ifdef OPENGLES
|
||||||
|
@ -7411,6 +7411,9 @@ do_set_simple_ram_image(CData *cdata, CPTA_uchar image, int x_size, int y_size)
|
|||||||
*/
|
*/
|
||||||
int Texture::
|
int Texture::
|
||||||
do_get_expected_num_mipmap_levels(const CData *cdata) const {
|
do_get_expected_num_mipmap_levels(const CData *cdata) const {
|
||||||
|
if (cdata->_texture_type == Texture::TT_buffer_texture) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
int size = max(cdata->_x_size, cdata->_y_size);
|
int size = max(cdata->_x_size, cdata->_y_size);
|
||||||
if (cdata->_texture_type == Texture::TT_3d_texture) {
|
if (cdata->_texture_type == Texture::TT_3d_texture) {
|
||||||
size = max(size, cdata->_z_size);
|
size = max(size, cdata->_z_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user