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

Pages: [1]
1
Thanks for the suggestion! I'll experiment with this.

2
Graphics / Efficient way to work ontop of a static image each frame
« on: April 23, 2012, 01:02:19 pm »
Hi,

I'm doing something which is similar, but not quite the same as, rendering a movie.

Every frame, I need to override pixel data with CPU operations on top of a read-only sf::Image "staticImage" (this never changes over all frames) - e.g. i'm looking to copy, change, and send the data of the static image extremely efficiently.

Currently i'm just doing:
   
Code: [Select]
dynamicImage.create(staticImage.getWidth(), staticImage.getHeight(), sf::Color(0,0,0,0));
dynamicImage.copy(staticImage, 0, 0);

dynamicImage.setPixel(...);

dynamicTexture.loadFromImage(dynamicImage);


- Could anyone help explain to me to a faster way to do this: I looked at sf::RenderTexture but wasn't sure whether or how I could use this in my situation. I'd like to support larger images, e.g. 8192 x 8192, but currently copying in the way above is about 1 FPS for such sizes.

Thanks

3
Graphics / Porting "Fullscreen" Shaders
« on: March 17, 2012, 11:37:56 am »
Haha yeah ;) namespace SF = sf; to be consistent with the previous work - thankfully that's the only major change in style though now that your using lowercase camelCase :)

4
Graphics / Porting "Fullscreen" Shaders
« on: March 16, 2012, 06:28:34 pm »
Thanks for the quick reply!

1. Sorry, there's no problem with this at all - I just thought their may have been "GetScreenVertices()" or something - but setting vertices each frame works well:

Code: [Select]
const SF::Vertex vertices[] = { SF::Vertex(SF::Vector2f(0.0f, app.getSize().y)), SF::Vertex(SF::Vector2f(app.getSize().x, app.getSize().y)), SF::Vertex(SF::Vector2f(app.getSize().x, 0.0f)), SF::Vertex(SF::Vector2f(0.0f, 0.0f)) };

Simple is good for this library and its intentions :)

Thanks.

5
Graphics / Porting "Fullscreen" Shaders
« on: March 16, 2012, 02:25:15 pm »
Hi,

I'm porting some work to SFML - I need to apply fullscreen shaders to the entire window render area, instead of just a texture rectangle. I see you can draw shaders by specifying vertices, but after trying:

Code: [Select]

const SF::Vertex vertices[] = { SF::Vertex(SF::Vector2f(-1.0f, 1.0f)), SF::Vertex(SF::Vector2f(1.0f, 1.0f)), SF::Vertex(SF::Vector2f(1.0f, -1.0f)), SF::Vertex(SF::Vector2f(-1.0f, -1.0f)) };
target.draw(&vertices[0], 4, SF::PrimitiveType::Quads, states);


1. I found it doesn't use normalized coords - how can I therefore draw to the entire window render area efficiently (do I really have to recreate 4 vertices from the app size each frame)?

2. I need to use "uniform mat4" for several of my shaders. Do I just do it manually with glUniformMatrix4fv(..., 1, GL_FALSE, &viewMatrix[0][0]); ?

3. I was looking at the code, I noticed setParameter is called in the update loop, which implicitly does: GLint location = glGetUniformLocationARB(m_shaderProgram, name.c_str()); - isn't this slow when you have quite a lot of parameters? What about providing a int getFastParamID(...)  to call in init, then instead of having strings force users who don't care about optimizations to do setParameter(getID("name"), ...) - but this allows users who do care about performance to just send the private GLint from the init - do you think this'll make much difference? (I don't know much about the framework/principles/conventions in SFML yet though so may have missed something)

4. (Offtopic) Is there an easy way to use subpixel font rendering/expose it from freetype? - I haven't looked into this yet.

- P.S. Thanks so much for keeping SFML lightweight! :wink:  I was very happy to see the output size, with static linking, so small.

Pages: [1]