From 64203dcf87096d2f7f864a3effa4e15fb73502c4 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Jan 2009 21:06:22 +0000 Subject: [PATCH] various opencv and artoolkit fixes --- panda/src/grutil/arToolKit.cxx | 37 ++++++++++++++++++++---------- panda/src/grutil/openCVTexture.cxx | 5 ++-- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/panda/src/grutil/arToolKit.cxx b/panda/src/grutil/arToolKit.cxx index 8e08cc5bb8..7b500baee8 100644 --- a/panda/src/grutil/arToolKit.cxx +++ b/panda/src/grutil/arToolKit.cxx @@ -257,12 +257,12 @@ detach_patterns() { //////////////////////////////////////////////////////////////////// void ARToolKit:: analyze(Texture *tex) { - nassertv(tex->has_ram_image()); + //nassertv(tex->has_ram_image()); nassertv(tex->get_ram_image_compression() == Texture::CM_off); nassertv(tex->get_component_type() == Texture::T_unsigned_byte); nassertv(tex->get_texture_type() == Texture::TT_2d_texture); - - if (tex->get_num_components() != 4) { + + if (tex->get_num_components() != 4 && tex->get_num_components() != 3) { grutil_cat.error() << "ARToolKit can only analyze RGBA textures.\n"; return; } @@ -285,10 +285,22 @@ analyze(Texture *tex) { const unsigned char *ram = ri.p(); unsigned char *data = new unsigned char[xsize * ysize * 4]; int dstlen = xsize * 4; - int srclen = (xsize + padx) * 4; - for (int y=0; yget_num_components() == 3) { + int srclen = (xsize + padx) * 3; + for (int y=0; y