Ok, can anyone see what the box is not showing up? I've tried everything i can think of to make it show up. It just not showing up....here is the code.
//Create the splanted boxes
int CExtendedBars::CreateSlantedBar(int X1, int Y1, int X2, int Y2)
{
SlantedBar[0].X = (float)X1;
SlantedBar[0].Y = (float)Y1;
SlantedBar[0].dwColor = g_pGlob->dwForeColor;
SlantedBar[1].X = (float)X2;
SlantedBar[1].Y = (float)Y1;
SlantedBar[1].dwColor = g_pGlob->dwForeColor;
SlantedBar[2].X = (float)X1;
SlantedBar[2].Y = (float)Y2;
SlantedBar[2].dwColor = g_pGlob->dwForeColor;
SlantedBar[3].X = (float)X2;
SlantedBar[3].Y = (float)Y2;
SlantedBar[3].dwColor = g_pGlob->dwForeColor;
ViewPort.X = 0;
ViewPort.Y = 0;
ViewPort.Width = g_pGlob->iScreenWidth;
ViewPort.Height = g_pGlob->iScreenHeight;
ViewPort.MinZ = 0.0f;
ViewPort.MaxZ = 1.0f;
dbGetDirect3DDevice()->SetViewport(&ViewPort);
HRESULT VertexBufferResult = dbGetDirect3DDevice()->CreateVertexBuffer(
4*sizeof(VERTICES),
0,
D3DFVF_SLANTEDBOX,
D3DPOOL_DEFAULT,
&VertexBuffer,
NULL);
if(FAILED(VertexBufferResult))
{
MessageBox(NULL, "Vertex Buffer can't be created.","Error",MB_OK);
return 0;
}
dbGetDirect3DDevice()->SetTexture(0,NULL);
dbGetDirect3DDevice()->SetTexture(1,NULL);
dbGetDirect3DDevice()->SetVertexShader(NULL);
dbGetDirect3DDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
dbGetDirect3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
dbGetDirect3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
dbGetDirect3DDevice()->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
void* temp;
VertexBuffer->Lock(0,sizeof(SlantedBar),(void**)&temp, 0);
memcpy(temp, SlantedBar,sizeof(VERTICES));
VertexBuffer->Unlock();
dbGetDirect3DDevice()->SetStreamSource(0,VertexBuffer,0,sizeof(VERTICES));
dbGetDirect3DDevice()->SetFVF(D3DFVF_SLANTEDBOX);
dbGetDirect3DDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
return 1;
}
this is the same code as this one that i have in another program and it works.
void Box(int x1, int y1, int x2, int y2, D3DCOLOR colorA, D3DCOLOR colorB, D3DCOLOR colorC, D3DCOLOR colorD)
{
TEXTVERT verts[4];
verts[0].x = (float)x1;
verts[0].y = (float)y1;
verts[0].Dwcolor = colorA;
verts[1].x = (float)x2;
verts[1].y = (float)y1;
verts[1].Dwcolor = colorB;
verts[2].x = (float)x1;
verts[2].y = (float)y2;
verts[2].Dwcolor = colorC;
verts[3].x = (float)x2;
verts[3].y = (float)y2;
verts[3].Dwcolor = colorD;
verts->view.X = 0;
verts->view.Y = 0;
verts->view.Width = SCREEN_WIDTH;
verts->view.Height = SCREEN_HEIGHT;
verts->view.MinZ = 0.0f;
verts->view.MaxZ = 1.0f;
d3ddev->SetViewport(&verts->view);
d3ddev->CreateVertexBuffer(
4*sizeof(TEXTVERT),
0,
D3DFVF_2D_VERTEX,
D3DPOOL_DEFAULT,
&verts->box_buffer,
NULL);
d3ddev->SetTexture(0, NULL);
d3ddev->SetTexture(1, NULL);
d3ddev->SetVertexShader(NULL);
d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3ddev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
d3ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
void* pVertices;
verts->box_buffer->Lock(0, sizeof(verts), (void**)&pVertices, 0);
memcpy(pVertices, verts, sizeof(verts));
verts->box_buffer->Unlock();
d3ddev->SetStreamSource(0,verts->box_buffer, 0, sizeof(TEXTVERT));
d3ddev->SetFVF(D3DFVF_2D_VERTEX);
d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
As you can see, it's the same, well except that one ioos part of a class and one is not
"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack