Jump to content
  • Advertisement
rjhwinner03

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 this post


Link to post
Share on other sites
Advertisement

@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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

POST YOUR CODE.


L. Spiro

Share this post


Link to post
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 this post


Link to post
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):

?interpolation=lanczos-none&output-forma

 

 

 

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!