Speeding up Bitmaps Loading

Win32 Programming


  • 1. Clip-plane Trnasformation via the World Matrix
    Should Direct3D 9.0b transform clip planes according to the current D3DTS_WORLD matrix? Basically I want the clip planes to move with the World Transformation. I am able to get what I want to happen by using D3DXPlaneTransform(...) and resetting the SetClipPlane(...) each frame with no real noticable frame rate expense. But, I don't know, it just feels like that is something that a graphics API should do for you (I am relatively new to DirectX having used OpenGL for a long time and I somehow remember OpenGL supporting this) Thanks, in advance -Kevin
  • 2. Simple .X Construction
    I would like to try out the Native .X format of Direct3D. I wrote a small program like this, I don't know why it hangs, whether because of direct3d lib or win32 console mode lib problem... Pls correct this piece of code for me :). Thanks Jack #include <stdio.h> //#include <d3dx9.h> #define XOFFILE_FORMAT_MAGIC \ ((long)'x' + ((long)'o' << 8) + ((long)'f' << 16) + ((long)' ' << 24)) int main() { char *filename = "test.x"; FILE *fp; fp = fopen (filename, "wb"); fwrite (XOFFILE_FORMAT_MAGIC, sizeof (long), 1, fp); fclose(fp); return 0; }
  • 3. Detecting MultiSampling override
    Hi, is there any way to detect whether the user has explicitly turned on multisampling at the driver (i.e. anything other than 'Application Preference' under Direct3D tab)? I call CreateDevice() with PresentParams.MultiSampleType = D3DMULTISAMPLE_NONE. I was hoping that if the user has selected multisampling at the driver, then the returned back buffer would reflect that. When I do the following IDirect3DSurface9* pBackBufferSurface = 0; m_pd3dDevice->GetRenderTarget(0, &pBackBufferSurface); D3DSURFACE_DESC BackBufferDesc; pBackBufferSurface->GetDesc(&BackBufferDesc); BackBufferDesc.MultiSampleType is equal to D3DMULTISAMPLE_NONE, whereas I would expect it to be equal to whatever the user had selected. I also tried testing the depth/stencil buffer, as well as the presentparams structure (that is modified by the CreateDevice call), but they all report that no multisampling is used. Any clues? Thanks, Bill

Speeding up Bitmaps Loading

Postby Perlom » Sat, 19 Jun 2004 00:20:03 GMT

I am trying to load a sequence of large bitmaps (720*486) and then loop thru
each pixel and convert its color space form RGB to YCbCr which is used in TV
broadcasting. I'm using VB.NET.  Unfortunately, the overall process came up
to be real slow specially when running this on 300 frames (around 3
minutes).  The steps are:

 - Loop thru al files to load each bitmap:
        Dim mBitmap as Bitmap = Bitmap.FromFile(FileName(i))

 - Loop thru each pixel, get the color, and apply mathematical conversion
        For J = 0 to mBitmapHeight
            For K = 0 to mBitmapWidth
                  mColor = mBitmap.GetPixel(K,J)
                  Y = (Some math function involving R,G,B Values)
                  Cb= (Some math function involving R,G,B Values)
                  Cr= (Some math function involving R,G,B Values)
                  mFile.Write( values)

After doing some analysis, I found that the bottle nock is loading the
Bitmap step.  I am wondering if there any faster way to load a Bitmap. I
read on the MSDN site about Cashed Bitmaps, but I wasn't able to find an
example.  Anybody has a suggestion? Thanks in advance.

Kind Regards.

Re: Speeding up Bitmaps Loading

Postby Philip Taylor [ATI] » Sat, 19 Jun 2004 01:15:13 GMT

load it as a DirectX texture, and access it that way, since GDI based access
are usually slower than DX accesses.

this requires you to understand the texture format to such a level of detail
you dont have to depend on GDIs format conversion, which is usually the slow

if its really just the file access thats the bottleneck, than DX cant help
you much and this forum isnt the right place to ask.


Re: Speeding up Bitmaps Loading

Postby Perlom » Sun, 20 Jun 2004 00:25:25 GMT

Thanks Phillip for the Info.  Can you direct me to where I can find few
samples about the method you suggested, or to which forum I should ask?

kind regards.

"Philip Taylor [ATI]" < XXXX@XXXXX.COM > wrote in



Re: Speeding up Bitmaps Loading

Postby Shaun Pudwell » Sun, 20 Jun 2004 21:29:09 GMT

I would have thought it would be better to create a C++ DLL to do the work
as processing a double loop like that in VB is going to be abysmally slow.



Re: Speeding up Bitmaps Loading

Postby Phil Taylor » Sat, 26 Jun 2004 01:23:32 GMT

doesnt one of the SDK samples lock the texture and access the bits?

grep the samples on lock.



Similar Threads:

1.Speed of bitmaps


I am doing some time-critical work with bitmaps (a remote desktop monitoring
app). I have two questions about bitmaps:

1. After taking a screenshot of the desktop, I have a device-dependant
bitmap. Why does it take ~30ms to convert it from a DDB to a DIB? The color
depth does not change, so what causes this delay? In other words, what is
the CPU doing?

2. What is the fastest way to get access to the bitmap so that it can be
compressed. One way would be to call SaveToStream(), but this moves 4 MB of
data (bitmap size) which is pointless and a waste of 20ms. Once I have
access to the bitmap, I can compress it. I could use ScanLine I think, but
this would be missing the header data.


2.Help with loading bitmaps

I've been reading bitmaps using the glaux libraries in windows.  But I
haven't been able to find the glaux libraries for linux, where I want to do
my developing (mesa does not come with glaux).  Can anyone help me with
finding the glaux libraries for linux, or with finding a solution to
loading bitmaps that doesn't involve glaux or using other APIs?


3.Loading texture bitmaps! (opengl)

"DigitalDragon" < XXXX@XXXXX.COM > wrote in message
news:c7gkdh$l32$ XXXX@XXXXX.COM ...
>>This question has probably been asked dozens of times,
>>but I'm a newie.  So, I'm wondering if there is an alternative
>>to the "auxDIBImageLoad()" function??
>>I need a function that will load a bitmap stored in an
>>applications resources or resource script.  Does such
>>a function exist? (BTW, I'm using VisualC++ 6.0)
> i suggest you make your own loading function, it's a very simple format.

Ok!  I checked glaux.h header file, and I found the definition of
an "AUX_RGBImageRec" structure.  auxDIBImageLoad() returns
a pointer to this structure.  It looks like this :

typedef struct _AUX_RGBImageRec {
    GLint sizeX, sizeY;
    unsigned char *data;
} AUX_RGBImageRec;

So, after I read my bitmap from a resource script, I need to
store the bitmap bips in the "data" field??  Is that right?
And, I'm guessing that the sizeX and sizeY fields store the
bitmap dimensions??

Can anybody recommend a simple algorithm or an easy
win32 function that will load a bitmap into the "data" field?



4.Loading texture bitmaps!

This question has probably been asked dozens of times,
but I'm a newie.  So, I'm wondering if there is an alternative
to the "auxDIBImageLoadA()" function??

I need a function that will load a bitmap stored in an
applications resources or resource script.  Does such
a function exist?

(BTW, I'm using VisualC++ 6.0)



5.Loading bitmaps to use in texturing

Can anyone guide me to a library that can load a bitmap to use in
I don't want to use glaux sine it's outdated and has known memory

Thanks in advance,

6. texture loading speed. DXT1 versus PNG`

7. JPEG loading speed

8. Movie Factory 2, is processor speed, graphics card speed important

Return to Win32 Programming


Who is online

Users browsing this forum: No registered users and 94 guest