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 - glider521al

Pages: [1]
1
Graphics / Re: Clearing only Selected parts of a render texture.
« on: August 25, 2013, 08:31:34 am »
My apologies, when you said no blend mode, I thought you meant without transformations/shaders applied. Sorry for my ineptitude, I wasn't reading carefully, and it was 4:30 in the morning when I posted
 (not that that's an excuse).

I am using sprites to render the tiles.
I've seen vertex arrays before, but in my case I still like the render texture solution better as there can be potentially upto 4 layers at any given time (fixed background/background/midground (solid)/midground (decorative like vines on top of the tile)).
In addition the tiles change images according to their slope and neighbor.

Hence I like having it all render to a few renderTextures at one time, as needed.

Edit: Thanks for your help guys, I've got a huge improvement in performance from render textures.


By the way, I already mentioned that.
It would be possible to draw a rectangle shape with no blend mode

You should read more precisely, even if one part of the answer doesn't please you... Although I might have been clearer, too ;)

Are you using sprites to render the tiles? If so, a promising optimization would be vertex arrays, at least if you are able to draw many tiles with the same texture at once.

2
Graphics / Re: AW: Clearing only Selected parts of a render texture.
« on: August 24, 2013, 01:32:49 am »
Thanks I hadn't noticed the render states class in the .net implementation had an option for blend mode.

Looks exactly what I was looking for, I will give this a try :)


You can achieve this by rendering a rectangle shape with a fully transparent color and the blend mode none.

win.draw(rect, sf::BlendMode::None)

3
Graphics / Re: Clearing only Selected parts of a render texture.
« on: August 23, 2013, 08:15:03 pm »
*Sigh*, yes I have done performance tests several times over and of course I've read all the tutorials before posting (except directly interfacing with OpenGL).

I'm already a few months into the project and it runs at a solid 60 FPS on my laptop on battery saving mode (not running well on the EePC though).

I'm currently rendering  3000+ tiles at a time, by precaching possible combinations of layers at a given tileX,tileY position to new 32*32 pixel textures and allowing them to be accessed multiple times. It works really well after a long loading time. The initial loading time is what's giving me grief.

The tiles themselves aren't always always opaque or square, some have boundaries that deliberately overlap slightly
and in certain levels are prone to frequent change.
This is why I may need to cache several layers together.  In my honest opinion anything that can potentially give a decent boost to performance is worth a try (especially if it can be used with a possible 2D lighting system later)

Edit 2: Sorry, I didn't mean to come across as pretentious, it was 4:30 AM in the morning when I posted and I was  a bit irritable. 

Please read the red box in this tutorial... 256 tiles are nothing. Have you measured the performance impact? How do you draw the tiles?

It would be possible to draw a rectangle shape with no blend mode, but before complicating your code, please make sure you need it and the disadvantages of this cache won't affect your application.


4
Graphics / Clearing only Selected parts of a render texture.
« on: August 23, 2013, 03:38:22 pm »
The problem
I'm using the .net implementation of SFML, and I can't see any way of clearing only a selected region of the RenderTexture

I was hoping for renderTexture.Clear(intRect);


Some background on why I need this.
I plan to have a way of having multiple layers of (often) semi-transparent tiles, that frequently change,
render to the screen with much better performance on older computers:

  • The world could is divided into chunks each with a render texture comprising 256 tiles (16 w, 16 h)
  • As the player moves through the world, each chunk that is seen, is rendered once to a render texture
  • When the window renders the world, it only needs to render the render texture of the chunks that are visible
  • Each time tiles are terraformed (which in my case is frequent), only a small section of the render texture should be cleared and rerendered


The problem is that I can't clear selected parts of the texture to become transparent. I need to clear and redraw to the entire render texture :(


Maybe there's a better way around this. Any ideas?
Thanks in advance.

Pages: [1]