Author Topic: DirectX9 - Problem with X8R8G8B8 and R5G6B5 format  (Read 4331 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
hi guys...
we have done our own small DX9 functions/engine... All seems to works fine... but there is one strange bug we are searching since days... some hours ago we found out where the bug happens... however, we dont understand nor know why this happens and how to fix this :( Maybe someone of you DX gurus here, may help us...)

Now let me explain the bug... We have a function to Create a new texture of any size and to load texture included inside the executeable... The other function is to Draw the texture on screen any resize it, if you wish/need...


a)
When creating a new blank 8x8 texture and draw this as 640x320 for example to the screen, the texture is not correct resized.... its a bit smaller as 640x320... This problem has been fixed now, but i am not sure if it is correct... because it seems to be a GDI bug?

To fill (color) the new created texture, we are using GDI atm... when the created texture ist 8x8, we used the API rect(0,0,8,8)... just for fun we tried to use  rect(0,0, 8+1, 8+1) ... also just adding +1 for the width and height (even if this is normaly not correct!?) ... when we use the trick with +1 , we can display the texture resized to 640x320 without any problems O.O Why? (we think its a GDI bug and we are thinking about doing the color fill on another way)

b)
Now the mainproblem that has cost us some years of life yet ^^ We can use any texture formats without any problem.... but when we are using textures in  X8R8G8B8 and R5G6B5 format, they will not correct (resized) shown... O.O    We have tried to install latest gfx drivers and tested on X1400, Radeon 9600  (latest drivers)... seems its not a driver related problem...

Someone an idea? Many thanks in advance!!!


- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
a) This is correct. The coordinates aren't x,y,width,height, they're left,top,right,bottom, and the help for FillRect() says
"When filling the specified rectangle, FillRect does not include the rectangle's right and bottom sides. GDI fills a rectangle up to, but not including, the right column and bottom row, regardless of the current mapping mode."

<edit> Having said, that, 0,0,8,8 should fill 0->7 x 0->7 inclusive...

b) How far off is it?  How are you drawing the rectangles?

If possibile, I'd be using IDirect3DDevice9::ColorFill() and IDirect3DDevice9::StretchRect().

Jim
« Last Edit: June 10, 2007 by Jim »
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
@Jim:
Thanks a lot....  we solved both problems....  We do not longer use the old API way and calculating +1 to fix the bug... (you are right with the 0-7 stuff... but this made problems... now we are doing this on another way and it works fine :)

The second problem has been fixed finally too... yeah... filter settings ^^
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: