Original Post
Hi! I''m more used to Opengl than Direct 3D, and I have a little problem.
When creating textures in Opengl, I can create textures without need of files like .bmp, .jpg and stuff..
like this: gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width,height,GL_RGB,GL_UNSIGNED_BYTE,pData);
where pData is an array of bytes. (3 bytes is one pixel).
In D3D, I thought I should use D3DXCreateTexture to create a empty texture and D3DXFillTexture to fill it with the data.
(Correct me if I''m wrong..)
Later on, in the FillTexture func. I have to make my own fill function with a predefined parameterlist. But I don''t have a clue on how to make that function.
Here is what I thought.. But it won''t work.. Maybe I''m doin it totaly wrong or something.
VOID WINAPI fillFunc (D3DXVECTOR4* pOut, const D3DXVECTOR2* pTexCoord, const D3DXVECTOR2* pTexelSize, LPVOID pData)
{
static long pos = 0;
float r,g,b,a;
unsigned char* pImage = (unsigned char*)pData;
r = pImage[pos];
g = pImage[pos+1];
b = pImage[pos+2];
a = 0;
*pOut = D3DXVECTOR4(r,g,b,a);
pos +=3;
}
Please can someone help me?