Blitz3d Internal Structure

Blitz3D Forums/Blitz3D Userlibs/Blitz3d Internal Structure

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Apocalypse, here's how you can get an IDirectDrawSurface7 pointer from a Blitz3D texture handle, including anim textures:

B3D..
tex1=LoadTexture("mytex1.jpg")
SomeFunction(tex1, 0)


C++
BBDECL HRESULT BBCALL SomeFunction(unsigned int buffer,
         unsigned int srcFrame)
{
  HRESULT hr;
  if(buffer==0) return 1;
  buffer = (unsigned int) *((int*)(buffer));
  buffer = (unsigned int) *((int*)(buffer+12));
  buffer = (unsigned int) *((int*)(buffer+(4 * srcFrame)));
 
  IDirectDrawSurface7 *srcSurf = NULL;
  srcSurf = (IDirectDrawSurface7*) *((int*)(buffer+12));

  ...


Testing incoming pointers for texture or image aint reliable, so you best do texture or image specific code. To use images as the source just adjsut the C++ code like so

BBDECL HRESULT BBCALL SomeFunction(unsigned int buffer,
         unsigned int srcFrame)
{
  HRESULT hr;
  if(buffer==0) return 1;
  buffer = (unsigned int) *((int*)(buffer+4));
  buffer = (unsigned int) *((int*)(buffer+(4 * srcFrame)));

  IDirectDrawSurface7 *srcSurf = NULL;
  srcSurf = (IDirectDrawSurface7*) *((int*)(buffer+12));
  ...



Tom