• Advertisement

Archived

This topic is now archived and is closed to further replies.

problems in changing the Palette in DDSCL_NORMAL mode

This topic is 5997 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello from a beginner in directdraw programming I''m writing a program that changes the palette of an image in windowed mode but it doesn''t want to work!! How can I modify my code to perform a SetPalette operation on the primary surface in order to chenge the pixel color on the screen? Thanks for the help Luca LPDIRECTDRAW lpDD; LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 LPDIRECTDRAWCLIPPER lpClipper; // clipper for primary LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette HRESULT ddrval; ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); ddrval = lpDD->SetCooperativeLevel( m_hWnd, DDSCL_NORMAL ); // Create the primary surface DDSURFACEDESC ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); // create a clipper for the primary surface ddrval = lpDD->CreateClipper( 0, &lpClipper, NULL ); ddrval = lpClipper->SetHWnd( 0, m_hWnd ); ddrval = lpDDSPrimary->SetClipper( lpClipper ); lpDDPal = DDLoadPalette(lpDD, m_BitmapPath.c_str()); lpDDSOne = DDLoadBitmap(lpDD, m_BitmapPath.c_str(), 0, 0); //** modifying the palette entries... ///.... ddrval = lpDDSPrimary->SetPalette(lpDDPal); // !!! Error ????

Share this post


Link to post
Share on other sites
Advertisement
The problem with windowed mode is that you don''t get to select the screen''s resolution and depth on game startup. This is all determined by what ever your current desktop setting happens to be. So trying to rotate a palette while your desktop is in 16,24, or 32bit color isn''t going to work...Make sure your in 8bit mode, that should solve your problem.

Share this post


Link to post
Share on other sites

  • Advertisement