这篇教程C++ CreateVertexBuffer函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CreateVertexBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateVertexBuffer函数的具体用法?C++ CreateVertexBuffer怎么用?C++ CreateVertexBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CreateVertexBuffer函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CreateVertexBufferSlider::Slider(Rect slider_rect, float _minValue, float _maxValue, float _value, char* slider_id, SliderStyle *slider_style){ if(slider_style == NULL) style = &gDefaultSliderStyle; else style = slider_style; id = slider_id; rect = slider_rect; screenRect = rect; D3DVIEWPORT9 viewPort = gEngine->GetDriver()->GetViewPort(0); screenRect.TransLate(viewPort.X, viewPort.Y); minValue = _minValue; maxValue = _maxValue; value = _value; if(value < minValue) value = minValue; if(value > maxValue) value = maxValue; CreateVertexBuffer();}
开发者ID:SinYocto,项目名称:Zee,代码行数:25,
示例2: bool eae6320::Graphics::Mesh::LoadGraphicsMeshData(){ o_direct3dDevice = eae6320::Graphics::GetLocalDirect3dDevice(); //o_vertexDeclaration = m_vertexDeclaration; //o_vertexBuffer = m_vertexBuffer; //o_indexBuffer = m_indexBuffer; //o_vertexData = m_vertexData; //o_indexData = m_indexData; //o_vertexCount = m_vertexCount; //o_indexCount = m_indexCount; if (!CreateVertexBuffer()) { return false; } if (!CreateIndexBuffer()) { return false; } return true;}
开发者ID:hardit826,项目名称:Game-Engineering-3,代码行数:25,
示例3: windowApplication::Application() : window(new Window(1280, 720, L"testerata!")), device(new D3D12Device(*window)), frameQueueIndex(0){ // Create a command allocator for every inflight-frame for (int i = 0; i < D3D12Device::MAX_FRAMES_INFLIGHT; ++i) { if (FAILED(device->GetD3D12Device()->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&commandAllocator[i])))) CRITICAL_ERROR("Failed to create command list allocator."); } // Create the command list. if (FAILED(device->GetD3D12Device()->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, commandAllocator[frameQueueIndex].Get(), pso.Get(), IID_PPV_ARGS(&commandList)))) CRITICAL_ERROR("Failed to create command list"); commandList->Close(); CreateRootSignature(); CreatePSO(); CreateVertexBuffer(); CreateTextures(); // Configure viewport and scissor rect. viewport.TopLeftX = 0.0f; viewport.TopLeftY = 0.0f; viewport.Width = static_cast<float>(window->GetWidth()); viewport.Height = static_cast<float>(window->GetHeight()); viewport.MinDepth = 0.0f; viewport.MaxDepth = 1.0f; scissorRect.left = 0; scissorRect.top = 0; scissorRect.right = static_cast<LONG>(window->GetWidth()); scissorRect.bottom = static_cast<LONG>(window->GetHeight());}
开发者ID:Wumpf,项目名称:d3d12gettingstartedplayground,代码行数:33,
示例4: DL_DEBUG void ParticleEmitterInstance::Initiate(ParticleEmitterData* someData, bool anAllowManyParticles) { myParticleEmitterData = someData; myEmitterPath = myParticleEmitterData->myFileName; int particleCount = static_cast<int>(myParticleEmitterData->myParticlesPerEmitt * myParticleEmitterData->myParticlesLifeTime / myParticleEmitterData->myEmissionRate) + 1; DL_DEBUG(("Loading :" + myEmitterPath).c_str()); DL_ASSERT_EXP(anAllowManyParticles == true || particleCount <= 201, "Can't have more than 201 particles in an emitter!"); myGraphicalParticles.Init(particleCount); myLogicalParticles.Init(particleCount); myEmissionTime = myParticleEmitterData->myEmissionRate; myDiffColor = (myParticleEmitterData->myData.myEndColor - myParticleEmitterData->myData.myStartColor) / myParticleEmitterData->myParticlesLifeTime; for (int i = 0; i < particleCount; ++i) { GraphicalParticle tempGraphics; myGraphicalParticles.Add(tempGraphics); LogicalParticle tempLogic; myLogicalParticles.Add(tempLogic); } myIsActive = myParticleEmitterData->myIsActiveAtStart; myShouldLive = myParticleEmitterData->myIsActiveAtStart; myEmitterLife = myParticleEmitterData->myEmitterLifeTime; CreateVertexBuffer(); }
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:32,
示例5: ARRAYSIZE void ProxyModel::Initialize() { // Load a compiled vertex shader std::string compiledVertexShader = Utility::LoadBinaryFile("Content//Shaders//BasicVS.cso"); Utility::ThrowIfFailed(mGame->GetD3DDevice()->CreateVertexShader(&compiledVertexShader[0], compiledVertexShader.size(), nullptr, mVertexShader.ReleaseAndGetAddressOf()), "ID3D11Device::CreatedVertexShader() failed."); // Load a compiled pixel shader std::string compiledPixelShader = Utility::LoadBinaryFile("Content//Shaders//BasicPS.cso"); Utility::ThrowIfFailed(mGame->GetD3DDevice()->CreatePixelShader(&compiledPixelShader[0], compiledPixelShader.size(), nullptr, mPixelShader.ReleaseAndGetAddressOf()), "ID3D11Device::CreatedPixelShader() failed."); // Create an input layout D3D11_INPUT_ELEMENT_DESC inputElementDescriptions[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; Utility::ThrowIfFailed(mGame->GetD3DDevice()->CreateInputLayout(inputElementDescriptions, ARRAYSIZE(inputElementDescriptions), &compiledVertexShader[0], compiledVertexShader.size(), mInputLayout.ReleaseAndGetAddressOf()), "ID3D11Device::CreateInputLayout() failed."); // Create constant buffers D3D11_BUFFER_DESC constantBufferDesc; ZeroMemory(&constantBufferDesc, sizeof(constantBufferDesc)); constantBufferDesc.ByteWidth = sizeof(mVertexCBufferPerObjectData); constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; Utility::ThrowIfFailed(mGame->GetD3DDevice()->CreateBuffer(&constantBufferDesc, nullptr, mVertexCBufferPerObject.ReleaseAndGetAddressOf()), "ID3D11Device::CreateBuffer() failed."); // Load a model std::unique_ptr<Model> model(new Model(*mGame, mModelFileName, true)); Mesh* mesh = model->Meshes().at(0); CreateVertexBuffer(mGame->GetD3DDevice(), *mesh, mVertexBuffer.ReleaseAndGetAddressOf()); mesh->CreateIndexBuffer(mIndexBuffer.ReleaseAndGetAddressOf()); mIndexCount = static_cast<UINT>(mesh->Indices().size()); }
开发者ID:CalWLee,项目名称:FIEAGraphicsDemo,代码行数:34,
示例6: Init bool Init() { Vector3f Pos(5.0f, 1.0f, -3.0f); Vector3f Target(0.0f, 0.0f, 1.0f); Vector3f Up(0.0, 1.0f, 0.0f); m_pGameCamera = new Camera(WINDOW_WIDTH, WINDOW_HEIGHT, Pos, Target, Up); CreateVertexBuffer(); m_pEffect = new LightingTechnique(); if (!m_pEffect->Init()) { printf("Error initializing the lighting technique/n"); return false; } m_pEffect->Enable(); m_pEffect->SetTextureUnit(0); m_pTexture = new Texture(GL_TEXTURE_2D, "../Content/test.png"); if (!m_pTexture->Load()) { return false; } return true; }
开发者ID:c14006078,项目名称:opengl,代码行数:30,
示例7: Allocate void Allocate(ID3D11Device *device, const int meshCount, const int *verticesPerMesh, const int *indicesPerMesh) override { int totalVertexCount = 0; int totalIndexCount = 0; for (int i = 0; i < meshCount; ++i) { totalVertexCount += verticesPerMesh[i]; totalIndexCount += indicesPerMesh[i]; } CreateVertexBuffer(device, totalVertexCount); CreateIndexBuffer(device, totalIndexCount); int indexOffset = 0; int vertexOffset = 0; for (int i = 0; i < meshCount; ++i) { meshes_.emplace_back(std::unique_ptr<StaticMesh>( new StaticMesh(verticesPerMesh[i], indicesPerMesh[i], i))); meshes_[i]->vertexBuffer = vertexBuffer_; meshes_[i]->vertexBufferSRV = vertexBufferSRV_; meshes_[i]->indexBuffer = indexBuffer_; meshes_[i]->indexBufferSRV = indexBufferSRV_; meshes_[i]->indexOffset = indexOffset; indexOffset += indicesPerMesh[i] * sizeof(int); meshes_[i]->vertexOffset = vertexOffset; vertexOffset += verticesPerMesh[i] * 3 * sizeof(float); } CreateMeshConstantsBuffer(device); }
开发者ID:GPUOpen-Effects,项目名称:GeometryFX,代码行数:35,
示例8: Init bool Init() { m_pGameCamera = new Camera(WINDOW_WIDTH, WINDOW_HEIGHT); CreateVertexBuffer(); CreateIndexBuffer(); m_pEffect = new LightingTechnique(); if (!m_pEffect->Init()) { return false; } m_pEffect->Enable(); m_pEffect->SetTextureUnit(0); m_pTexture = new Texture(GL_TEXTURE_2D, "../Content/test.png"); if (!m_pTexture->Load()) { return false; } return true; }
开发者ID:qunny0,项目名称:FTools,代码行数:26,
示例9: mainint main(int argc, char* argv[]){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(800, 600); glutInitWindowPosition(100, 100); glutCreateWindow("Tutorial 09"); GLenum res = glewInit(); if (res != GLEW_OK) { fprintf(stderr, "Error: '%s'/n", glewGetErrorString(res)); return 1; } glClearColor(0.8f, 0.3f, 0.1f, 1.0f); InitializeGlutCallbacks(); CreateVertexBuffer(); CompileShader(); glutMainLoop(); return 0;}
开发者ID:onerain88,项目名称:OGLDev,代码行数:28,
示例10: CreateVertexBuffervoid BasicShapes::CreateCube( _Out_ ID3D11Buffer **vertexBuffer, _Out_ ID3D11Buffer **indexBuffer, _Out_opt_ unsigned int *vertexCount, _Out_opt_ unsigned int *indexCount ){ CreateVertexBuffer( ARRAYSIZE(cubeVertices), cubeVertices, vertexBuffer ); if (vertexCount != nullptr) { *vertexCount = ARRAYSIZE(cubeVertices); } CreateIndexBuffer( ARRAYSIZE(cubeIndices), cubeIndices, indexBuffer ); if (indexCount != nullptr) { *indexCount = ARRAYSIZE(cubeIndices); }}
开发者ID:mbin,项目名称:Win81App,代码行数:27,
示例11: mainint main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(1024, 768); glutInitWindowPosition(100, 100); glutCreateWindow("Tutorial 02"); InitializeGlutCallbacks(); // Must be done after glut is initialized! GLenum res = glewInit(); if (res != GLEW_OK) { fprintf(stderr, "Error: '%s'/n", glewGetErrorString(res)); return 1; } glClearColor(0.0f, 0.0f, 0.0f, 0.0f); CreateVertexBuffer(); glutMainLoop(); return 0;}
开发者ID:MaxLingwei,项目名称:openGL,代码行数:25,
示例12: mainint main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA); glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT); glutInitWindowPosition(100, 100); glutCreateWindow("Homework 3: camera"); glutGameModeString("[email C++ CreateWaitableTimer函数代码示例 C++ CreateVPhysics函数代码示例
|