On Fri, Apr 2, 2010 at 5:50 PM, Josh Faust wrote: > On Fri, Apr 2, 2010 at 2:35 PM, Osiloke Emoekpere wrote: > >> Hi, >> *@josh ->* thanks for your reply and sorry for the caps >> Sorry if i appeared to come out strong, i was only trying to highlight the >> part i wanted >> to focus on (did not know i was offending anyone). The caps thing was of >> no relevance to the >> tone of "my voice". >> > > No worries, all caps is usually frowned upon on mailing lists/forums/etc., > now you know. > > >> >> i really like the operating system and i'm in the process of loving it. >> >> > Glad to hear it :) > > >> >> > >> like so >> in shape_marker.cpp >> The dummy image is created when shape_marker is created in the constructor >> >> std::stringstream ss; >> ss << "SHAPETEX-h" << name; >> texName = ss.str(); >> empty_image_.load("no_image.png", >> Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); >> * **// Create the texture* >> * ** **texture_ = Ogre::TextureManager::getSingleton().createManual(* >> * **texName, // name* >> * **Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,* >> * **Ogre::TEX_TYPE_2D, // type* >> * **256, 256, // width & height* >> * **0, // number of mipmaps* >> * **empty_image_.getFormat(), // pixel format* >> * **Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); // usage; should be >> TU_DYNAMIC_WRITE_ONLY_DISCARDABLE for* >> >> In order to load the image into the texture and then apply it to the >> shapes material, >> i do the following >> >> PLEASE NOTE: >> I also tried the blitfromemory to copy the image data to the texture >> (resulted in some garbled results and later caused a seg error) >> >> >> void ShapeMarker::setTexture(const Ogre::Image &img) >> { >> //I first deleted the existing texture if there was any >> if (!texture_.isNull()) >> { >> >> Ogre::TextureManager::getSingleton().remove((Ogre::ResourcePtr&)texture_); >> texture_.setNull(); >> } >> texture_ = Ogre::TextureManager::getSingleton().loadImage(texName, >> Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,img); >> //Then loaded the texture like so >> //texture_(new Ogre::Texture()); >> textured_=true; >> /// Testing. Apply Texture to Shape, i may be wrong here >> Ogre::TexturePtr text_or(tex); //i thought copying it makes a difference >> Ogre::MaterialPtr material_ = *shape_->getMaterial();//get material of >> already existing shape* >> material_->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); >> >> material_->getTechnique(0)->getPass(0)->createTextureUnitState(text_or->getName()); >> ROS_INFO("Texture Applied %s", text_or->getName().c_str()); >> } >> >> So these where the steps i took to try and create my system >> Any input and criticisms would be highly appreciated. >> > > I don't see anything blatantly wrong after a quick look through the code. >>> Does the "no image" texture also not show up, or just the dynamic one? >>> >> > * It shows the first image it receives, but subsequent tries to change the > image using the > same route to create continuous updates of the texture fails > > It just does not update, instead it segs faults sometimes. I don't know > where i'm crossing memory locations* > > If the "no image" texture also doesn't show up, the mesh you're using for >> the plane (are you just using a really flat box?) probably doesn't have >> texture coordinates on it -- you'd have to add them in a 3d modeling program >> or generate coordinates after it's loaded. >> > > For the plane, i am using an ogre 2d plane which i created as mesh on the > *ogre_tools::initialization* > > Josh > > > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users > >