Original Post
I''d posted around this subject a few weeks ago, and hence i''ve found no solution to my problem, i thought i might check in again...
I use the D3D framework as provided by MS to setup D3D, etc...
Then i use a custom function to load some textures (some textures use alpha channel).
Then i use the following code to perform the rendering...
On some cards, including GeForce2 (MX 32MB), i get no output. However on some other cards, including Voodoo 3, i get the output i want. Any ideas???
void RendereLargeTexture(params....){
if(voi->alpha!=-1){
clr=RGBA_MAKE(255,255,255,(DWORD)(voi->alpha*255));
// if(voi->alpha!=0){
// Write2Log(err,": clr = 0x%x\n",clr);
// Write2Log(err,": Alpha = %f\n",voi->alpha);
// }
d3dDev->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
d3dDev->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
d3dDev->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
d3dDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
d3dDev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
}else{
clr=RGB_MAKE(255,255,255);
}
if(voi->useTrans) d3dDev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
float w,h;
for(DWORD i=0;i<voi->numofTiles;i++){
img=voi->tile[i];
w=img->percentW*voi->rW/100;
h=img->percentH*voi->rH/100;
setVertex(&v[0], img->rX[0], img->rY[0], 0, 1.0, clr, 0, img->tu[0], img->tv[0]);
setVertex(&v[1], img->rX[1], img->rY[1], 0, 1.0, clr, 0, img->tu[1], img->tv[1]);
setVertex(&v[2], img->rX[2], img->rY[2], 0, 1.0, clr, 0, img->tu[2], img->tv[2]);
setVertex(&v[3], img->rX[3], img->rY[3], 0, 1.0, clr, 0, img->tu[3], img->tv[3]);
DWORD rVal;
rVal=d3dDev->SetTexture(0,img->surface);
if(rVal!=DD_OK && rVal!=lastCode[0]){Write2Log(err,"SetTexture (%u)\n",rVal); lastCode[0]=rVal;}
rVal=d3dDev->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX, v,4,0);
if(rVal!=DD_OK && rVal!=lastCode[1]){Write2Log(err,"DrawPrimitive (%u)\n",rVal); lastCode[1]=rVal;}
}
if(voi->alpha!=-1) d3dDev->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
if(voi->useTrans) d3dDev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, FALSE);
}
|