Original Post
I posted a few days ago about a shader problem, here i am again, same problem. The vertices dont change at all, i checked the values of offset they are correct.. heres the whole render function Im not sure if i should also be setting FVF too.. if i remove it i see nothing which makes sense since my vertex shader only copies over some vertex positions... so its gotta be there. Here is how i create the vshader (im confused at where the shader declaration goes, unless thats abandoned in dx9?) Any help appreciated!! Thanks!
bool CEnvironment::Render(CDevice *pDevice)
{
if(!pDevice)
{
return false;
}
HRESULT hr;
//set the vertex constants
float positionConstants[2];
positionConstants[0] = 0.9f;
positionConstants[1] = 0.9f;
//update the position
hr = pDevice->getDevicePtr()->SetVertexShaderConstantF(0, (float*)&positionConstants, 2);
if(FAILED(hr))
{
return false;
}
hr = pDevice->getDevicePtr()->SetVertexShader( pEnvShader );
if(FAILED(hr))
{
return false;
}
//render the world
std::vector<CEnvQuad*>::iterator envQuadItor = this->mpEnvQuads.begin();
for(envQuadItor; envQuadItor != mpEnvQuads.end(); envQuadItor++)
{
hr=pDevice->getDevicePtr()->SetStreamSource(0, (*envQuadItor)->mpLevelVertexBuffer, 0, sizeof(STexturedDiffuseVertex));
if(FAILED(hr))
{
return false;
}
hr=pDevice->getDevicePtr()->SetFVF(FVF_TexturedDiffuseVertex);
if(FAILED(hr))
{
return false;
}
hr=pDevice->getDevicePtr()->SetTexture(0,(*envQuadItor)->mpTexture);
if(FAILED(hr))
{
return false;
}
hr=pDevice->getDevicePtr()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
if(FAILED(hr))
{
return false;
}
}
return true;
}
//assemble the vertex shader
HRESULT hr = D3DXAssembleShader( env_shader_transform , sizeof(env_shader_transform), 0,
0 , NULL , &mpShaderBuff , &pBuff );
if(FAILED(hr))
{
DisplayError(DXGetErrorString9(hr));
DisplayError((char*)pBuff->GetBufferPointer());
}
//create the vertex shader from the assembled buffer
pDevice->getDevicePtr()->CreateVertexShader( (DWORD*)mpShaderBuff->GetBufferPointer(),
&pEnvShader);