当前位置: 首页>>代码示例>>C++>>正文


C++ MYGUI_PLATFORM_ASSERT函数代码示例

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


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

示例1: destroy

	void DirectX11Texture::createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format)
	{
		destroy();

		D3D11_TEXTURE2D_DESC desc;
		desc.ArraySize = 1;
		desc.Width = mWidth = _width;
		desc.Height = mHeight = _height;
		desc.MipLevels = 1;
		desc.SampleDesc.Count = 1;
		desc.SampleDesc.Quality = 0;
		desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		desc.Usage = D3D11_USAGE_DEFAULT;
		if (_usage == TextureUsage::RenderTarget)
			desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
		else
			desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
		desc.CPUAccessFlags = 0;
		desc.MiscFlags = 0;
		HRESULT hr = mManager->mpD3DDevice->CreateTexture2D(&desc, 0, &mTexture);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Texture failed!");

		D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
		srvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
		srvDesc.Texture2D.MipLevels = 1;
		srvDesc.Texture2D.MostDetailedMip = 0;

		hr = mManager->mpD3DDevice->CreateShaderResourceView(mTexture, &srvDesc, &mResourceView);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Shader ResourceView failed!");
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:31,代码来源:MyGUI_DirectX11Texture.cpp

示例2: MYGUI_PLATFORM_ASSERT

	Vertex* OpenGLESVertexBuffer::lock()
	{
		MYGUI_PLATFORM_ASSERT(mBufferID, "Vertex buffer in not created");

		// Use glMapBuffer
		//glBindBufferARB(GL_ARRAY_BUFFER_ARB, mBufferID);
        glBindBuffer(GL_ARRAY_BUFFER, mBufferID);
        //CHECK_GL_ERROR_DEBUG();
        
        GLenum __error = glGetError();
        if(__error)
        {
            MYGUI_PLATFORM_LOG(Info, "OpenGL error " << __error << " in " << __FILE__<< " " << __FUNCTION__<< " "<< __LINE__);
        }
        assert(__error==0);

		// Discard the buffer
		//glBufferDataARB(GL_ARRAY_BUFFER_ARB, mSizeInBytes, 0, GL_STREAM_DRAW_ARB);
        glBufferData(GL_ARRAY_BUFFER, mSizeInBytes, 0, GL_STREAM_DRAW);
        CHECK_GL_ERROR_DEBUG();


		Vertex* pBuffer = (Vertex*)glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
        CHECK_GL_ERROR_DEBUG();

		MYGUI_PLATFORM_ASSERT(pBuffer, "Error lock vertex buffer");

		glBindBuffer(GL_ARRAY_BUFFER, 0);
        CHECK_GL_ERROR_DEBUG();

		return pBuffer;
	}
开发者ID:anyexxx,项目名称:mygui-openglesplatform,代码行数:32,代码来源:MyGUI_OpenGLESVertexBuffer.cpp

示例3: MYGUI_PLATFORM_ASSERT

	void OpenGLVertexBuffer::unlock()
	{
		MYGUI_PLATFORM_ASSERT(mBufferID, "Vertex buffer in not created");

		glBindBuffer(GL_ARRAY_BUFFER, mBufferID);
		GLboolean result = glUnmapBuffer(GL_ARRAY_BUFFER);
		glBindBuffer(GL_ARRAY_BUFFER, 0);

		MYGUI_PLATFORM_ASSERT(result, "Error unlock vertex buffer");
	}
开发者ID:Digmaster,项目名称:mygui,代码行数:10,代码来源:MyGUI_OpenGLVertexBuffer.cpp

示例4: MYGUI_PLATFORM_ASSERT

	void Cocos2dRenderManager::initialise()
	{
		CCDirector *pDirector = CCDirector::sharedDirector();
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		CCSize s = pDirector->getWinSizeInPixels();

		this->setPosition(0, 0);
		this->setContentSize(s);
		setViewSize(int(s.width), int(s.height));

		// 绑定到cocos2d节点
		pDirector->setNotificationNode(this);

		mInfo.pixWidth = s.width;
		mInfo.pixHeight = s.height;

		mVertexFormat = VertexColourType::ColourABGR;

		mUpdate = true;

		kmMat4 tmp;
		kmGLGetMatrix(KM_GL_PROJECTION, &tmp);
		kmMat4Inverse(&mMatrix, &tmp);

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;

		CCNotificationCenter::sharedNotificationCenter()->addObserver(this,
			callfuncO_selector(Cocos2dRenderManager::listenForeToBackground),
			EVENT_COME_TO_BACKGROUND,
			NULL);
		pDirector->getScheduler()->scheduleUpdateForTarget(this, kCCPriorityNonSystemMin, false);
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:35,代码来源:MyGUI_Cocos2dRenderManager.cpp

示例5: MYGUI_PLATFORM_ASSERT

	void DirectXRenderManager::initialise(IDirect3DDevice9* _device)
	{
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		mpD3DDevice = _device;

		mVertexFormat = VertexColourType::ColourARGB;

		memset(&mInfo, 0, sizeof(mInfo));
		if (mpD3DDevice != nullptr)
		{
			D3DVIEWPORT9 vp;
			mpD3DDevice->GetViewport(&vp);
			setViewSize(vp.Width, vp.Height);
		}

		mUpdate = false;

		if (mpD3DDevice != nullptr)
		{
			D3DCAPS9 caps;
			mpD3DDevice->GetDeviceCaps(&caps);
			if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
			{
				MYGUI_PLATFORM_LOG(Warning, "Non-squared textures not supported.");
			}
		}

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;
	}
开发者ID:chhawk,项目名称:MyGUI,代码行数:32,代码来源:MyGUI_DirectXRenderManager.cpp

示例6: mOldDepthStencil

	DirectX11RTTexture::DirectX11RTTexture( DirectX11Texture* _texture, DirectX11RenderManager* _manager ) :
		mOldDepthStencil(nullptr),
		mOldRenderTarget(nullptr),
		mTexture(_texture),
		mManager(_manager),
		mRenderTarget(nullptr)
	{
		int width = mTexture->getWidth();
		int height = mTexture->getHeight();

		mRenderTargetInfo.maximumDepth = 0.0f;
		mRenderTargetInfo.hOffset = 0.0f;
		mRenderTargetInfo.vOffset = 0.0f;
		mRenderTargetInfo.aspectCoef = float(height) / float(width);
		mRenderTargetInfo.pixScaleX = 1.0f / float(width);
		mRenderTargetInfo.pixScaleY = 1.0f / float(height);

		D3D11_RENDER_TARGET_VIEW_DESC desc;
		desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
		desc.Texture2D.MipSlice = 0;

		HRESULT hr = mManager->mpD3DDevice->CreateRenderTargetView(mTexture->mTexture, 0, &mRenderTarget);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Render Target View failed!");
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:25,代码来源:MyGUI_DirectX11RTTexture.cpp

示例7: glBindTexture

	void OpenGLTexture::unlock()
	{
		if (!mLock && mBuffer)
		{
			delete mBuffer;
			mBuffer = 0;

			glBindTexture(GL_TEXTURE_2D, 0);

			return;
		}

		MYGUI_PLATFORM_ASSERT(mLock, "Texture is not locked");

		// release the mapped buffer
		glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);

		// copy pixels from PBO to texture object
		// Use offset instead of ponter.
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mWidth, mHeight, mPixelFormat, GL_UNSIGNED_BYTE, 0);

		// it is good idea to release PBOs with ID 0 after use.
		// Once bound with 0, all pixel operations are back to normal ways.
		glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

		glBindTexture(GL_TEXTURE_2D, 0);

		mBuffer = 0;
		mLock = false;
	}
开发者ID:siangzhang,项目名称:starworld,代码行数:30,代码来源:MyGUI_OpenGLTexture.cpp

示例8: initialise

    void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene)
    {
        MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
        MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

        mColorBlendMode.blendType = Ogre::LBT_COLOUR;
        mColorBlendMode.source1 = Ogre::LBS_TEXTURE;
        mColorBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mColorBlendMode.operation = Ogre::LBX_MODULATE;

        mAlphaBlendMode.blendType = Ogre::LBT_ALPHA;
        mAlphaBlendMode.source1 = Ogre::LBS_TEXTURE;
        mAlphaBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mAlphaBlendMode.operation = Ogre::LBX_MODULATE;

        mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;

        mSceneManager = nullptr;
        mWindow = nullptr;
        mUpdate = false;
        mRenderSystem = nullptr;
        mActiveViewport = 0;

        Ogre::Root* root = Ogre::Root::getSingletonPtr();
        if (root != nullptr)
            setRenderSystem(root->getRenderSystem());
        setRenderWindow(_window);
        setSceneManager(_scene);


        MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
        mIsInitialise = true;
    }
开发者ID:Allxere,项目名称:openmw,代码行数:35,代码来源:manager.cpp

示例9: MYGUI_PLATFORM_ASSERT

	void DirectX11DataManager::initialise()
	{
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:8,代码来源:MyGUI_DirectX11DataManager.cpp

示例10: initialise

    void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene)
    {
        MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
        MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

        mColorBlendMode.blendType = Ogre::LBT_COLOUR;
        mColorBlendMode.source1 = Ogre::LBS_TEXTURE;
        mColorBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mColorBlendMode.operation = Ogre::LBX_MODULATE;

        mAlphaBlendMode.blendType = Ogre::LBT_ALPHA;
        mAlphaBlendMode.source1 = Ogre::LBS_TEXTURE;
        mAlphaBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mAlphaBlendMode.operation = Ogre::LBX_MODULATE;

        mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;

        mSceneManager = nullptr;
        mWindow = nullptr;
        mUpdate = false;
        mRenderSystem = nullptr;
        mActiveViewport = 0;

        Ogre::Root* root = Ogre::Root::getSingletonPtr();
        if (root != nullptr)
            setRenderSystem(root->getRenderSystem());
        setRenderWindow(_window);
        setSceneManager(_scene);

        // ADDED
        sh::MaterialInstance* mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
        mVertexProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                  ->getVertexProgram()->_getBindingDelegate();

        mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
        mVertexProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                   ->getVertexProgram()->_getBindingDelegate();

        mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
        mFragmentProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                    ->getFragmentProgram()->_getBindingDelegate();

        mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
        mFragmentProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                     ->getFragmentProgram()->_getBindingDelegate();



        MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
        mIsInitialise = true;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:57,代码来源:manager.cpp

示例11: createTexture

    ITexture* createTexture(const std::string& _name)
    {
        MapTexture::const_iterator item = mTextures.find(_name);
        MYGUI_PLATFORM_ASSERT(item == mTextures.end(), "Texture '" << _name << "' already exist");

        OgreTexture* texture = new OgreTexture(_name, OgreDataManager::getInstance().getGroup());
        mTextures[_name] = texture;
        return texture;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:9,代码来源:manager.cpp

示例12: MYGUI_PLATFORM_ASSERT

	ITexture* OpenGLRenderManager::createTexture(const std::string& _name)
	{
		MapTexture::const_iterator item = mTextures.find(_name);
		MYGUI_PLATFORM_ASSERT(item == mTextures.end(), "Texture '" << _name << "' already exist");

		OpenGLTexture* texture = new OpenGLTexture(_name, mImageLoader);
		mTextures[_name] = texture;
		return texture;
	}
开发者ID:IsemanTech,项目名称:mygui,代码行数:9,代码来源:MyGUI_OpenGLRenderManager.cpp

示例13: destroyTexture

    void destroyTexture(ITexture* _texture)
    {
        if (_texture == nullptr) return;

        MapTexture::iterator item = mTextures.find(_texture->getName());
        MYGUI_PLATFORM_ASSERT(item != mTextures.end(), "Texture '" << _texture->getName() << "' not found");

        mTextures.erase(item);
        delete _texture;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:10,代码来源:manager.cpp

示例14: sizeof

	bool DirectX11VertexBuffer::create()
	{
		D3D11_BUFFER_DESC desc;
		desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
		desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
		desc.MiscFlags = 0;
		desc.StructureByteStride = 0;
		desc.ByteWidth = sizeof(Vertex) * (mNeedVertexCount);
		desc.Usage = D3D11_USAGE_DYNAMIC;
		HRESULT hr = mManager->mpD3DDevice->CreateBuffer(&desc, 0, &mBuffer);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Buffer failed!");
		return hr == S_OK ? true : false;
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:13,代码来源:MyGUI_DirectX11VertexBuffer.cpp

示例15: MYGUI_PLATFORM_ASSERT

	void* OpenGLTexture::lock(TextureUsage _access)
	{
		MYGUI_PLATFORM_ASSERT(mTextureID, "Texture is not created");

		if (_access == TextureUsage::Read)
		{
			glBindTexture(GL_TEXTURE_2D, mTextureID);

			mBuffer = new unsigned char[mDataSize];
			glGetTexImage(GL_TEXTURE_2D, 0, mPixelFormat, GL_UNSIGNED_BYTE, mBuffer);

			mLock = false;

			return mBuffer;
		}

		// bind the texture
		glBindTexture(GL_TEXTURE_2D, mTextureID);
		if (!OpenGLRenderManager::getInstance().isPixelBufferObjectSupported())
		{
			//Fallback if PBO's are not supported
			mBuffer = new unsigned char[mDataSize];
		}
		else
		{
			// bind the PBO
			glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, mPboID);
			
			// Note that glMapBufferARB() causes sync issue.
			// If GPU is working with this buffer, glMapBufferARB() will wait(stall)
			// until GPU to finish its job. To avoid waiting (idle), you can call
			// first glBufferDataARB() with NULL pointer before glMapBufferARB().
			// If you do that, the previous data in PBO will be discarded and
			// glMapBufferARB() returns a new allocated pointer immediately
			// even if GPU is still working with the previous data.
			glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, mDataSize, 0, mUsage);

			// map the buffer object into client's memory
			mBuffer = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, mAccess);
			if (!mBuffer)
			{
				glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
				glBindTexture(GL_TEXTURE_2D, 0);
				MYGUI_PLATFORM_EXCEPT("Error texture lock");
			}
		}

		mLock = true;

		return mBuffer;
	}
开发者ID:podusowski,项目名称:rusted,代码行数:51,代码来源:MyGUI_OpenGLTexture.cpp


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