MCPcopy Create free account
hub / github.com/MyGUI/mygui / create

Method create

Platforms/Ogre/OgrePlatform/src/MyGUI_OgreVertexBuffer.cpp:21–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 }
20
21 void OgreVertexBuffer::create()
22 {
23 mRenderOperation.vertexData = new Ogre::VertexData();
24 mRenderOperation.vertexData->vertexStart = 0;
25
26 Ogre::VertexDeclaration* vd = mRenderOperation.vertexData->vertexDeclaration;
27 vd->addElement(0, 0, Ogre::VET_FLOAT3, Ogre::VES_POSITION);
28 vd->addElement(0, Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3), Ogre::VET_COLOUR, Ogre::VES_DIFFUSE);
29 vd->addElement(
30 0,
31 Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3) + Ogre::VertexElement::getTypeSize(Ogre::VET_COLOUR),
32 Ogre::VET_FLOAT2,
33 Ogre::VES_TEXTURE_COORDINATES);
34
35 // Create the Vertex Buffer, using the Vertex Structure we previously declared in _declareVertexStructure.
36 mVertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(
37 mRenderOperation.vertexData->vertexDeclaration->getVertexSize(0), // declared Vertex used
38 mVertexCount,
39 Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
40 false);
41
42 // Bind the created buffer to the renderOperation object. Now we can manipulate the buffer, and the RenderOp keeps the changes.
43 mRenderOperation.vertexData->vertexBufferBinding->setBinding(0, mVertexBuffer);
44 mRenderOperation.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;
45 mRenderOperation.useIndexes = false;
46 }
47
48 void OgreVertexBuffer::destroy()
49 {

Callers 1

initialiseMethod · 0.45

Calls 1

createVertexBufferMethod · 0.45

Tested by

no test coverage detected