If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
![]() |
|
|
#1 |
|
Junior Member
Join Date: Mar 2004
Location: Beijing, China
Posts: 73
|
IDirect3DTexture9 *texture;
D3DXCreateTexture(d3dDevice, width, height, 1, 0, D3DFMT_R32F, pool, &texture)); float Table[width * height]; for(unsigned int row = 0; row < height; row++) { for(unsigned int col = 0; col < width; col++) { Table[row * width + col] = (float)row / col; } } D3DLOCKED_RECT lockedRect; texture->LockRect(0, &lockedRect, NULL, 0); for(int j = 0; j < height; j++) { MemCopy((byte*)(lockedRect.pBits) + j * lockedRect.Pitch, &Table[j * width], width * sizeof(float)); } And then I look at the texels in PIX for Win, it appeard to be uv inverted. |
|
|
|
|
|
#2 |
|
AndyTX
Join Date: May 2004
Location: British Columbia, Canada
Posts: 1,840
|
They are "row"-major if you want to use that terminology. To be more general, texels are stored linearly along their X, Y then Z dimensions. (Arrays are similar, see docs.)
In your code, you should be computing it as: data[col * width + row]
__________________
The content of this message is my personal opinion only. |
|
|
|
|
|
#3 | |
|
Crazy coder
|
Quote:
But "col" is x and "row" is y, so his code looks correct to me and yours look wrong. |
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Mar 2004
Location: Beijing, China
Posts: 73
|
You're right. I got confused for a bit. Thanks.
|
|
|
|
|
|
#5 |
|
AndyTX
Join Date: May 2004
Location: British Columbia, Canada
Posts: 1,840
|
Oh whoops, yup of course you're right. Misread that.
__________________
The content of this message is my personal opinion only. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|