# In game image memset function not working...

## Recommended Posts

The above should be strictly followed.  Using std::memset() over the entire surface area is likely also causing a problem.
std::memset() can be used on the first 64 bytes of each row, not across the whole image.

L. Spiro

##### Share on other sites

@rjhwinner03: Unless I'm mistaken, it looks like you're assigning each pixel a value anyway, so it might be worth considering whether you even need the memset to begin with.

##### Share on other sites

But I have tried getting rid of the memset, which is for a minimap. When I delete the memset, only about 1/3 of the minimap texture is drawn.

##### Share on other sites

Can you post your updated code? (That is, the same block that was included in your initial post.)

I'm not entirely clear on what the behavior is at this point. You said the minimap doesn't render completely without the memset, but what happens with the memset? If it's convenient to do so, posting some screenshots showing exactly what's happening with the minimap might be helpful.

##### Share on other sites

The code for the minimap is the code that is on the first post... If i keep the memset, I get an unhandled exception.

##### Share on other sites
Quote

The code for the minimap is the code that is on the first post... If i keep the memset, I get an unhandled exception.

If the code is the same as in the first post, that means you're still using 'pitch * pitch', and you should fix that first. If you've already fixed that, then the code has in fact changed, in which case reposting it in its current form would be helpful.

##### Share on other sites

How hard is it to post your code?  Why is this like extracting teeth?  Do you just not want help?

How are we supposed to move forward?  You claimed that your code matches what is in your first post, but unlike then, now your code gives you an unhandled exception, so something has changed.

L. Spiro

##### Share on other sites

While you are at it, instead of vague descriptions of the results you are getting, post pictures of what you get and --to the extent you can-- what you would like to get.

##### Share on other sites

Ok I will post the code, my computer is slowly doing updates.

##### Share on other sites

I will not post any more code, as this is a solo, commercial project being carried out by me.

However, I did some more tests, and the memset function that is giving me issues is supposed to draw the square for the minimap. The sight texture is actually working, but the square is too small.

I know this is a square because of the following:

	D3DLOCKED_RECT sRect;
sightTexture->LockRect(0, &sRect, NULL, NULL);
BYTE *bytes = (BYTE*)sRect.pBits;

The bytes that are being used are supposed to be the coordinates for the minimap, which is drawn here:

memset(bytes, 0, sRect.Pitch*sRect.Pitch);

The value of sRect.Pitch is 128 pixels. This is the measurement that draws the length and the width of the square that is supposed to be the minimap.

Here is what I need to have (photo from Empire Earth, not actually my game):

M minimap looks like this, but with 1/3 of the minimap showing.

For example, instead of the whole world showing, as seen here, only around Siberia would be showing on mine, which is a big problem and a big obstacle.

## Create an account

Register a new account

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633657
• Total Posts
3013202
×