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

Author Topic: Questions about texture  (Read 1894 times)

0 Members and 1 Guest are viewing this topic.

tkhan0301

  • Newbie
  • *
  • Posts: 2
    • View Profile
Questions about texture
« on: November 28, 2012, 03:16:45 am »
Hello,

First of all, I did some shallow prior search, but none had satisfied me fully.
If there is a thread already answering my questions, please redirect me to it.

I am trying to make my own implementation of a dimetric world.
I plan to represent each cell with three sprites (top, front, right side), so I need three textures for each type of sprite.
(As it is a dimetric projection, I could flip the front or right side to represent the other, but I want to differentiate them).

I ended up with a 60x30 image for the top side and two 30x60 image for the other two sides.

Here comes my first question,
Should I enlarge the file to a power of two (i.e. 64x32 and 32x64) manually or just let the computer do what it needs to?

And to top that,
Should I make each texture 64x64 on its own?
I might be misunderstanding but I think I glimpsed over a notion that texture with same width and height is better for graphics card to work with.
But then again, the computer could do it for me even if this is true.

Right now I'm packing all three of them in a single 60x75.
If I load this file as a single texture and divide it up when creating sprites with texrect, will it be padded to 64x128 (or 128x128 if worse)?

Basically, when is the padding done? At the level of texture object or the sprite object?

There are a lot more questions I still have in mind, but they are mostly on the similar topic with "else" cases.
So for now, I would appreciate some thoughtful answers or other suggestions on my implementations.

Thank you.

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Questions about texture
« Reply #1 on: November 28, 2012, 03:58:28 am »
Note that SFML doesn't support 3D, so you're left with OpenGL or any 3D graphics engine that is compatible with SFML. I just googled up the meaning of dimetric (first time I saw the term) and while I do get the concept of dimetric itself, I don't quite get what you mean with dimetric world. I can only guess as I don't exactly know what you mean with it.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

tkhan0301

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Questions about texture
« Reply #2 on: November 28, 2012, 04:51:46 am »
Note that SFML doesn't support 3D, so you're left with OpenGL or any 3D graphics engine that is compatible with SFML. I just googled up the meaning of dimetric (first time I saw the term) and while I do get the concept of dimetric itself, I don't quite get what you mean with dimetric world. I can only guess as I don't exactly know what you mean with it.

I do not need 3d support. I'm just using the usual "2.5D isometric" technique. I just being specific by saying dimetric as it is not technically isometric like almost every "isometric" implementations are.

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: Questions about texture
« Reply #3 on: November 28, 2012, 05:37:12 am »
So to restate your problem:
- You have an image of size, say 120x120 pixels.
- And you are wondering what happens internally?

SFML supports textures of any size and if you are running the game on modern hardware it shouldn't be an issue. For older hardware that doesn't support Non Power Of Two Textures, SFML will, for example, create a 128x128 texture then copy the 120x120 image into it, adding the 8px padding on the right and bottom.

So you can leave your images as whatever size you want and let SFML do its magic. :)

gyscos

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Questions about texture
« Reply #4 on: November 28, 2012, 07:23:34 am »
It is a good idea to use tilesets as you did, that is, put all your tiles in a single big image, and, at sprite creation (or if you use vertex arrays, at vertex creation), give it the texture coordinates of the portion you are interested in. Padding is only applied at the texture level. Sprites only reference to the texture.
« Last Edit: November 28, 2012, 11:27:24 am by gyscos »

 

anything