X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglstate_images.cpp;h=7b0a42473fdf97cbc8c04ad4910247d078d4b2cf;hb=3801952b80cd7a7160f6410518f6e3740d461b60;hp=dc930a8039b8c816b785ab363f444c791d80b469;hpb=bd6b0c166872c38289375b7acb807ee790e87096;p=apitrace diff --git a/retrace/glstate_images.cpp b/retrace/glstate_images.cpp index dc930a8..7b0a424 100644 --- a/retrace/glstate_images.cpp +++ b/retrace/glstate_images.cpp @@ -24,11 +24,11 @@ **************************************************************************/ +#include #include #include #include -#include #include "image.hpp" #include "json.hpp" @@ -387,7 +387,6 @@ dumpActiveTextureLevel(JSONWriter &json, Context &context, GLenum target, GLint } char label[512]; - GLint active_texture = GL_TEXTURE0; glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); snprintf(label, sizeof label, "%s, %s, level = %d", @@ -395,8 +394,6 @@ dumpActiveTextureLevel(JSONWriter &json, Context &context, GLenum target, GLint json.beginMember(label); - json.beginObject(); - GLuint channels; GLenum format; if (!context.ES && isDepthFormat(desc.internalFormat)) { @@ -407,21 +404,6 @@ dumpActiveTextureLevel(JSONWriter &json, Context &context, GLenum target, GLint channels = 4; } - // Tell the GUI this is no ordinary object, but an image - json.writeStringMember("__class__", "image"); - - json.writeIntMember("__width__", desc.width); - json.writeIntMember("__height__", desc.height); - json.writeIntMember("__depth__", desc.depth); - - json.writeStringMember("__format__", formatToString(desc.internalFormat)); - - // Hardcoded for now, but we could chose types more adequate to the - // texture internal format - json.writeStringMember("__type__", "uint8"); - json.writeBoolMember("__normalized__", true); - json.writeIntMember("__channels__", channels); - image::Image *image = new image::Image(desc.width, desc.height*desc.depth, channels, true); context.resetPixelPackState(); @@ -434,15 +416,11 @@ dumpActiveTextureLevel(JSONWriter &json, Context &context, GLenum target, GLint context.restorePixelPackState(); - json.beginMember("__data__"); - std::stringstream ss; - image->writePNG(ss); - const std::string & s = ss.str(); - json.writeBase64(s.data(), s.size()); - json.endMember(); // __data__ + json.writeImage(image, formatToString(desc.internalFormat), desc.depth); delete image; - json.endObject(); + + json.endMember(); // label } @@ -854,23 +832,6 @@ dumpReadBufferImage(JSONWriter &json, GLint width, GLint height, GLenum format, Context context; - json.beginObject(); - - // Tell the GUI this is no ordinary object, but an image - json.writeStringMember("__class__", "image"); - - json.writeIntMember("__width__", width); - json.writeIntMember("__height__", height); - json.writeIntMember("__depth__", 1); - - json.writeStringMember("__format__", formatToString(internalFormat)); - - // Hardcoded for now, but we could chose types more adequate to the - // texture internal format - json.writeStringMember("__type__", "uint8"); - json.writeBoolMember("__normalized__", true); - json.writeIntMember("__channels__", channels); - GLenum type = GL_UNSIGNED_BYTE; #if DEPTH_AS_RGBA @@ -889,15 +850,9 @@ dumpReadBufferImage(JSONWriter &json, GLint width, GLint height, GLenum format, context.restorePixelPackState(); - json.beginMember("__data__"); - std::stringstream ss; - image->writePNG(ss); - const std::string & s = ss.str(); - json.writeBase64(s.data(), s.size()); - json.endMember(); // __data__ + json.writeImage(image, formatToString(internalFormat)); delete image; - json.endObject(); }