• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ogre::HardwarePixelBufferSharedPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ogre::HardwarePixelBufferSharedPtr的典型用法代码示例。如果您正苦于以下问题:C++ HardwarePixelBufferSharedPtr类的具体用法?C++ HardwarePixelBufferSharedPtr怎么用?C++ HardwarePixelBufferSharedPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了HardwarePixelBufferSharedPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: OnPaint

void RenderHandler::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height)
{
    Ogre::HardwarePixelBufferSharedPtr texBuf = m_texture->getBuffer();
    texBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD);
    memcpy(texBuf->getCurrentLock().data, buffer, width*height*4);
    texBuf->unlock();
}
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:7,代码来源:CefWindow.cpp


示例2: init

    void MiniMapMaker::init(void)
    {
        // 创建纹理
        Ogre::TexturePtr pTexture = Ogre::TextureManager::getSingleton().createManual(
            "RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D,
            mTexWidth, mTexHeight, 1, 0, mOutPutFormat,
            Ogre::TU_RENDERTARGET, 0);

        Ogre::HardwarePixelBufferSharedPtr pBuffer = pTexture->getBuffer(0, 0);

        mRenderTexture = pBuffer->getRenderTarget(0);
        {
            mCamera = mManipulator->getSceneManager()->createCamera("RttCam");

            // 设置摄像机的基本属性
            mCamera->setAspectRatio(1);
            mCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
            mCamera->setFOVy(Ogre::Degree(90));            

            _setCameraAttribute();

            Ogre::Viewport *v = mRenderTexture->addViewport( mCamera );
            v->setClearEveryFrame( true );
            v->setBackgroundColour( Ogre::ColourValue::Black );   
            v->setOverlaysEnabled(false);
            v->setSkiesEnabled(false);
            v->setShadowsEnabled(true);
        }
    }
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:30,代码来源:WXMiniMapMaker.cpp


示例3: _initTexture

//------------------------------------------------------------------------------
void OgreVideoTexture::_initTexture(Ogre::TexturePtr _texture)
{
    // Get the pixel buffer
    Ogre::HardwarePixelBufferSharedPtr pixelBuffer = _texture->getBuffer();

    // Lock the pixel buffer and get a pixel box
    pixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL); // for best performance use HBL_DISCARD!
    const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();

    Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);

    for (size_t j = 0; j < _texture->getHeight(); j++)
        for(size_t i = 0; i < _texture->getWidth() ; i++)
        {

            if (j<480-5 && i<640-5)
            {
                *pDest++ = 255; // B
                *pDest++ = 0; // G
                *pDest++ = 255; // R
            }
            else
            {
                *pDest++ = 255; // B
                *pDest++ = 0;   // G
                *pDest++ = 0; // R
            }
        }
 
        pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:32,代码来源:OgreVideoTexture.cpp


示例4: render

  void VideoVisual::render(const cv::Mat& image) 
  {

    // Fix image size if necessary
    const cv::Mat* image_ptr = &image;
    cv::Mat converted_image;
    if (image_ptr->rows != height_ || image_ptr->cols != width_) 
    {
      cv::resize(*image_ptr, converted_image, cv::Size(width_, height_));
      image_ptr = &converted_image;
    }

    // Get the pixel buffer
    Ogre::HardwarePixelBufferSharedPtr pixelBuffer = 
      this->texture_->getBuffer();

    // Lock the pixel buffer and get a pixel box
    pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
    const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
    uint8_t* pDest = static_cast<uint8_t*>(pixelBox.data);

    memcpy(pDest, image_ptr->data, height_ * width_ * 4);

    // Unlock the pixel buffer
    pixelBuffer->unlock();
  }
开发者ID:Aridane,项目名称:underwater_map_construction,代码行数:26,代码来源:gazebo_ros_video.cpp


示例5: PaintScrollImage

void HTML::PaintScrollImage(Ogre::HardwarePixelBufferSharedPtr pixelBuffer, const Berkelium::Rect& scrollOrigRect, int scroll_dx, int scroll_dy)
{

  Berkelium::Rect scrolledRect = scrollOrigRect.translate(scroll_dx, scroll_dy);

  Berkelium::Rect scrolled_shared_rect = scrollOrigRect.intersect(scrolledRect);
  // Only do scrolling if they have non-zero intersection
  if(scrolled_shared_rect.width() == 0 || scrolled_shared_rect.height() == 0)
    return;
  Berkelium::Rect shared_rect = scrolled_shared_rect.translate(-scroll_dx, -scroll_dy);

  size_t width = shared_rect.width();
  size_t height = shared_rect.height();

  Ogre::TexturePtr shadow = Ogre::TextureManager::getSingleton().createManual("scrollbuf", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, Ogre::Bitwise::firstPO2From(width), Ogre::Bitwise::firstPO2From(height), 1, 1, Ogre::PF_BYTE_BGRA);
  {
    Ogre::HardwarePixelBufferSharedPtr shadowBuffer = shadow->getBuffer();

    Berkelium::Rect borderedScrollRect = GetBorderedRect(shared_rect);
    Berkelium::Rect borderedScrolledRect = GetBorderedRect(scrolled_shared_rect);

    shadowBuffer->blit(pixelBuffer, Ogre::Box(borderedScrollRect.left(), borderedScrollRect.top(), borderedScrollRect.right(), borderedScrollRect.bottom()), Ogre::Box(0, 0, width, height));

    pixelBuffer->blit(shadowBuffer, Ogre::Box(0, 0, width, height), Ogre::Box(borderedScrolledRect.left(), borderedScrolledRect.top(), borderedScrolledRect.right(), borderedScrolledRect.bottom()));
  }

  Ogre::ResourcePtr shadowResource(shadow);
  Ogre::TextureManager::getSingleton().remove(shadowResource);

}
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:30,代码来源:HTML.cpp


示例6: _copyImagePerPixel

//------------------------------------------------------------------------------
void OgreVideoTexture::_copyImagePerPixel(const IplImage *_image
                                         ,Ogre::HardwarePixelBufferSharedPtr _pixelBuffer)
{
    // Lock the pixel buffer and get a pixel box
    _pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // for best performance use HBL_DISCARD!
    const Ogre::PixelBox& pixelBox = _pixelBuffer->getCurrentLock();

    Ogre::uint32* pDest = static_cast<Ogre::uint32*>(pixelBox.data);
    
    size_t w, h, widthStep;
    w = _image->width;
    h = _image->height;
    widthStep = _image->widthStep;

    Ogre::uint32 pixelBGRA;
    for(size_t i=0 ; i < h ; i++)
    {
        size_t offset = i*widthStep;
        for (size_t j=0 ; j < w ; j++)
        {
            memcpy(&pixelBGRA, _image->imageData + offset +j*3, sizeof(Ogre::uint32));            
            pDest[i *1024 + j] = pixelBGRA;            
        }
    }
   
    _pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:28,代码来源:OgreVideoTexture.cpp


示例7: _copyImagePerChannel

//------------------------------------------------------------------------------
void OgreVideoTexture::_copyImagePerChannel(const IplImage *_image
                                         ,Ogre::HardwarePixelBufferSharedPtr _pixelBuffer)
{

    // Lock the pixel buffer and get a pixel box
    _pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // for best performance use HBL_DISCARD!
    const Ogre::PixelBox& pixelBox = _pixelBuffer->getCurrentLock();

    
    Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);


    for (size_t j = 0; j < _image->height; j++)
        for(size_t i = 0; i < _image->width ; i++)
        {
            char pixelR = CV_IMAGE_ELEM(_image, char, j, i*3+2 );
            char pixelG = CV_IMAGE_ELEM(_image, char, j, i*3+1);
            char pixelB = CV_IMAGE_ELEM(_image, char, j, i*3 );

            int w = mVideoTexture->getWidth();

            pDest[j*1024*4 + i*4]   = pixelB;
            pDest[j*1024*4 + i*4+1] = pixelG;
            pDest[j*1024*4 + i*4+2] = pixelR;
            //pDest[j*w*4 + i*4+3] = 255;
        }

    _pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:30,代码来源:OgreVideoTexture.cpp


示例8: video_display

void video_display(VideoState *is)
{
  VideoPicture *vp;

  vp = &is->pictq[is->pictq_rindex];

  if (is->video_st->codec->width != 0 && is->video_st->codec->height != 0)
  {
    Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton ().getByName("VideoTexture");
    if (texture.isNull () || texture->getWidth() != is->video_st->codec->width || texture->getHeight() != is->video_st->codec->height)
    {
      Ogre::TextureManager::getSingleton ().remove ("VideoTexture");
      texture = Ogre::TextureManager::getSingleton().createManual(
                  "VideoTexture",
                  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                  Ogre::TEX_TYPE_2D,
                  is->video_st->codec->width, is->video_st->codec->height,
                  0,
                  Ogre::PF_BYTE_RGBA,
                  Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
    }
    Ogre::PixelBox pb(is->video_st->codec->width, is->video_st->codec->height, 1, Ogre::PF_BYTE_RGBA, vp->data);
    Ogre::HardwarePixelBufferSharedPtr buffer = texture->getBuffer();
    buffer->blitFromMemory(pb);
  }

  free(vp->data);
}
开发者ID:pdpdds,项目名称:Win32OpenSourceSample,代码行数:28,代码来源:VideoPlayer.cpp


示例9: _updateVolTextureData

	void DataManager::_updateVolTextureData(Cell ***c, const VolTextureId& TexId, const int& nx, const int& ny, const int& nz)
	{
		Ogre::HardwarePixelBufferSharedPtr buffer = mVolTextures[TexId]->getBuffer(0,0);
		
		buffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
		const Ogre::PixelBox &pb = buffer->getCurrentLock();

		Ogre::uint32 *pbptr = static_cast<Ogre::uint32*>(pb.data);
		size_t x, y, z;

		for (z=pb.front; z<pb.back; z++) 
        {
            for (y=pb.top; y<pb.bottom; y++)
            {
                for (x=pb.left; x<pb.right; x++)
				{
					Ogre::PixelUtil::packColour(c[x][y][z].dens/* TODO!!!! */, c[x][y][z].light, 0, 0, pb.format, &pbptr[x]);
                } 
                pbptr += pb.rowPitch;
            }
            pbptr += pb.getSliceSkip();
        }

		buffer->unlock();
	}
开发者ID:coldelectrons,项目名称:fortressoverseer,代码行数:25,代码来源:DataManager.cpp


示例10: onPaint

/**
 * @inheritDoc.
 */
void BrowserWindow::onPaint(Berkelium::Window *win, const unsigned char *sourceBuffer, const Berkelium::Rect &sourceBufferRect, size_t numCopyRects, const Berkelium::Rect *copyRects, int dx, int dy, const Berkelium::Rect &scrollRect) {
    const Ogre::HardwarePixelBufferSharedPtr textureBuffer = m_texture->getBuffer();
    const Ogre::PixelBox srcBox = Ogre::PixelBox(rectToBox(sourceBufferRect), Ogre::PF_BYTE_BGRA, const_cast<unsigned char*>(sourceBuffer));

    for(int i = 0; i < numCopyRects; i++) {
        const Ogre::Box destBox = rectToBox(copyRects[i]);
        textureBuffer->blitFromMemory(srcBox.getSubVolume(destBox), destBox);
    }
}
开发者ID:Kissy,项目名称:shoot-em-up-project,代码行数:12,代码来源:BrowserWindow.cpp


示例11: _updateNormalMap

	bool TextureManager::_updateNormalMap(Image &Image)
	{
		if (!mCreated)
		{
			HydraxLOG("Error in TextureManager::_updateNormalMap, create() does not called.");

			return false;
		}

		if (Image.getType() != Image::TYPE_RGB)
		{
			HydraxLOG("Error in TextureManager::_updateNormalMap, Image type isn't correct.");

			return false;
		}

		Ogre::TexturePtr &Texture = getTexture(TEX_NORMAL_ID);

		Size ImageSize = Image.getSize();
		
		if (Texture->getWidth()  != ImageSize.Width ||
			Texture->getHeight() != ImageSize.Height)
		{
			HydraxLOG("Error in TextureManager::update, Update size doesn't correspond to " + getTextureName(TEX_NORMAL_ID) + " texture size");

			return false;
		}

		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = Texture->getBuffer();

        pixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL);
        const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();

        Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);

        int x, y;

        for (x = 0; x < ImageSize.Width; x++)
        {
            for (y = 0; y < ImageSize.Height; y++)
            {
                *pDest++ =   Image.getValue(x,y,2); // B
                *pDest++ =   Image.getValue(x,y,1); // G
                *pDest++ =   Image.getValue(x,y,0); // R
				*pDest++ =   255;                   // A
            }
        }

        pixelBuffer->unlock();

		return true;
	}
开发者ID:DDeimos,项目名称:DeimosSpace,代码行数:52,代码来源:TextureManager.cpp


示例12: update

bool OgreARAppLogic::update(Ogre::Real deltaTime)
{
	if (!pause) {
		if( !userUpdate(this)) return false; // call user-defined funcions

		// update background image
		if (!mTexture.isNull())
		{
			//Pedimos a ogre que actualice la imagen desde el PixelBox
			Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
			pixelBuffer->blitFromMemory(mPixelBox);
		}	  	  
	}

	bool result = processInputs(deltaTime);
	return result;
}
开发者ID:Dymanik,项目名称:anarcards,代码行数:17,代码来源:OgreARAppLogic.cpp


示例13: Rectangle

void SourceTexture::Rectangle(int x, int y, int width, int height, unsigned long color)
{
	Ogre::HardwarePixelBufferSharedPtr pixelBuffer = m_spTexture->getBuffer();
	pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
	const Ogre::PixelBox& pixelbox = pixelBuffer->getCurrentLock();
	/*unsigned int dstBpp = Ogre::PixelUtil::getNumElemBytes(pixelbox.format);
	unsigned int dstPitch = pixelbox.rowPitch * dstBpp;*/
	unsigned char *pImage = static_cast<unsigned char*>(pixelbox.data);
	
	int dst_width = pixelbox.getWidth();

	unsigned char *pTmp = pImage + ( ( y*m_nWidth) + x )*4;
	for(int i = 0 ; i < width ; i++, pTmp += 4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	pTmp = pImage + ( ( (y+height-1)*m_nWidth) + x )*4;
	for(int i = 0 ; i < width ; i++, pTmp += 4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	pTmp = pImage + ( ( y*m_nWidth) + x )*4;
	for(int i = 0 ; i < height ; i++, pTmp += m_nWidth*4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	pTmp = pImage + ( ( y*m_nWidth) + x+width-1 )*4;
	for(int i = 0 ; i < height ; i++, pTmp += m_nWidth*4)
	{
		*(pTmp+0) = (unsigned char)(color >> 16);
		*(pTmp+1) = (unsigned char)(color >> 8);
		*(pTmp+2) = (unsigned char)(color);
		*(pTmp+3) = 255;
	}
	//m_spImageData->SetFlag(NxImageData::UPDATE_PIXEL);
}
开发者ID:oksangman,项目名称:Ant,代码行数:45,代码来源:SourceTexture.cpp


示例14: renderIntoTexture

	void UiManager::renderIntoTexture(const Ogre::TexturePtr &aTexture)
	{
		assert(!aTexture.isNull());
		assert(isViewSizeMatching(aTexture));
		
		Ogre::HardwarePixelBufferSharedPtr hwBuffer = aTexture->getBuffer(0, 0);
		hwBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
		
		const Ogre::PixelBox &pb = hwBuffer->getCurrentLock();
		
		// render into texture buffer
		QImage textureImg((uchar *)pb.data, pb.getWidth(), pb.getHeight(), QImage::Format_ARGB32);
		textureImg.fill(0);
		
		QPainter painter(&textureImg);
		mWidgetView->render(&painter, QRect(QPoint(0, 0), mWidgetView->size()), QRect(QPoint(0, 0), mWidgetView->size()));
		
		hwBuffer->unlock();
	}
开发者ID:advancingu,项目名称:Cutexture,代码行数:19,代码来源:UiManager.cpp


示例15: _copyImagePerLine

//------------------------------------------------------------------------------
void OgreVideoTexture::_copyImagePerLine(const IplImage *_image
                                        ,Ogre::HardwarePixelBufferSharedPtr _pixelBuffer)
{

    // Lock the pixel buffer and get a pixel box
    _pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // for best performance use HBL_DISCARD!
    const Ogre::PixelBox& pixelBox = _pixelBuffer->getCurrentLock();

    //Ogre::uint32* pDest = static_cast<Ogre::uint32*>(pixelBox.data);
    Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);

    for (size_t i = 0 ; i < _image->height ; i++)
    {
    memcpy(pDest + i*1024*4
          , (_image->imageData) +   i*_image->width * 3
          , _image->width * 3);
    }

    _pixelBuffer->unlock();
}
开发者ID:sevas,项目名称:ogre-videocanvas,代码行数:21,代码来源:OgreVideoTexture.cpp


示例16: Paint

void HTML::Paint(Ogre::HardwarePixelBufferSharedPtr pixelBuffer, const unsigned char*srcBuffer, const Berkelium::Rect& srcRect, size_t num_copy_rects, const Berkelium::Rect *copy_rects)
{
  /**/
  const Ogre::PixelBox srcBox = Ogre::PixelBox(ToBox(srcRect), Ogre::PF_BYTE_BGRA, const_cast<unsigned char*>(srcBuffer));

  for(unsigned int i = 0; i < num_copy_rects; i++)
  {
    const Ogre::Box destBox = ToBox(copy_rects[i]);
    pixelBuffer->blitFromMemory(srcBox.getSubVolume(destBox), destBox);
  }

}
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:12,代码来源:HTML.cpp


示例17: UpdateColorDepthTexture

bool KinectDevice::UpdateColorDepthTexture()
{
	bool updated = false;

	if (!mColorTexture.isNull() && mColorTextureAvailable)
	{
		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mColorTexture->getBuffer();
		pixelBuffer->blitFromMemory(mColorPixelBox);
		mColorTextureAvailable = false;
		updated = true;
	}
	if (!mDepthTexture.isNull() && mDepthTextureAvailable)
	{
		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mDepthTexture->getBuffer();
		pixelBuffer->blitFromMemory(mDepthPixelBox);
		mDepthTextureAvailable = false;
		updated = true;
	}
	if (!mColoredDepthTexture.isNull()&& mColoredDepthTextureAvailable)
	{
		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mColoredDepthTexture->getBuffer();
		pixelBuffer->blitFromMemory(mColoredDepthPixelBox);		
		mColoredDepthTextureAvailable = false;
		updated = true;
	}

	return updated;
}
开发者ID:zphilip,项目名称:KinectOgreAR,代码行数:28,代码来源:KinectDevice.cpp


示例18: mView

	//-----------------------------------------------------------------------
	CoherentUIView::CoherentUIView(Ogre::CoherentUIViewListener* listener, int width, int height, bool enableDepthWrite)
		: mView(NULL)
	{
		mViewListener = OGRE_NEW CoherentUIViewListenerBridge(this, listener);

		static int _textureCounter = 0;
		Ogre::StringStream ss;
		ss << "CoherentDynamicTexture" << ++_textureCounter;
		Ogre::String textureName = ss.str();
		ss << "_Mat";
		Ogre::String materialName = ss.str();

		// Create a texture
		mTexture = TextureManager::getSingleton().createManual(
			textureName,
			ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
			TEX_TYPE_2D,
			width,
			height,
			1,
			PF_BYTE_BGRA,
			TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);

		// Clear the texture
		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
		pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
		const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
		Ogre::uint32* dest = static_cast<Ogre::uint32*>(pixelBox.data);
		std::memset(dest, 0, (width * 4 + pixelBox.getRowSkip()) * height);
		pixelBuffer->unlock();

		// Create a material using the texture
		mTextureMaterial = MaterialManager::getSingleton().create(
			materialName,
			ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

		mTextureMaterial->getTechnique(0)->getPass(0)->createTextureUnitState(textureName);
		mTextureMaterial->getTechnique(0)->getPass(0)->setSceneBlending(SBF_ONE, SBF_ONE_MINUS_SOURCE_ALPHA);
		mTextureMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(enableDepthWrite);
	}
开发者ID:CoherentLabs,项目名称:CoherentUI_Ogre3D,代码行数:41,代码来源:CoherentUIView.cpp


示例19: cleanTextureContents

    void DirectShowMovieTexture::cleanTextureContents()
    {
        unsigned int idx;
        int x, y;
 
        // OGRE TEXTURE LOCK
        // get the texture pixel buffer
        int texw=mTexture->getWidth();
        int texh=mTexture->getHeight();
        Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
 
        // lock the pixel buffer and get a pixel box
        pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
        const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
 
        Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);
 
        // FILL!
        for (x=0, y=0; y<texh; ){
            idx=(x*4)+y*pixelBox.rowPitch*4;
 
            // paint
            pDest[idx]=0;//b
            pDest[idx+1]=0;//g
            pDest[idx+2]=0;//r
            pDest[idx+3]=255;//a
 
            x++;
            if (x>=texw)
            {
                x=0;
                y++;
            }
        }
 
        // UNLOCK EVERYTHING!
        // unlock the pixel buffer
        pixelBuffer->unlock();
        // OGRE END
    }
开发者ID:robinbattle,项目名称:Knockout,代码行数:40,代码来源:UtilsOgreDShow.cpp


示例20: test

void test(const std::vector<std::vector<TxzFileSerializer::rgba>>& data)
{
    //Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().load("clf_l.png.png", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);


    // kWorldResourceGroup

    Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual("BackgroundTex",
                                                                                 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                                                                                 Ogre::TEX_TYPE_2D,
                                                                                 640, 256, 0,
                                                                                 Ogre::PF_B8G8R8, Ogre:: TU_DYNAMIC);

    Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("BackgroundMat",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

    material->getTechnique(0)->getPass(0)->createTextureUnitState("BackgroundTex");



    //material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_COLOUR);


    Ogre::HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
    pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
    const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
    Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);
    for(size_t i=0; i < 256; i++)
    {
       for(size_t j=0; j < 640; j++)
       {
          *pDest++ = data[i][j].b;
          *pDest++ = data[i][j].g;
          *pDest++ = data[i][j].r;
          *pDest++ = 0;
       }
    }

    pixelBuffer->unlock();
}
开发者ID:adrielvel,项目名称:q-gears,代码行数:39,代码来源:WorldMapModule.cpp



注:本文中的ogre::HardwarePixelBufferSharedPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ogre::HardwareVertexBufferSharedPtr类代码示例发布时间:2022-05-31
下一篇:
C++ ogre::HardwareIndexBufferSharedPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap