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

Author Topic: Avoiding sf::View's float precision, and visible sprites  (Read 2496 times)

0 Members and 1 Guest are viewing this topic.

Manux

  • Newbie
  • *
  • Posts: 23
    • View Profile
Avoiding sf::View's float precision, and visible sprites
« on: December 20, 2009, 06:51:12 pm »
Hello, I actually have 2 little questions:

First, I'm making a 2D isometric tile engine, and, as I experienced it before with OpenGL, giving a float position to a textured quad will result in a white border around it, which is quite unappealing... I'm having the same problem with SFML right now.
Do you know any way around this?

Second, I wondered what's the most efficient way of selecting only visible sprites in my tilemap?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Avoiding sf::View's float precision, and visible sprites
« Reply #1 on: December 20, 2009, 06:54:34 pm »
Quote
First, I'm making a 2D isometric tile engine, and, as I experienced it before with OpenGL, giving a float position to a textured quad will result in a white border around it, which is quite unappealing... I'm having the same problem with SFML right now.
Do you know any way around this?

Well, it's not related to float coordinates. It actually depends on a lot of things. One workaround that usually works is to disable texture filtering (image.SetSmooth(false)).
Have you tried SFML 2?

Quote
Second, I wondered what's the most efficient way of selecting only visible sprites in my tilemap?

I'd do it with simple AABB tests.
Laurent Gomila - SFML developer

Manux

  • Newbie
  • *
  • Posts: 23
    • View Profile
Avoiding sf::View's float precision, and visible sprites
« Reply #2 on: December 20, 2009, 07:08:15 pm »
Merci  :D

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Avoiding sf::View's float precision, and visible sprites
« Reply #3 on: December 20, 2009, 10:18:42 pm »
Quote from: "Manux"
Second, I wondered what's the most efficient way of selecting only visible sprites in my tilemap?
I would recommend AABB (probably rectangle) checks as well. However, objects that are arranged in a systematic manner (like tiles) can be tested faster. When they're stored in a 2D-container, calculate the minimum and maximum indexes and just draw the required sprites in two nested for loops.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything