Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Daerst

Pages: [1]
1
Graphics / Re: Using View and TextureRect: pixel line glitch
« on: May 18, 2014, 01:19:20 pm »
After lots of research, I identified two methods:

One, on a low level apply an absolute offset of 0.375. This was kinda hard for me, because of the whole C# / C++ port thingy.

Second, insert padding between sprites. If they aren't tiled, insert transparent pixels. If the sprites should tile, insert a 1px line of the other side of the tile.

Usin the latter approach, I just had to modify a couple of lines of code and all my graphics (which indeed was kinda fiddly, but worthwhile). Hope this will save you some headaches :)

2
I experience the same problem, and the solution your provided fixes the error. Thanks! I think its a (so-far) unrequested feature, but I really would like to see it in SFML, or at least have a workaround. Can you think of anyway to disable AutoScaling in the code itself?

3
The Display() call in the loop is the only one in the entire project. Update and Draw are called the same number of times, but I will check if this still holds true when the bug occurs.

Calling Update twice was an error not in the code, but in the stripped-down version I posted here. In the game code, Update is called only one. Sorry, I corrected it above :)

One thing I noticed: the bug does not seem to occur in Window mode (although I can never be sure, but I ran the game for about 15 minutes without problems). It appear in both Style=Fullscreen, VideoMode=getDesktopMode() and Style=None, VideoMode=getDesktopMode(). The way I understand it, the 'None' video mode is just borderless window, so it should behave just like the 'Default' mode, right? :-\

4
Wish I could do that. I have no idea which part of my code causes the error, and I have no idea where to start debugging. I tried commenting out sections of my code and see if the error vanishes, but having to wait 5+ minutes just staring at the screen each time to see if the error occurs is pretty tiresome. Any tips on how to improve my example in this specific case?

5
Happens on both Windows 7 with NVidia GT540M and Windows 8.1 with some juicy AMD desktop card. We are using SFML.Net 2.1 with C# / MSVC 2012. Drivers are up to date on both machines.

The bug does not seem to happen in Window mode. To go into fullscreen, we use Mode = getDesktopMode() and either Fullscreen or None as a style (which as I understand it is the difference between true fullscreen and borderless window fullscreen). Both styles produce the error.

6
SFML projects / TurboZonk - Arcade Survival Crafting Game
« on: May 12, 2014, 12:47:53 pm »
Hey there,

I'd like to introduce TurboZonk, an Arcade Survival Crafting Game for up to 4 players (local coop) who are hunted by Zonks (which are essentially Zombies).



In two seconds, each player chooses one of four randomly selected items. Sword, gun, chicken, sex doll, shark... We've got them all!

Then you have to survive for 30 seconds, using only what you got before.

After you survived, you get the chance to combine your items to more useful stuff. Rinse and repeat!

You can play the game on GameJolt. If you find bugs or have ideas on how to improve / extend the game, please post them here or use our dedicated GameLoop page.

Have fun!
David

7
Window / Most random bug ever: old frame displaying occasionally
« on: May 12, 2014, 12:41:24 pm »
Hey,

I've got a problem I can make absolutely no sense of. When my game is running, a seemingly random older frame (from the main menu, item selection, in-game state, whatever...) is popping up occasionally, every few minutes. I can't reproduce the bug, it occurs randomly whether I'm playing with lots of inputs and events going on or just standing around and watching the screen.

I use SFML.Net / C#, but I can't tell whether this problem might be related to the port.

The game loop looks like this, sparing some of the details:
while (Window.IsOpen() && _running)
{
    float time = GetTime();
    Window.Clear(Color.Black);
    Update(time);
    Draw();
    Window.Display();
    Window.DispatchEvents();
}

Nothing too unusual there, right? This is the only place in the code where the Display() function is called.

It seems to me that the GPU has some old frame stored that is randomly displayed. When using dual monitors, the 2nd screen goes black for a moment when this bug happens.

Any insights on why this is happening or how to fix this are appreciated. I've been gnawing at this bug for days.

Thanks,
David

8
Graphics / Using View and TextureRect: pixel line glitch
« on: May 08, 2014, 09:52:14 pm »
Hello,

I know this problem isn't new. I searched, found workarounds, and they didn't work for me or at least I don't fully understand the topic and would like to know more. I hope you can help me out here.

I have animated sprites in a game, using the SetTextureRect() function1. The spritesheets have no gaps between the single images. The game uses a view to resize an area of 640x480 units to the full screen while keeping the aspect ratio. Example: for 16:9, the 640x480 area is resized to 1440x1080 and has black borders to the left and right. The example sprite below is also scaled (uniformly by 3).

This is what I get:


Notice the black stripes above and to the left? This is a part of the next image, and I don't like it. In this thread, Laurent said that it's intended behaviour, but I can't quite understand the intention.

What I tried:
  • Rounding the coords to integral numbers before drawing
  • The above, subtracting 0.375f in each direction (is this still valid in SFML 2.1?)
  • The above, but subtracting 0.375f*scale
  • Creating a gap between the images in the spritesheet of course solves the problem, but does not seem like the most elegant solution...

Could someone explain to me why this is happening, and if there is a workaround?
If you want to see the game, and the error, in action, you're welcome to do so :)

Thanks a lot,
David



1Actually I'm using SFML.Net with C#, so it's TextureRect's setter.

9
Graphics / Re: SFML and OpenGL: getting pixels from RenderTexture
« on: March 14, 2014, 10:03:28 am »
For each pixel of a texture, I save some data in another texture (renderTex). I then need to acces various of the pixels erratically to use them in CPU code.

Since I need to access various pixels, I can cache the image and only update if when someone modifies the texture. This leads to a considerable (and sufficient) speedup, but if someknow I'd still be interested in how the OpenGL stuff works.

Thanks,
Daerst

10
Graphics / Re: Screen starts flickering when on fullscreen
« on: March 07, 2014, 02:08:16 pm »
Question for those who know: There may be problems if you create and use a RenderTexture before creating a window?

In my current project, I use RenderTextures for internal calculations. Additionaly, the user can create a window (at any time before, during or after the calculations) to see the current progress. Whether the window is created or not, everything works fine. So, shouldn't be a problem there.

11
Graphics / Re: Excessive Memory Usage Problem
« on: March 07, 2014, 01:59:44 pm »
Taking into account what Laurent said, the amount increasing so much when loaded into RAM implies that you use a decent compression. 119mb of compressed image data seems like an excessive amount for a small game.

First, you should try reducing the number of images. If your player can e.g. use a custom color for the character and you created 100 images in different colors, try using one image for the "naked" character and a second one for the colored overlay, which is drawn on top with the help of sf::Sprite::setColor.

Second, if you really need all the images you still probably don't need them all at once. Load only the textures that you need for the current level, free the resources before loading the next level, if that makes any sense for your game.

12
Graphics / SFML and OpenGL: getting pixels from RenderTexture
« on: March 07, 2014, 01:22:35 pm »
Hey there,

I'm trying to get a single pixel value from a RenderTexture. The image is grayscale, so I really only need one of the channels. The current solution uses
uint8_t px = renderTex.getTexture().copyToImage().getPixel(x, y).r;
which, as you can imagine, is pretty damn slow - but at least it ensures that renderTex is initialized and looks like what I expect it to.

To speed it up I tried to use raw OpenGL (which I'm a total noob at, SFML has shielded me from that arcane knowledge for years) to get the pixel like so:
uint8_t px;
sf::Texture::bind(renderTex.getTexture());
glReadPixels(x, renderTex.getTexture().getSize().y - y, 1, 1, GL_RED, GL_UNSIGNED_BYTE, &px);
assert(glGetError() == GL_NO_ERROR);

Sadly, glReadPixels doesn't write to px at all. If I initialize it with some value, this value is never overwritten. The assertion is always true, so glReadPixels doesn't throw an error either.

What's wrong here? Any hint is appreciated.

Thanks,
Daerst

Pages: [1]
anything