Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Bug #436: GetTextureDC bug
Product:
TV3D SDK 6.5
Language:
Delphi
Current State:
Closed
Resolution:
Fixed
Created On:
June 25th, 2005
Last Modified:
June 30th, 2005
Reported By:
Vortex
t := Texture.LoadTexture(...
dci := Texture.GetTextureDC (t);
showmessage (inttostr (dci)); - this returns DC handle OK

BUT

t := Texture.LoadTexture(...
dci := Texture.GetTextureDC (t);
dci := Texture.GetTextureDC (t);
showmessage (inttostr (dci)); - this returns ZERO!

also

t := Texture.CreateTexture (...
Texture.LockTexture (t, false);
dco := Texture.GetTextureDC (t);

dco always zero.

Comments:

Posted by SylvainTV on June 27th, 2005 at 7:39 PM
Could you check the debug file output?

I think both are normal.

You can't GetDC on something twice. You have to ReleaseDC :)

GetDC
REleaseDC
GetDC
etc...

About the locking, GetDC is doing an internal lock, so.. you must ReleaseDC before locking :) I will add more debug information though.
Posted by Vortex on June 27th, 2005 at 10:01 PM
Oh, sorry for my stupidity on first problem, but second still remains:

my code:

t := Texture.CreateTexture (64, 64, false, 'test');
dc := Texture.GetTextureDC (t);
Texture.ReleaseTextureDC (t, false);

dc is zero. this is my log:

06-27-2005 23:59:41 | TEXTURE MANAGER : Creation of texture 'test' succeeded, format 21, size (64x64)
06-27-2005 23:59:41 | TEXTURE MANAGER : GetTextureDC : Couldn't get the DC for this surface level. Error -2005530516
06-27-2005 23:59:41 | TEXTURE MANAGER : ReleaseTextureDC : You're trying to release a hDC for this texture but you didn't get one
Posted by Vortex on June 30th, 2005 at 10:33 AM
little addition:

CreateTexture (...
then
SaveTexture (...
then
LoadTexture (....
then
GetTextureDC (...

returns DC Ok, but i need to avoid disk usage on this :-/
Posted by SylvainTV on June 30th, 2005 at 10:48 AM
OK Thanks, should be easy to fix now :)
Posted by SylvainTV on June 30th, 2005 at 1:08 PM
actually the problem is :

GetDC only supports D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_R8G8B8, and D3DFMT_X8R8G8B8.

And create texture created a texture with alpha always.

So i'm fixing CreateTexture :) you will be able to use it with 16bits and 32bits texture mode. but without alpha !
Posted by Vortex on June 30th, 2005 at 3:10 PM
Ok, for create texture with aplha, better to use CreateAlphaTexture then AddAlphaChannel... Right ? ;-)