Jump to content
  • Advertisement

Sync Views

Member
  • Content Count

    303
  • Joined

  • Last visited

Community Reputation

139 Neutral

About Sync Views

  • Rank
    Member
  1. Sync Views

    Rendering to a surface, rather than screen

    ok I think i figured it out...So this should make me a managed texture with random tiling... IDirect3DSurface9 *RenderTarget=0, *TilesTmpSurface=0; IDirect3DTexture9 *TilesTmp=0; core->GetD3dDevice()->CreateTexture( (unsigned)core->GetWidth(),(unsigned)core->GetHeight(), NULL, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &TilesTmp, NULL); //set render target TilesTmp->GetSurfaceLevel(0, &TilesTmpSurface); core->GetD3dDevice()->GetRenderTarget(0, &RenderTarget); core->GetD3dDevice()->SetRenderTarget(0, TilesTmpSurface); //draw background to tmp core->GetD3dDevice()->BeginScene(); for(int y=0;y<(int)core->GetHeight()/32+1;++y) for(int x=0;x<(int)core->GetWidth()/32+1;++x) //DrawQuad( colID, texture, x,y, width,height, rotationZ) //colIds are used because colours currently have to be defined in the vertex buffer... white,gray,red,blue,green,yellow,oranage,cyan. the position arguments are used to set the world transform matrix core->DrawQuad(rand()%6+2, Tile, (float)x*32,(float)y*32, 32,32, 0); //restore render target core->GetD3dDevice()->EndScene(); core->GetD3dDevice()->SetRenderTarget(0, RenderTarget); RenderTarget->Release(); //create a blank background texture... core->GetD3dDevice()->CreateTexture( (unsigned)core->GetWidth (),(unsigned)core->GetHeight(), NULL, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &BackGround, NULL); //copy from tmp to background BackGround->GetSurfaceLevel(0,&BackGroundSurface); BackGroundSurface=0; D3DXLoadSurfaceFromSurface( BackGroundSurface,NULL,NULL, TilesTmpSurface, NULL, NULL, D3DX_DEFAULT, 0); BackGroundSurface->Release(); //cleanup, release memory TilesTmpSurface->Release(); TilesTmp->Release();
  2. Sync Views

    Rendering to a surface, rather than screen

    seem to have hit a wall :( "Textures created with D3DPOOL_DEFAULT are not lockable", "The new render-target surface must have at least D3DUSAGE_RENDERTARGET specified.", "D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT." So copying the bits from the render target, to a managed texture seems to not be possible, but I really don't want to render like 48*48 tiles every frame for the background, or have to recreate it on a lost device... { IDirect3DSurface9 *RenderTarget=0, *TileTmpSurface=0; IDirect3DTexture9 *TilesTmp=0; core->GetD3dDevice()->CreateTexture( (unsigned)(core->GetWidth ()+1)*32, (unsigned)(core->GetHeight()+1)*32, NULL, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &TilesTmp, NULL); //set target TilesTmp->GetSurfaceLevel(0, &TileTmpSurface); core->GetD3dDevice()->GetRenderTarget(0, &RenderTarget); core->GetD3dDevice()->SetRenderTarget(0, TileTmpSurface); TileTmpSurface->Release(); //draw background for(int y=0;y<(int)core->GetHeight()+1;++y) for(int x=0;x<(int)core->GetWidth()+1;++x) core->DrawQuad(rand()%6+2, Tile, (float)x*32,(float)y*32, 32,32, 0); //restore render target core->GetD3dDevice()->SetRenderTarget(0, RenderTarget); //create background texture... core->GetD3dDevice()->CreateTexture( (unsigned)(core->GetWidth ()+1)*32, (unsigned)(core->GetHeight()+1)*32, NULL, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &BackGround, NULL); //copy from tmp to background //...ok..what now... //release memory TilesTmp->Release(); }
  3. Sync Views

    Rendering to a surface, rather than screen

    Making them in advance insn't really an option, one other problem is that when ramdomly tiling something, I have to draw every single 32*32 square every frame...So I want to make these into a texture on level load (which is when the random tileing is determined, and placed ina n array anyways), so that I only have a single texture to render... I'll take a look at lock rect, Is there no built in function from copying from one type to another though?
  4. Using Direct3D9, how can I render to some kind of surface/texture, and then draw that. I looked at useing D3DDevice->CreateTexture and useing the render target useage so I can set it as a render target, but then it has to by a dynamic texture, which must be recreated for a lost device :( I want to create quite a large number of textures (eg, merging some things into a sprite sheet, like a ship plus whatever turret images it uses), so reduce the number of texture changes. So What I want to do it: Create a surface/texture for use as a render target Render to it Convert it to a texture with D3DPOOL_MANAGED, so I don't ned to recreate it after a lost device.
  5. Sync Views

    2d vector (maths, not STL) problem

    So would this be right? //this is a vector2 member method, normal is also a vector2 Vector2 tmp(-x, -y);//invert Vector2 projection = normal.scale(tmp.dot(normal))
  6. Quote: ...you found that the dot product gives you the magnitude of the projection, so the magnitude of P = -vi <bullet> N1. To get P to point in the same direction as the normal, you must multiply the magnitude of P by the normal, so the vector P = (-vi <bullet> N1) * N1, as shown in ... the i is just below and too the right, and the 1 is above and to the right, wasn't sure how to type them... P, v and N are vectors. Ok, i'm lost here because I don't see how this products a vector, since a dot product just returns a single number or what the * N' is meant to be....
  7. Sync Views

    pygame + SDL question

    It's still slow for soem things, and I know that SDL_init only needs once for both, the question is how can I have a surface that is both a python object, and useable from c++ (eg how can I get a pointer from the python object to the underlaying surface)
  8. Sync Views

    pygame + SDL question

    Inone of the projects I'm working in I'm useing python + pygame I need extra speed for some parts so wish to use a c++ dynamic libary The question is: is there a way to use the pygame SDL intstance, in c++ (So they can both draw to the same surface for example), or will I need a custom SDL wrapper DLL to allow such things?
  9. Sync Views

    image not drawing

    Quote:Original post by Gage64 A few things I noticed: 1) You're not specifying your vertices correctly (assuming you want the order to match the ascii drawing). It should be: v.push_back(dx::AdvObjectVertex(-50, 50,0, 0,0, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex( 50, 50,0, 1,0, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex( 50,-50,0, 1,1, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex(-50,-50,0, 0,1, 0xFF0000FF, 0)); isn't the screen like this thouh? - y | - --0-- + x | + Original post by Gage64 3) Make sure you are setting up the view matrix properly (i.e., make sure the camera is looking at the object). ...ok what should i set the view transform as for a starting point? Quote:Original post by Gage64 4) Are you using the debug runtimes? yes, with max debug output
  10. Sync Views

    image not drawing

    Ok this is the third day Ive looked at the same bit on non working code, and I really don't see the problem, and Direct3d isn't reporting any fail errors either :( I really have no idea where to start debugging code that seems to be correct when there no errors to at least give me a start... bool LibCore::D3dCreate() { if(!Wnd) { return false; } if(D3d) { return false; } D3d = Direct3DCreate9(D3D_SDK_VERSION); if(!D3d) { return false; } ZeroMemory(&D3dCaps, sizeof(D3dCaps)); if(FAILED(D3d->GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &D3dCaps))) { D3d->Release(); D3d = 0; return false; } //Setup present parameters D3DPRESENT_PARAMETERS D3dParams; ZeroMemory(&D3dParams, sizeof(D3dParams)); D3dParams.SwapEffect = D3DSWAPEFFECT_DISCARD; D3dParams.hDeviceWindow = Wnd; D3dParams.BackBufferCount = 1; D3dParams.EnableAutoDepthStencil = true; D3dParams.AutoDepthStencilFormat = D3DFMT_D16; D3DDISPLAYMODE d3ddm; RECT rWindow; if(!GetClientRect (Wnd, &rWindow)) { D3d->Release(); D3d = 0; return false; } //Get display mode D3d->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &d3ddm); //Setup backbuffer D3dParams.Windowed = true; D3dParams.BackBufferFormat = D3DFMT_A8R8G8B8; D3dParams.BackBufferWidth = rWindow.right - rWindow.left; D3dParams.BackBufferHeight = rWindow.bottom - rWindow.top; //Check if hardware vertex processing is available if (D3dCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) { //Create device with hardware vertex processing if(FAILED(D3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, Wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &D3dParams, &D3dDevice))) { D3d->Release(); D3d = 0; return false; } } else { //Create device with software vertex processing if(FAILED(D3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, Wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &D3dParams, &D3dDevice))) { D3d->Release(); D3d = 0; return false; } } D3DXMATRIX Projection; //set default projections D3DXMatrixOrthoLH(&Projection, (float)D3dParams.BackBufferHeight, (float)D3dParams.BackBufferHeight, 0, 1000000); D3dDevice->SetTransform(D3DTS_PROJECTION, &Projection); //Set vertex shader <-- not using any by default D3dDevice->SetVertexShader(NULL); D3dDevice->SetFVF(dx::VertexBasic::FVF); //Create vertex buffer and set as stream source D3dDevice->CreateVertexBuffer(sizeof(dx::VertexBasic) * 4, NULL, dx::VertexBasic::FVF, D3DPOOL_MANAGED, &VertexBufferBase, NULL); dx::VertexBasic* vb = NULL; VertexBufferBase->Lock(NULL,NULL, (void**)&vb, NULL); //quad vb[0] = dx::VertexBasic(-0.5,-0.5,0, 0,0, 0xFFFFFFFF); vb[1] = dx::VertexBasic( 0.5,-0.5,0, 1,0, 0xFFFFFFFF); vb[2] = dx::VertexBasic( 0.5, 0.5,0, 1,1, 0xFFFFFFFF); vb[3] = dx::VertexBasic(-0.5, 0.5,0, 0,1, 0xFFFFFFFF); VertexBufferBase->Unlock(); D3dDevice->SetStreamSource (0, VertexBufferBase, 0, sizeof(dx::VertexBasic)); //Setup rendering states D3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE); D3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); D3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE); D3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); D3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); D3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); D3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); //get pointer to render target D3dDevice->GetRenderTarget(0, &BackBuffer); //Successfully initalized Direct3D return true; } LibAdvObject::LibAdvObject(Core* _core, Texture* _tex, unsigned _icount, unsigned _vcount) : ib(0), vb(0), TriCount(_icount), VerCount(_vcount) { Owner = _core; Tex = _tex; } void LibAdvObject::Release() { SafeRelease(&vb); SafeRelease(&ib); SafeRelease(&Tex); delete this; } bool LibAdvObject::Render(const std::vector<fw::math::Matrix<4,4>> &Transforms) { //This will eventualy use a cutom vertex shader to link vertices to additional matrixces. //only changes them if there no already set ((LibCore*)Owner)->SetTex(((LibTexture*)Tex)->Tex); ((LibCore*)Owner)->SetVb (vb, sizeof(AdvObjectVertex)); ((LibCore*)Owner)->SetIb (ib); ((LibCore*)Owner)->D3dDevice->SetTransform(D3DTS_WORLD, &D3DXMATRIX((float*)&Transforms[0].m)); ((LibCore*)Owner)->D3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, VerCount, 0, TriCount); //4 vertices, 6 indexes //VerCount = 4, TriCount = 3 return true; } DLL AdvObject* AdvObjectCreate(Core* Owner, Texture* Tex, const std::vector<AdvObjectVertex> &Vertices, const std::vector<unsigned short> &Indexes) { LibAdvObject *Obj = new LibAdvObject(Owner,Tex, Indexes.size()/3, Vertices.size()); //VERTEX { ((LibCore*)Obj->Owner)->D3dDevice->CreateVertexBuffer( Vertices.size()*sizeof(AdvObjectVertex), D3DUSAGE_WRITEONLY, AdvObjectVertex::FVF, D3DPOOL_MANAGED, &Obj->vb, NULL); AdvObjectVertex* v=NULL; Obj->vb->Lock(0, 0, (void**)&v, NULL); std::vector<AdvObjectVertex>::const_iterator it = Vertices.begin(); while(it != Vertices.end())*v++ = *it++; Obj->vb->Unlock(); } //INDEX { ((LibCore*)Obj->Owner)->D3dDevice->CreateIndexBuffer( Indexes.size(), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &Obj->ib, NULL); unsigned short* i=NULL;//short == 16 bit == format Obj->ib->Lock(0, 0, (void**)&i, NULL); std::vector<unsigned short>::const_iterator it = Indexes.begin(); while(it != Indexes.end())*i++ = *it++; Obj->ib->Unlock(); } return Obj; } After d3d int dx::Texture* Tex = dx::TextureCreateFromFile(This, "circle.png"); //0-----1 //| / | //| / | //3-----2 std::vector<dx::AdvObjectVertex> v; v.push_back(dx::AdvObjectVertex(-50,-50,0, 0,0, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex( 50,-50,0, 1,0, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex( 50, 50,0, 1,1, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex(-50, 50,0, 0,1, 0xFF0000FF, 0)); std::vector<unsigned short> i; i.push_back(0); i.push_back(1); i.push_back(3); i.push_back(1); i.push_back(2); i.push_back(3); Circle = dx::AdvObjectCreate(This, Tex, v,i); Render D3dDevice->Clear(0,NULL,D3DCLEAR_TARGET,0xFF000000, 0, 0); D3dDevice->BeginScene(); math::Matrix<4,4> Mat; math::MatrixCreateTranslation(400,300,0, &Mat); std::vector<math::Matrix<4,4>> Transforms; Transforms.push_back(Mat); Circle->Render(Transforms); D3dDevice->EndScene(); D3dDevice->Present(NULL,NULL,NULL,NULL);
  11. Sync Views

    D3D9 problem

    ...I still havn't solved this, I see no reason why it shouldn't work...
  12. Sync Views

    D3D9 problem

    I have checked all my code again, but I still can't see why it isn't drawing, but I'm sure it's in one of those 6 code blocks...
  13. Sync Views

    D3D9 problem

    Ok. The errors gone but it's not rendering my test shape :( d3dint bool LibCore::D3dCreate() { if(!Wnd) { return false; } if(D3d) { return false; } D3d = Direct3DCreate9(D3D_SDK_VERSION); if(!D3d) { return false; } ZeroMemory(&D3dCaps, sizeof(D3dCaps)); if(FAILED(D3d->GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &D3dCaps))) { D3d->Release(); D3d = 0; return false; } //Setup present parameters D3DPRESENT_PARAMETERS D3dParams; ZeroMemory(&D3dParams, sizeof(D3dParams)); D3dParams.SwapEffect = D3DSWAPEFFECT_DISCARD; D3dParams.hDeviceWindow = Wnd; D3dParams.BackBufferCount = 1; D3dParams.EnableAutoDepthStencil = true; D3dParams.AutoDepthStencilFormat = D3DFMT_D16; D3DDISPLAYMODE d3ddm; RECT rWindow; if(!GetClientRect (Wnd, &rWindow)) { D3d->Release(); D3d = 0; return false; } //Get display mode D3d->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &d3ddm); //Setup backbuffer D3dParams.Windowed = true; D3dParams.BackBufferFormat = D3DFMT_A8R8G8B8; D3dParams.BackBufferWidth = rWindow.right - rWindow.left; D3dParams.BackBufferHeight = rWindow.bottom - rWindow.top; //Check if hardware vertex processing is available if (D3dCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) { //Create device with hardware vertex processing if(FAILED(D3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, Wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &D3dParams, &D3dDevice))) { D3d->Release(); D3d = 0; return false; } } else { //Create device with software vertex processing if(FAILED(D3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, Wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &D3dParams, &D3dDevice))) { D3d->Release(); D3d = 0; return false; } } D3DXMATRIX Projection; //set default projections D3DXMatrixOrthoLH(&Projection, (float)D3dParams.BackBufferHeight, (float)D3dParams.BackBufferHeight, 0, 1000000); D3dDevice->SetTransform(D3DTS_PROJECTION, &Projection); //Set vertex shader <-- not using any by default D3dDevice->SetVertexShader(NULL); D3dDevice->SetFVF(dx::VertexBasic::FVF); //Create vertex buffer and set as stream source D3dDevice->CreateVertexBuffer(sizeof(dx::VertexBasic) * 4, NULL, dx::VertexBasic::FVF, D3DPOOL_MANAGED, &VertexBufferBase, NULL); dx::VertexBasic* vb = NULL; VertexBufferBase->Lock(NULL,NULL, (void**)&vb, NULL); //quad vb[0] = dx::VertexBasic(-0.5,-0.5,0, 0,0, 0xFFFFFFFF); vb[1] = dx::VertexBasic( 0.5,-0.5,0, 1,0, 0xFFFFFFFF); vb[2] = dx::VertexBasic( 0.5, 0.5,0, 1,1, 0xFFFFFFFF); vb[3] = dx::VertexBasic(-0.5, 0.5,0, 0,1, 0xFFFFFFFF); VertexBufferBase->Unlock(); D3dDevice->SetStreamSource (0, VertexBufferBase, 0, sizeof(dx::VertexBasic)); //Setup rendering states D3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE); D3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); D3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE); D3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); D3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); D3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); D3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); //get pointer to render target D3dDevice->GetRenderTarget(0, &BackBuffer); //Successfully initalized Direct3D return true; } before loop dx::Texture* Tex = dx::TextureCreateFromFile(This, "circle.png"); //0-----1 //| / | //| / | //3-----2 std::vector<dx::AdvObjectVertex> v; v.push_back(dx::AdvObjectVertex(-50,-50,0, 0,0, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex( 50,-50,0, 1,0, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex( 50, 50,0, 1,1, 0xFF0000FF, 0)); v.push_back(dx::AdvObjectVertex(-50, 50,0, 0,1, 0xFF0000FF, 0)); std::vector<unsigned short> i; i.push_back(0); i.push_back(1); i.push_back(3); i.push_back(1); i.push_back(2); i.push_back(3); Circle = dx::AdvObjectCreate(This, Tex, v,i); render D3dDevice->Clear(0,NULL,D3DCLEAR_TARGET,0xFF000000, 0, 0); D3dDevice->BeginScene(); math::Matrix<4,4> Mat; math::MatrixCreateTranslation(400,300,0, &Mat); std::vector<math::Matrix<4,4>> Transforms; Transforms.push_back(Mat); Circle->Render(Transforms); D3dDevice->EndScene(); D3dDevice->Present(NULL,NULL,NULL,NULL); [Edited by - Sync Views on June 27, 2008 3:45:51 AM]
  14. Sync Views

    D3D9 problem

    Quote: LibAdvObject *Obj = new LibAdvObject(Owner,Tex, Indexes.size()/3, Vertices.size());
  15. Sync Views

    D3D9 problem

    I'm working on a class that can draw an entire object (eg a ship + it's turrets) in one go, and eventauly be able to batch several together but I'm getting this error in the render function :( Direct3D9: (ERROR) :Index stream does not have required number of indices. DrawIndexedPrimitive failed. LibAdvObject::LibAdvObject(Core* _core, Texture* _tex, unsigned _icount, unsigned _vcount) : ib(0), vb(0), TriCount(_icount), VerCount(_vcount) { Owner = _core; Tex = _tex; } void LibAdvObject::Release() { SafeRelease(&vb); SafeRelease(&ib); SafeRelease(&Tex); delete this; } bool LibAdvObject::Render(const std::vector<fw::math::Matrix<4,4>> &Transforms) { //This will eventualy use a cutom vertex shader to link vertices to additional matrixces. //only changes them if there no already set ((LibCore*)Owner)->SetTex(((LibTexture*)Tex)->Tex); ((LibCore*)Owner)->SetVb (vb, sizeof(AdvObjectVertex)); ((LibCore*)Owner)->SetIb (ib); ((LibCore*)Owner)->D3dDevice->SetTransform(D3DTS_WORLD, &D3DXMATRIX((float*)&Transforms[0].m)); ((LibCore*)Owner)->D3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, VerCount, 0, TriCount); //4 vertices, 6 indexes //VerCount = 4, TriCount = 3 return true; } DLL AdvObject* AdvObjectCreate(Core* Owner, Texture* Tex, const std::vector<AdvObjectVertex> &Vertices, const std::vector<unsigned short> &Indexes) { LibAdvObject *Obj = new LibAdvObject(Owner,Tex, Indexes.size()/3, Vertices.size()); //VERTEX { ((LibCore*)Obj->Owner)->D3dDevice->CreateVertexBuffer( Vertices.size()*sizeof(AdvObjectVertex), D3DUSAGE_WRITEONLY, AdvObjectVertex::FVF, D3DPOOL_MANAGED, &Obj->vb, NULL); AdvObjectVertex* v=NULL; Obj->vb->Lock(0, 0, (void**)&v, NULL); std::vector<AdvObjectVertex>::const_iterator it = Vertices.begin(); while(it != Vertices.end())*v++ = *it++; Obj->vb->Unlock(); } //INDEX { ((LibCore*)Obj->Owner)->D3dDevice->CreateIndexBuffer( Indexes.size(), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &Obj->ib, NULL); unsigned short* i=NULL;//short == 16 bit == format Obj->ib->Lock(0, 0, (void**)&i, NULL); std::vector<unsigned short>::const_iterator it = Indexes.begin(); while(it != Indexes.end())*i++ = *it++; Obj->ib->Unlock(); } return Obj; } Also. Since the index buffer values are smaller than the vertex buffers, Is there some way I can attach an additional value through the index buffer. Mainly the component id that will link a vertex to a matrix (So I don't need a set of vertices for every, quite likly identical turret, asnd also because it's lighter to have 20 repeats in the index buffer rather than the vertex buffer for batching multiple objects together. Or is the extra overhead of having additional vertices as well as additional indexes not worth worring about?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!