I am unable to get the IDirect3D7 object to create a IID_IDirect3DRGBDevice object for the back buffer in this screen resolution. When calling the CreateDevice function it returns a DDERR_GENERIC. I have no 3D card in my computer. I created the back buffer with GetAttachedSurface then have attached a palette to both the primary & backbuffer surfaces successfully. If I change the mode to 640x480x16 and forget about the palettes, Direct3D creates the IID_IDirect3DRGBDevice successfully. What do I need to do to be able to use the 640x480x8 mode with IDirect3D7?
Posted on 2001-04-16 18:24:00 by Charlie
Im not sure, I only support true color mode but... I seem to remember, maybe in DirectDrawCreate, something about flags to tell DX not to use any video card hardware. Might help..
Posted on 2001-04-16 22:52:00 by asm_happy
I am not sure....but i think you ONLY have to attach the pallete to the Primary Surface... yeah i know the docs talks about attaching it to the backbuffer...but we did it only on primary (true we do 2D only) and worked in our "LOW" version of the game It only makes sense to have a main palette attached to the primary and eventually some attached to the textures... also take care because as i understand it: THERE CAN BE ONLY ONE Pallete for the whole of your game, and DX will NOT do any colour conversion (other then when you blit/flip to the primary) between palettes :( (so 2 diffrent palettes can also be the problem...)
Posted on 2001-04-17 18:26:00 by BogdanOntanu
First, I want to thank the people who replied to my post. I appreciate the help and tried both suggestions. Unfortunetly, I still am unable to create the 3D device for this screen mode. When I tried just attaching a palette to the primarybuffer, Direct3D returned a "no palette attached" error message. Would someone be kind enough to review my code and tell me what I am missing. I am new to Direct3D (Like you couldn't tell :-( ) and am unable to find the problem. @@p1 is the offset of the 256 color palette. Here is the code: ;create the default object call DirectDrawCreateEx, 0, offset IDirectDraw7, \ offset IID_IDirectDraw7, 0 cmp eax, DD_OK ;success? jz @@ddc_ok ;yes call MessageBox, hWndMain, offset szNoDD7, 0, MB_OK jmp @@exit_proc @@ddc_ok: ICC IDirectDraw7 call , IDirectDraw7, hWndMain, \ DDSCL_ALLOWMODEX+DDSCL_FULLSCREEN+ \ DDSCL_EXCLUSIVE+DDSCL_ALLOWREBOOT cmp eax, DD_OK ;success? jz @@ddcoop_ok ;yes call MessageBox, hWndMain, offset szNoCoop, 0, MB_OK jmp @@exit_proc @@ddcoop_ok: ICC IDirectDraw7 call , IDirectDraw7, 640, 480, 8, \ 0, 0 cmp eax, DD_OK ;success? jz @@dddm_ok ;yes call MessageBox, hWndMain, offset szNoDisplay, 0, MB_OK jmp @@exit_proc @@dddm_ok: ; Setup to create the primary surface call ZeroMemory, offset ddsd, size DDSURFACEDESC2 mov ddsd.ddsd_dwSize, size DDSURFACEDESC2 mov ddsd.ddsd_dwFlags, DDSD_CAPS or DDSD_BACKBUFFERCOUNT mov ddsd.ddsd_ddsCaps.dds2_dwCaps, DDSCAPS_PRIMARYSURFACE or \ DDSCAPS_FLIP or DDSCAPS_COMPLEX or DDSCAPS_3DDEVICE mov ddsd.ddsd_dwBackBufferCount, 1 ICC IDirectDraw7 call , IDirectDraw7, offset ddsd, \ offset lpddsPrimary, 0 cmp eax, DD_OK ;success? jz @@ddcs_ok ;yes call MessageBox, hWndMain, offset szNoPrimary, 0, MB_OK jmp @@exit_proc @@ddcs_ok: mov ddscaps.dds2_dwCaps, DDSCAPS_BACKBUFFER mov ddscaps.dds2_dwCaps2, 0 mov ddscaps.dds2_dwCaps3, 0 mov ddscaps.dds2_dwCaps4, 0 ICC lpddsPrimary ;try to get a back buffer call , lpddsPrimary, \ offset ddscaps, \ offset lpddsBack cmp eax, DD_OK ;success? jz @@ddas_ok ;yes call MessageBox, hWndMain, offset szNoBackBuffer, 0, MB_OK jmp @@exit_proc @@ddas_ok: ICC IDirectDraw7 ;try to create a palette object call , IDirectDraw7, DDPCAPS_8BIT+ \ DDPCAPS_ALLOW256, @@p1, offset IDirectDrawPalette, 0 cmp eax, DD_OK ;success? jz @@cpal_ok ;yes call MessageBox, hWndMain, offset szErrMakePal, 0, MB_OK jmp @@exit_proc @@cpal_ok: ICC lpddsBack ;attach palette to back buffer call , lpddsBack, IDirectDrawPalette cmp eax, DD_OK ;success? jz @@spal_ok ;yes call MessageBox, hWndMain, offset szErrSetPal, 0, MB_OK jmp @@exit_proc @@spal_ok: ICC lpddsPrimary ;attach palette to pri buffer call , lpddsPrimary, IDirectDrawPalette ICC IDirectDraw7 ;create Direct3D7 object pointer call , IDirectDraw7, offset IID_IDirect3D7, \ offset IDirect3D7 cmp eax, S_OK ;success? jz @@d3_ok ;yes call MessageBox, hWndMain, offset szNoDirect3D7, 0, MB_OK jmp @@exit_proc @@d3_ok: ICC IDirect3D7 ;create Direct3D RGB rendering device call , IDirect3D7, offset IID_IDirect3DRGBDevice, \ lpddsBack, offset IDirect3DDevice7 @@ck_i3dd: ;Returns DDERR_GENERIC error here <<<< cmp eax, D3D_OK ;success? jz @@d3d_ok ;yes call dw_2_str, eax, offset buffer ;put error output in buffer call MessageBox, hWndMain, offset buffer, 0, MB_OK jmp @@exit_proc @@d3d_ok:
Posted on 2001-04-18 20:47:00 by Charlie
I want to let everyone know that someone found the problem for me on the directx newsgroup in case anyone else runs into this. In order to use an 8 bit paletted mode, a Direct3D2 interface with a Ramp device must be used. The RGB device does not support paletted modes. I guess no one uses this screen mode anymore and Microsoft discorages it's use also. Since I have a 200mhz computer with no 3d card I have no other choice. Wasn't a 200mhz computer considered fast last week :-)? Such a vicious circle: Start: buy fast computer software becomes larger & slower goto Start: BTW I was flamed for posting asm code to that newsgroup :-( Thanks again to all, Charlie
Posted on 2001-04-19 19:19:00 by Charlie
I'd like to know NG that was(not that I'd start a flame war) Glad to hear you got an answer. That also explains all those 'ramp emulation errors' I got with some game.
Posted on 2001-04-19 20:40:00 by asm_happy
The newsgroup was microsoft.public.win32.programmer.directx
Posted on 2001-04-19 21:32:00 by Charlie