directdraw and windowed mode question

Win32 Programming


  • 1. Question about D3DFVF_CUSTOMVERTEX
    Hello everyone, I have question in define custom vertex format. In the project, I only used pixel shaders which have texture samplers sampling three textures. In defination of D3DFVF_CUSTOMVERTEX, I used D3DFVF_XYZ| D3DFVF_TEX2 at first, but it worked well with the three input textures. When I found I should use D3DFVF_TEX3 in vertex defination(I do not know if it is true), I changed it into _TEX3, it worked the same as _TEX2. Then I changed into _TEX1, it is still working. Can anyone explain this and what is correspondence between _TEXn and the input textures ? Thank you. Yong
  • 2. CreateVolumeTexture fails with D3DERR_OUTOFVIDEOMEMORY
    Hello, I'm trying to create a 3d texture in video memory like that: CreateVolumeTexture(1024, 512, 256, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &pd3dTexture, 0); This texture should use about 128MB of video memory. I've an ATI/AMD X1900 with 512 MB of video ram, no other big textures created, also this happens just after starting the application, so no video memory fragmentation. The maximum volume texture size according to device caps is 1024. So why does this call fail? Has anybody an idea? Thanks! Yours Gerald
  • 3. How to Create a D3D Surface using specified system memory?
    Hi there, I have allocated a block of memory in the system RAM, and I want to use this memory to form a D3D surface. I know that DirectDraw allows application to create a DirectDraw Surface using a specified memory, is there any way to make it happen in Direct3D9? thanks.
  • 4. Help
    unload some of the examples (rt_Skin and rt_D3DXSphere) of the page that mention ( I have in my machine installed DirectX9 and Visual C++ 6. As I can do to him so that the examples can buiding.? some suggestion. greetings.
  • 5. Book on DirectX
    Hi, Im new to ths group , Iam very much interested in developing small games using DirectX. Please help me by suggesting How to start with DirectX. I am very well into C,C++ and COM,Please suggest me a very good book(or onlie tutorials) to start DirectX with .I found it to be a bit hard to follow from msdn (Guess they have not suitably documented for freshers in directX). Thanks in Advance.. Kranthi Kiran.

directdraw and windowed mode question

Postby Rick D. » Mon, 21 Nov 2005 22:08:43 GMT

Hi all,

Is it possible to adapt a full screen directdraw application (game) to
run in windowed mode and make it behave exactly like the full screen
version. I read somewhere it's much slower because it is not really
direcdraw but gdi and it's not possible to use a double buffer. But i
couldn't find that much information on it, and like to know if it
makes sense to do this (or if DD is basically a full screen only API).
And if so where i can find information on what modifications i should
make to the (c++) source code to make it work in a window.

Thanks for any help with this.

Best regards,
Rick D.

Re: directdraw and windowed mode question

Postby Wessam Bahnassi » Tue, 22 Nov 2005 00:07:39 GMT

DDraw works pretty well in windowed mode. There are some certain points that 
need to be taken care of before everything turns back just as in full-screen 
mode. Most notably, the use of a clipper object, the desktop format 
restriction, the flipping code (this should be changed to a direct Blit from 
the back buffer to the front buffer).
As far as performance, full-screen plays faster. Even on my D3D9 app, a 
switch to full-screen boosts performance to some extent.

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer

Similar Threads:

1.Switching from windowed mode to full screen mode

Hi everyone,

I've got difficulty in switching from windowed mode to full screen mode. I
re-create all the surfaces from scratch but I get the error 255 when I call
GetAttchedSurface to retrieve the backbuffer pointer.

Here is the code :

void SwitchModes() throw (Exception)
 DDSCAPS2 ddscaps;


 g_isFullScreen = !g_isFullScreen;


 if FAILED(hr = lpDD->SetCooperativeLevel(g_hMainWindow, flags))
  throw DXException("SetCooperativeLevel", hr);

 if (g_isFullScreen)
   throw DXException("SetDisplayMode", hr);


 if (g_isFullScreen)
  ddsd.dwSize = sizeof(ddsd);
  ddsd.dwBackBufferCount = 1;
  ddsd.dwSize = sizeof(ddsd);
  ddsd.dwFlags = DDSD_CAPS;
  ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

 if FAILED(hr = lpDD->CreateSurface(&ddsd, &g_primarySurface, NULL))
  throw DXException("CreateSurface", hr);

 if (g_isFullScreen)
  if (g_clipper)

  ddscaps.dwCaps = DDSCAPS_BACKBUFFER;

// returns 255 (ERROR_EA_LIST_INCONSISTENT) !!!
  if FAILED(hr = g_primarySurface->GetAttachedSurface(&ddscaps,
   throw DXException("GetAttachedSurface", hr);


  g_pitch = ddsd.lPitch;

  if FAILED(hr = lpDD->CreateClipper(0, &g_clipper, NULL))
   throw DXException("CreateClipper", hr);

  if FAILED(hr = g_clipper->SetHWnd(0, g_hMainWindow))
   throw DXException("SetHWnd", hr);

  if FAILED(hr = g_primarySurface->SetClipper(g_clipper))
   throw DXException("SetClipper", hr);

What's the problem ?

Thanks in advance,

2.DirectX - Switching from windowed mode to full screen mode

Hi everyone,

Does anyone know in DirectX the procedure one must follow to switch from
windowed mode to full screen mode ? I always get an error when I recreate
the surfaces.

Thanks in advance,

3.Direct3D in a windowed mode offset rectangular viewport

I need to render Direct3D only in a rectangular area of the window. I want 
the UI already drawn around the rectangular area to remain not drawn over. (I 
am not using Direct3D to draw all parts of this program, and it's important 
that I keep all that as is..) 

I have set a viewport with the X and Y values offset, but the device.Clear 
function is clearing the entire window's area, and even the Clear function 
overload that takes a Rectangle array cleared the entire window when I passed 
it the view rectangle.

Has anyone done this sort of thing, know how to do it, or understand what is 
going wrong?


4.Direct3D with VC++ Express in windowed mode !!!

Hi guys,

I want to create an editor for my next graphic engine, the game part works 
fine with Visual Studio Express Edition but for the editor I can't get 
directx to work in my window ?? I remeber in the past that Directx sdk 6 
(yes too old) there was an exemple called MFC Fog that uses the graphic 
interface of directx in a window and I know it's possible to do such a thing 
with MFC but unfortunatly Express Edition does not support MFC.

So I wonder if there's a way to pass throught this problem ?

Thanks in advance and sorry for my poor english ;-)

Kind Regard,


5.Resizing resolution in windowed mode (DX10)

6. Switching between multihead and windowed mode

7. vsync'ed Present in windowed mode of dx9

8. D3D Windowed mode problem

Return to Win32 Programming


Who is online

Users browsing this forum: No registered users and 36 guest