Jump to content
  • Advertisement

Archived

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

AlexM

help with surfaces

This topic is 6934 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

ddraw won''t let me create mono or 32 bit offscreen surfaces, but 16 and 24 bit work. I know that it should support both (checked in infoviewer). Since the pixel formats i''m requesting are not of the primary surface, i''m creating them in system memory, like ddraw told me to. Here''s some code: For 32 bit non-alpha DDPIXELFORMAT pf; DDSURFACEDESC2 ddsd; memset(&pf,0,sizeof(pf)); pf.dwSize = sizeof(pf); pf.dwFlags = DDPF_RGB; pf.dwRGBBitCount = 32; pf.dwRBitMask = 0xFF000000; pf.dwGBitMask = 0x00FF0000; pf.dwBBitMask = 0x0000FF00; memset(&ddsd,0,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS / DDSD_WIDTH / DDSD_HEIGHT /DDSD_PIXELFORMAT; ddsd.dwWidth = w; ddsd.dwHeight = h; ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY /DDSCAPS_OFFSCREENPLAIN; ddsd.ddpfPixelFormat = pf; I create the surface and get: DDraw:ERROR:Invalid offscreen plain pixel format specified: DDraw:ERROR:RGB, bpp: 32, R 0xff000000, G 0xff0000, B 0xff00, A 0x0 And i''m pretty sure it supports this format. I also can''t create any alpha surfaces (any bpp), so i can''t copy bitmaps into the surfaces properly if i''m going to write my own alpha blitter! Any ideas, how can i get around this? If i''m going to write an alpha blitter I still need those bitmaps to be copied in 4,4,4,4 or 8,8,8,8 formats... thanx in advance

Share this post


Link to post
Share on other sites
Advertisement
do you need that specific pixel format?
how about just the default A-R-G-B. then u dont even need to specify pixel formats and making surfaces is a lot simpler

Share this post


Link to post
Share on other sites
Try setting bitmasks like this :
RBitMask = 0x00ff0000;
GBitMask = 0x0000ff00;
BBitMask = 0x000000ff;

As I can see, you have set all the bitmasks for each
attribute to 0. Format should be ARGB and not RGBA.

/Tooon


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
This is more a question than an answer, but is it wise to select specific bitmasks? Woudn''t it be better to enumerate the available pixelformat and select the one with 32bpp (if supported by the HW)?
By the way I think Toon is right. Normally the red component is in the highest bits. But can you rely on this?

Share this post


Link to post
Share on other sites
It think you always can rely on this, but one could never
be 100% sure. If you want it to be 100%, get the pixelformat
from the primsurface and use its bitmasks to create other surfaces.

/ Tooon

Share this post


Link to post
Share on other sites
It think you always can rely on this, but one could never
be 100% sure. If you want it to be 100%, get the pixelformat
from the primsurface and use its bitmasks to create other surfaces.

/ Tooon

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!