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

Pages: [1] 2 3 ... 12
1
Graphics / Re: Anti-Aliasing of Text
« on: July 13, 2012, 08:04:26 pm »
Even if only when loading the font (loadFrom* functions) you could add an optional parameter to customize this behaviour.

If needed to toggle between two modes, just use different sf::Font objects with the same font file but different options.

Regards

2
Yes, sorry, I haven't searched again. I was getting the gfx ready for the example.
Even so, that's weird... what a coincidence!

Actually, I requested this exact same thing 3 years ago but then totally forgot about it, hehehe.

(Completly off-topic but I like to mention that is good you updated the network UDP code to use the protocol packet size instead of redundantly sending, and in a different packet, the size... which it wasn't working for non-blocking UDP sockets in SFML1.6)

3
The change (at Font.cpp):
FT_Glyph_To_Bitmap(&glyphDesc, FT_RENDER_MODE_NORMAL, 0, 1);
to
FT_Glyph_To_Bitmap(&glyphDesc, FT_RENDER_MODE_MONO, 0, 1);
(with a way to toggle it that fits with the rest of the Font interface)

The reason:
I'm into retro-looking games with big pixels and low color count palettes. I like using SFML2 because it has a really confortable interface, has window init, scaling, rotation, fonts, network, almost everything I need already handled.

Except for antialiasing of fonts. I managed to just change the libraries code but that's no solution and I think it's a missing feature.
Analogously it would be a pain if "setSmooth()" wasn't there to toggle textures anti-aliasing from nearest neighbour (off) to bilinear.

I've attached an image explaining it better (direct link, make sure it's unzoomed/1:1 pixel ratio)...
For both FreeType render modes, there are both No-zoom version and a render-to-texture (RTT) version where my problem is more evident.

Hope you give it a thought
Best regards

-Martín

[attachment deleted by admin]

4
Graphics / Re: Update a texture subrect with an image subrect
« on: May 25, 2012, 11:19:24 am »
Exactly, I was trying to avoid the temporary buffering.
But you're right, OpenGL doesn't have such function per se.

Thanks!

5
Graphics / Update a texture subrect with an image subrect
« on: May 25, 2012, 02:45:39 am »
I'm using SFML2 and trying to update a texture subrect with an image subrect.
That way I keep a "dirty rectangle" and a cache of pixels (sf::Image) of the same size as the final texture and only update the necessary parts of the sf::Texture if needed.
(Sort of what sf::Sprite::SetPixel did on SFML1.6)

Now, I don't see a way of doing it with SFML2.

Shouldn't there be a method for what I'm asking?
Something like
sf::Texture::update(sf::Image &img, int imgX, int imgY, int txX, int txY, int width, int height);
or
sf::Texture::update(sf::Uint8 *imgPixels, int imgX, int imgY, int txX, int txY, int width, int height);

Am I missing a way?

Thanks!

6
General / Trigonometry, float or double?
« on: July 06, 2009, 11:47:25 pm »
You're safe to use floats probably.

But either way if you're using floats or doubles...
usually you shouldn't compare to a specific value (ie: if(velocity==0.f)), instead you should use some epsilon value depending on the context, because it's not fixed-point, maybe if you're handling houndreds, epsilon could be 0.1f, but if you're handling microns, it should be 0.0000001.

You should know that floats have 6 digit significant value.
Code: [Select]
1000000.f + 1.f = 1000000.f  :shock:

Sometimes deceleration doesn't affect velocity, and the object can keep moving. It's almost never noticeable on the position, but rather as the animation continues to walk instead of standing still.

So, my recomendation, check for real numbers with an inequation like
Code: [Select]
if(-EPSILON <= velocity && velocity <=EPSILON) { stop(); }

7
General / Failed to change to fullscreen
« on: July 06, 2009, 11:32:02 pm »
It might be a thing with OpenGL drivers. Have you updated them to the latest?

Maybe non 4:3 resolutions (like 16:9) fuck up something in fullscreen (wouldn't be the first time).

Laurent, I think that it would be nice to check if the resolution available is "virtual".
Widescreens can accept 4:3 fullscreen dimensions stretching everything or maybe even failing.
I think there is a library that does this kind of checks, but can't remember the name.
This could be adressed by actually using the wide fullscreen dimensions but setting the viewport/proportions acording to the difference (So it has black bars on the sides or something)

Regards
-Martín

8
Window / Recieving more than one Key at the same time?
« on: July 06, 2009, 11:26:56 pm »
You could get the unicode char from TextEntered.
As unicode (UTF-8/16/32) is backward compatible with ANSI, you can do a (character&(~0x7f) == 0) to check if it's an ANSI character and then use it safely as ANSI.

It takes into account everything, like acutes used in most Latin languages, and specific characters that you don't probably know about that need a special escaping sequence (like the portuguese C with cedilla: Ç).

It's the best way AFAIK.

Regards
-Martín

9
Window / [COMPLICATED:] Dynamic Input Manager
« on: July 06, 2009, 11:20:19 pm »
Quote
because the returned value will be double, or int if I static_cast<int> it and the compiler can't convert int or double to sf::Key::Code.


int-enum cast should work:
Code: [Select]
static_cast<sf::Key::Code>(static_cast<int>(doubleValue))

if not, knowing that an enum is an int, you could call:
Code: [Select]
reinterpret_cast<sf::Key::Code>(static_cast<int>(doubleValue))




I also agree with Hiura on the std::map thingy. It will be exactly the same, but it does the search for you when actually testing against pressed buttons.


Regards
-Martín

10
Graphics / How to texture a sphere?
« on: July 06, 2009, 11:13:52 pm »
Take into notice that SFML Clamps the images. You must reset the texture wrapping to GL_REPEAT using glTexParameter after calling sf::Image::Bind()

:)

Goodluck!

11
Graphics / SetImage
« on: July 06, 2009, 11:10:10 pm »
I also hated that  :lol:

You can also do a
Code: [Select]
spr.SetImage(Image());
spr.SetImage(theImage);

12
Graphics / Still artifacts
« on: July 06, 2009, 11:05:10 pm »
Fucking awesome!

I'll try this soon

Maybe my ATI WinXP OpenGL drivers actually takes doubles? I don't know, but I swear it helped using them.

It could also be that the double to float cast is less lossy (precision wise) that the float division (2.f/(a-b)).

13
General discussions / Benchmark : SDL vs SFML
« on: July 06, 2009, 10:57:53 pm »
SFML's interface API got me hooked away from SDL  :lol:

Non-OOP game ("media") libraries are a pain in the balls because you probably end up wrapping it in classes that are just like SFML  :P

Even thou I must accept is a whole lot easier and faster to work on pixels in software mode. Reloading a whole texture for just a couple of pixels each frame is slower I believe.

But well, SDL was created a long time ago. It has gained it deserved popularity... but I think it's time to move on.

I mean, people are still using allegro. I used to read about allegro when I was a kid on game magazines... back then it was the shit (as in awesome).
From wikipedia:
Quote
Initially standing for "Atari Low-Level Game Routines"...for the Atari ST in the early 1990s.

ATARI, DUDE xD

Well, I think the best propaganda for developers is the one that compares numbers. Geez, If a politician showed me some numbers instead of sensless babling... he'd win my vote  :lol:

I will check the benchmark when I have some time.

Regards
-Martín

14
I'm helping on the diffusion of this contest.
ADVA is an game development organization here in Argentina.
If you could spread the word it would be awesome, as the more people voting means the results will be more fair (we got just 39 voters on the last contest).


The page is an index of the games and you can vote right there.
Everything is in english, so you won't get lost :)


http://www.adva.com.ar/codear-mashup-games/


I think the only game using SFML is mine, but check all of them if you have time.

(I hope this is ok to post here about this. :oops: )

Thanks for your time.
-Martín

15
General discussions / Vector2f vs FloatRect
« on: July 06, 2009, 10:37:29 pm »
Yes, but all the API starts with capitals. It would be incongruent to start without caps.
But float, int, double are lower case, so 2f seems better that 2F (I stress out the point about "2D" being 2-dimensions, and "2d" being 2-double-params, in OpenGL)


Quote from: "Ceylo"

Quote from: "nitram_cero "
I like the current Vector/Rect notation because is verbose as the rest of the library functions (But not in an extreme way).

So don't you think it should be Vector/Rectangle (or Frame ?) ? It does look more logical to me.

Vector2f/Rectanglef is ok, yes. But I'm actually a conservative person...until stuff fails on me.
The "If it ain't broke, don't fix it" deal.

Pages: [1] 2 3 ... 12
anything