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

Pages: 1 [2] 3 4 5
16
Graphics / Re: Sprite Masking in SFML2
« on: March 31, 2012, 04:08:32 am »
Laurent, (or anyone who could help :) )

Would that be possible for achieving something like this, that I draw the base sprite and the masking sprite of a specific color (magenta lets say), then in some way tell the rendertarget (or SFML globally) that magenta = full transparent?


17
Graphics / Re: Sprite Masking in SFML2
« on: March 31, 2012, 01:42:06 am »
Well yes, that would work, but if that is dealing with the actual bitmap/image with CPU operations I would assume it would be quite expensive.
If what you said would be possible with a glsl fragment shader I guess it would be faster, but I am just starting to learn GLSL.

In your case however, as you are using SFML1.6, all this is implemented in an SFML wiki entry, that I have linked in the first post, check that out:
http://www.sfml-dev.org/wiki/en/sources/masking_using_alpha_and_blending
I just wanted to get this functionality in 2.0's rendertextures, and received the answer that this is still in development.

18
Graphics / Re: Sprite Masking in SFML2
« on: March 30, 2012, 08:12:43 am »
I don't know if you can easily do something with SFML 2.0. I guess you'll have to wait until render masks are officially implemented.
Thanks for the answer.
I know its hard to know it in advance, but would you have a rough estimate on when might that be implemented, as of possibly in 1-3months, or more likely 6+ or something?

19
Graphics / Sprite Masking in SFML2
« on: March 30, 2012, 06:00:02 am »
Hi,

I wanted to be able mask sprites such as having a base sprite and a masking sprite. The sprite used for masking is not drawn at all, only the alpha value is used such that the overlapping areas of the base sprite and the masking sprite is not drawn (or rather the masking sprite's alpha value is subtracted from the base sprite's alpha on the overlapping pixels).

I have made a sample demonstrating of what I would like to achieve:


I noticed that there is an entry on SFML Wiki that would allow exactly just that:
http://www.sfml-dev.org/wiki/en/sources/masking_using_alpha_and_blending

Unfortunately it looks like this would only work with SFML1.6 and has been abandoned.

Could someone help me if this could be modified so that it would work with SFML2 textures or rendertargets?
If that is not possible, is this something that could be done with glsl fragment shaders?

I would really appreciate any assistance on how I could achieve masking sprites in SFML2.

Thanks in advance!

20
SFML projects / SFML Light System - Let There Be Light
« on: March 02, 2012, 05:07:05 am »
I'm looking forward to see it as well, keep up the good work!

21
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 23, 2012, 03:06:04 am »
Quote from: "Laurent"
OpenGL is a rendering API, it doesn't perform offline image transformations.

What you need is an image library, not a drawing API. Or a scaling algorithm, it's not hard to implement.


Thank You!
I have used http://code.google.com/p/imageresampler/
It is very lightweight and can nicely resample png (only to bmp or tga, but that is okay).
I made it so the first time my program is ran, or when resolution changes the background textures are resized to to appear pixel perfect on the user's screen resolution, that way there is no aliasing.

 
Quote

When mipmapping, we build scaled-down versions of our texture maps; when rendering portions of the scene where low texture detail is needed, we use the smaller textures.  Mipmapping can save memory and rendering time, but the motivating idea behind the technique's initial formulation was to increase the quality of the scene by reducing aliasing.  Aliasing happens because we're coloring each pixel based on the surface that, when projected to the view plane, contains the pixel center.  Small visual details can fit between pixel centers, so that as the viewpoint moves around, they appear and disappear.

This is what I was experiencing when running the program on lower resolutions and using a high resolution background image.

22
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 08:12:42 pm »
Quote from: "Nexus"
There is a way to scale sf::Image, but you have to do it manually. E.g., create a new image and perform pixel mapping.


By manually, you mean I have to do it with OpenGL calls?
Could you please show me how?

23
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 05:04:16 pm »
I see.

I am not sure if I understand it correctly, but mipmapping should fix this issue I am having, and I see there are a few threads asking about it. Is mipmapping still planned to be implemented in SFML?

If not, is it possible to just do it with OpenGL calls, while managing the loading of textures and everything else with SFML?

Also, resizing the texture is not implemented in SFML, but it is possible with raw OpenGL, right?

(sorry for all these questions, I really appreciate your work and help)

24
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 04:27:07 pm »
Quote from: "Laurent"
Are you using a recent revision of SFML 2?

Which graphics card did you test this app on?


Yes, 3 days old snapshot.

I tested it on a NV8800GTS, although I am using an adapter for a 3rd screen which is messing with the NVidia drivers, also on a netbook with a crappy Intel GMA950 and on computers at my school which probably also have some built-in intel stuff.

What I could think is that on a proper video card with settings set to "High Quality" and the likes fixes the issue I am having.

Either way, this would be fixed if a texture could be resized. Is there a way to do this?

25
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 04:02:04 pm »
Quote from: "Laurent"
Are you talking about the jerky movement of the borders?

Your application doesn't show the borders of the upper texture, so it's hard to see if the bug only applies to the scaled texture.


No... That's very strange, it seems like it doesn't show up when you run it, because it is super apparent when I do. And I tested it with 3 computers.

To me the lower texture is nice and smooth, scrolling nicely.
The upper, bigger one that is scaled down shows lots of artifacts as it is moving.

On the scaled texture the bright pixels appear to be flickering when moved.

26
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 03:36:08 pm »
Quote from: "Laurent"
Have you tried texture.SetSmooth(true)?


yes, that is set.

Please check this out, it clearly demonstrates what I am talking about:
http://www.mediafire.com/?wdtm3z6wp8mszie

The upper texture is scaled down from its native resolution, the lower one is 1to1. Both are set to smooth. These are the furthest layers in my parallax background, so if you press UP/DOWN they slightly move accordingly, during that the artifacts are even more apparent.

Thank You!

27
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 02:42:25 pm »
Quote
Can you show us?

My issue seems to be the same as in this thread:
http://sfml-dev.org/forum/viewtopic.php?p=41500&sid=1afb67cbb20dbef76550bec5c1cc3056

With screenshots I cannot show it, it is only visible during motion. (Every individual scaled displayed image seems to be fine on its own, but every frame the scaling ends up a bit different, showing grid-like patterns)

I could demonstrate this by scrolling 2 of the same images one on top, one on the bottom, the top one is scaled down, the bottom one is 1-to-1. It would be clearly visible.

When I'm done writing that I'll upload it somewhere and you'll see what I am talking about.

Quote
What makes you think that you would do a better job than the graphics card?

You'll see in a bit :)
It is not actually me making a better job, it is about not having it scaled every frame would make the actual image look more...consistent. Can't really explain it like this

28
Graphics / Scale/Resize sf::Texture (not sf::Sprite)
« on: February 21, 2012, 06:40:46 am »
Hi,

My program sets the resolution to the user's desktop resolution, then all sprites get scaled by (USER_DESKTOP_WIDTH/OPTIMAL_NATIVE_WIDTH).

This works nicely with everything so far, except the fullscreen scrolling background texture, which shows scaling artifacts/patterns (or whatever they are called).

Since the scaling amount never changes for the background texture once the program is started, this issue would be fixed, if instead of scaling the sprite every frame, the texture/image would be resized to the user's desktop resolution once, during initialization, and the sprite itself won't be scaled in the game loop.

Is there a way to do this?

29
Graphics / Why is VertexArray.myVertices private?
« on: February 18, 2012, 08:15:44 pm »
Quote
No no, don't use VertexArray at all, use the Draw overload that takes an array of vertices directly:
Code: [Select]
window.Draw(&your_vector[0], your_vector.size(), sf::Quads);


Thank you, I wasn't aware you can do that

30
Graphics / Why is VertexArray.myVertices private?
« on: February 18, 2012, 09:29:54 am »
Quote from: "Laurent"
If sf::VertexArray is not good for you then don't use it, take a std::vector<sf::Vertex> instead. There's no magic in sf::VertexArray, it's just a thin wrapper around std::vector<sf::Vertex> provided for convenience.


Thanks for your reply,

Sorry, didn't want to sound like I'm complaining, it's not like it is not good for me, it really improved the performance of drawing lots of particles. It is just currently I have to have a vector of vertices where I can manipulate each of them, end every frame I have to clear the VertexArray and copy each vertex to it.

I thought I was missing something, and there was some other way around this.  

Anyways, I'll keep it the way it is for now, maybe later I'll rewrite it based on your code but with the vector public.

Pages: 1 [2] 3 4 5