c++ - DirectX - Drawing with GDI on a IDirect3DTexture9 -
i trying draw text using gdi textouta
on idirect3dtexture9 dont see on screen.
here code:
hfont pfont = createfonta(-10 * nlogpixelsy / 72, 0, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, "arial"); idirect3dtexture9* pfonttex = null; pdxdevice->createtexture(100, 100, 1, 0, d3dfmt_x8r8g8b8, d3dpool_managed, &pfonttex, null); //////////////////////////// idirect3dsurface9* ppsurface = null; hdc mdc = null; if (pfonttex->getsurfacelevel(0, &ppsurface) == d3d_ok) { if (ppsurface->getdc(&mdc) == d3d_ok) { selectobject(mdc, pfont); settextcolor(mdc, 0x00ff00ff); setbkmode(mdc, transparent); textouta(mdc, 0, 0, "test", 4); //messageboxa(0, "work", 0, 0); ppsurface->releasedc(mdc); } ppsurface->release(); } pdxdevice->settexture(0, pfonttex); pdxdevice->setrenderstate(d3drs_alphatestenable, true); pdxdevice->setrenderstate(d3drs_alphafunc, d3dcmp_greaterequal); pdxdevice->setrenderstate(d3drs_alpharef, 0x01); pdxdevice->drawprimitive(d3dpt_trianglefan, 0, 2);
Comments
Post a Comment