🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

problems in changing the Palette in DDSCL_NORMAL mode

Started by
0 comments, last by Luca 22 years, 10 months ago
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 ????
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.
Joseph FernaldSoftware EngineerRed Storm Entertainment.------------------------The opinions expressed are that of the person postingand not that of Red Storm Entertainment.

This topic is closed to new replies.

Advertisement