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

Pages: [1] 2
1
Graphics / Re: [SFML 2.0] sf::View TextBox
« on: August 08, 2013, 11:04:30 pm »
Indeed, setting the viewport to the area of your text box should solve your problem.
Nevermind got it.

2
Graphics / [SFML 2.0] sf::View TextBox
« on: August 08, 2013, 10:16:16 pm »
Hey,

Wanted to try and create a TextBox using a texture font (glyphs).
I want to try this without using any third party library.

The problem I'm having:
Scrolling tiles with a sf::View is working well if it covers the entire window (800x600).
Creating a TextBox would practically be the same, however I don't want to use the entire window with the sf::View since I only need a small part for the TextBox (200x20) showing only the characters which should be visible. (for example, only the text that fits in the TextBox's width should be shown)

So my question is:
Is it possible to use a sf::View without making the fonts HUGE or using the entire window? Like a sub-view.
I'm guessing it has to do with the viewport like I have seen in some tutorials but fail to see how it would be related to my problem using scales..

Any ideas / tips on how to approach this would be appreciated.

3
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 23, 2013, 07:03:42 pm »
How can you need more textures (tilesets) than sprites (tiles)... ??? There's at most one different texture per tile, not more.
You won't be able to draw everything in one call. Just iterate over your array of sf::VertexArray and draw them one by one using the corresponding tileset.
Meaning that I need to iterate through all tilesets (500) for my map to draw? Or do I completely miss the point here.

4
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 23, 2013, 06:40:50 pm »
No, because you obviously have less tilesets than tiles. Thus you have less draw calls with vertex arrays. To be more precise, if you have 50 tiles per tileset, that's 50x less calls, so approximately 50x more performant.

By the way, out of curiosity, what kind of map requires more than 25000 different tiles (500 tilesets * 5x10 tiles) to be loaded at the same time? It seems really huge.
It's not one map of 25000 different tiles but multiple maps. Every map will be loaded when needed (which can range from 10x25 or 45x10 tiles for example). The map dimensions are dynamic but tiles of different tilesets are needed for each map.
My window resolution is 800x600, which can store 475 visible tiles ( (800 / 32) = 25 x (600 / 32) = 18,75 = 19 ). And will only draw the visible tiles.

Now when I understand correctly I would need 500 draw calls with using VertexArrays and 475 draw calls for sprites individually.

Which is inefficient. Your (and anyone elses) help is ofcourse appreciated :-)

5
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 23, 2013, 05:10:25 pm »
Ok, I think I was not clear enough. When I say "one vertex array per texture", it implies "one draw call per vertex array". You won't be able to draw everything in one call. Just iterate over your array of sf::VertexArray and draw them one by one using the corresponding tileset.
Wouldn't this be as inefficient as drawing the sprites individually?

6
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 23, 2013, 02:00:30 am »
Associate a sf::Texture and a sf::VertexArray to each tileset. Then for every tile, add a quad to the vertex array that matches the tileset. That's it.
I still fail to see how this could be done in one draw call to render the entire map to the screen.

Example:
Mapdata from file contains tileIDs (seperated by spaces): "1 50 51 100 101 200"
1 = first tile in first tileset.
50 = last tile in first tileset.
51 = first tile in second tileset.
100 = last tile in second tileset.
etc.

I could add quads to the VertexArray containing all tile coordinates of the textures. No problem, these are just vertices that have nothing to do with the actual texture until you decide to render it?

But my problem is that I need an alternative way to draw the entire map with one window.draw call like its supposed to with one tileset texture but instead with multiple. But as stated before this is not possible with multiple textures:
window.draw(VertexArray, &vTilesetTextures[0]);// <- Here one texture. (vTilesetTextures = std::vector<sf::Texture>)

7
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 22, 2013, 10:08:48 pm »
But what are these tileIDs, and what do they mean at the vertex array level? Is it just another way to refer to specific texture coordinates inside a specific tileset?
Yes it is. And I have no idea how to go with it in terms of VertexArrays and a vector of tileset textures.

8
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 22, 2013, 08:59:30 pm »
As I said in my first answer, you have to use one vertex array per texture. But it's still a lot better than one sprite per tile.
Yeah I get this.. however I don't know how to link my tileIDs (which are loaded from a file) with those VertexArrays as each tileID could be only be used in one tileset texture.

Quote
Not being able to put these into one big texture as it is way too much.
You still haven't said how much you would need ;)
500+ tilesets. 5 by 10 tiles (each tile is 32x32). Which is too much to cram into a single texture.

9
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 22, 2013, 06:57:19 pm »
Quote
The problem is putting it all in one draw call in the end.
Can you be more specific about what's blocking you?
My situation:
Multiple tilesets loaded into std::vector<sf::Texture>;
Not being able to put these into one big texture as it is way too much.
No idea how to reference VertexArrays to these tileset textures (std::vector) as each tileID (loaded from a file) is spread out over those textures and thus no idea how to get it so I only have to call draw (VertexArray, multiple textures) once for the entire map.

I hope its a bit more clear now.

10
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 22, 2013, 06:40:53 pm »
Quote
Faced another problem, the mapdata (tileIDs) are ofcourse spread out over the tileset textures so it wouldn't be possible to use sf::VertexArrays in the first place (I think?).

It seems the only possible solution in my case is either drawing all tile sprites individually (bad performance)
What problem is there? Sprites are vertex arrays internally, so if you can do it with a sprite you can do it with a vertex array.
The problem is putting it all in one draw call in the end.

11
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 22, 2013, 05:19:32 pm »
Faced another problem, the mapdata (tileIDs) are ofcourse spread out over the tileset textures so it wouldn't be possible to use sf::VertexArrays in the first place (I think?).

It seems the only possible solution in my case is either drawing all tile sprites individually (bad performance) or using sf::RenderTexture which is not optimal.

You can avoid sf::RenderTexture, since you basically just need raw pixel copy. Use sf::Image::copy.
Not sure what you mean by this. Could you elaborate?

12
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 22, 2013, 12:35:16 am »
On my system this value is 16384, but I have no idea what this value is on other systems (will be released).
So I don't think this is much of a solution (I have read sf::RenderTexture had some problems on intel graphic drivers also, no idea where I have read that or what the problems were exactly).
Ill try to create a std::vector of sf::VertexArrays and tileset textures then. Thanks :-)

13
Graphics / Re: sf::VertexArray for multiple Tilesets.
« on: May 21, 2013, 11:28:18 pm »
You can't, you must have one vertex array for each tileset (texture).

But 5x10 tiles of 32x32 is not a lot, can't you group your tilesets into a single bigger texture?
I suppose it's possible to put them into a bigger texture. But I'm not sure what the maximum dimensions are for sf::RenderTexture (assuming it could be done with this) as I have a lot of tilesets.

14
Graphics / sf::VertexArray for multiple Tilesets.
« on: May 21, 2013, 11:02:52 pm »
Hi all,

After reading the documentation on the VertexArray class and textures I seem to be stuck.
It all works great.. for one tileset texture.
I have multiple tilesets which consists of 5 by 10 tiles (each tile is 32x32).

Positioning the x and y for both the screen (VertexArray.position) and the tileset (VertexArray.texCoords) is working fine.
I just need some help with how to handle multiple tilesets, I can't put my finger around this issue.

I am using SFML 2.0.
Any help or tips is highly appreciated!

15
Graphics / Re: Bitmap font -> Chatbox (with scrollbar)
« on: February 14, 2013, 09:10:46 pm »
Thank you, then only one question remains: is the sf::View suitable/efficient for this or is there a different (perhaps better) approach?

Oh and would rendering the glyphs one by one a good solution in terms of performance or should I look for storing the text inside a texture somehow and render it at once?

Pages: [1] 2
anything