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

Pages: 1 ... 3 4 [5] 6 7 ... 17
61
General discussions / Re: sf::Shader -- API to set uniforms
« on: April 21, 2014, 12:54:11 pm »
I think adding a matrix class would be the start to adding more and more of a math library and IMO thats only wasting time. In the end people will prefer a real math library like glm anyway and possibly get problems converting to the SFML type.
Maybe for SFML3 consider removing the vector and rectangle types and just including glm to streamline the library? Its easy to use as its a header only library and fits well to GLSL.

62
You seem to be thinking including a header would link a library; thats wrong. A header normally does only contain declarations that the compiler can use.
Library building and linking is a separate concept that depends on how you use the library archiver or linker program and only uses object files and library files.

63
General / Re: Does sf::Context need to be in scope?
« on: March 16, 2014, 01:32:01 pm »
Thats so wrong. What can happen is the main thread reads the id values, starts using 1, 2 or 3 of the buffers, then you change the struct, maybe the main thread uses 1 or 2 old and 1 or 2 new buffers, you delete the buffer that is in use while its still being drawn from or maybe even before its bound, then the main thread will try to bind, use or unbind the deleted buffer or never unbind it depending on if it saved the id.
At least you need a mutex to protect from this, but its better to avoid shared data and only send a message through a suitably threadsafe message queue to the main thread with the id numbers of the new buffer and then let the main thread remember which buffer to use and delete its buffers itself on a time where it does not mess up.

64
General / Re: Does sf::Context need to be in scope?
« on: March 15, 2014, 08:37:57 pm »
I know you tried to call glFinish, but from what you wrote you did not communicate that this happened back to the other thread before using the buffer.

65
General / Re: Does sf::Context need to be in scope?
« on: March 14, 2014, 02:05:19 pm »
Seems you are using the buffer before its uploaded. When a call returns it most of the times only means it has buffered a work item for the hidden OpenGL thread, not that its already done all work. glFlush is like saying, stop buffering up all work and actually start doing it (though you still dont know when it is completed).
If you want to be safe you probably need to put glFinish (or use some fences and check for when something is ready, to avoid having that thread wait till the whole queue drains) and only after that communicate to the main thread that the buffer is usable. Or take a slight gamble, choose some x and wait x+1 frames  before using it while assuming it wont buffer more than x frames of commands.

I think the easiest thing would be to restrict OpenGL calls to a single thread and let the worker threads only do things like loading from disk and unpacking, then inform the main thread of needing to make the needed buffer call for gpu upload.

66
If you bind a buffer you need to unbind it when you are done by binding 0.
http://www.opengl.org/wiki/GLAPI/glBindBuffer

67
Feature requests / Re: Make Transform extensible with "protected"
« on: March 08, 2014, 12:20:23 pm »
Yeah, SFML is very nice for 2D and its also possible to use only some of its subsystems, but at some places inside a subsystem its made so airtight that its near impossible to find a good hook for extending without doing everything yourself.
In your place I would just use glm for all calculations and then find a way to use your matrix, even if you need to use OpenGL calls after creating the Window or RenderTexture, because for 3D you need OpenGL anyways. You may need some calls to setActive or reset/push/popGLstates, if you want to keep doing some 2D drawing through SFML, but that should be no real problem for you.

68
Graphics / Re: SFML and OpenGL: getting pixels from RenderTexture
« on: March 07, 2014, 06:48:27 pm »
Why do you need a single color value? I hope you dont call that code in a loop, because then you should cache the texture reference and image.
Maybe its enough if you change your code to use the texture data directly by creating a sprite from it or reading from inside a shader?

69
Window / Re: How to simulate keyboard/mouse press with SFML?
« on: March 07, 2014, 06:41:15 pm »
That reads as if you include your root password in plain text inside your program. That is very unsecure and you should never do it. I think there are some other ways that avoid this, maybe try a websearch.

The forumsearch is bugged slightly, you need to choose some subforums to search first as it wont search the whole thing at once.

70
Audio / Re: Possible bug in the Audio Module with listeners?
« on: March 05, 2014, 09:55:21 pm »
The article explains why a z=0 listener is a bad idea and why a Listener2D won't work as easily as one might imagine. It was an answer to therocode's suggestion and has nothing to do with "too complicated", because it's not what SFML will provide in any way. Please don't take sentences out of context; furthermore I wasn't the one who wrote it would be too complicated for beginners.
I would think when implementing a 2D listener one would automatically map the 2D vector to x and z, if the up vector is still hardcoded to (x,y,z)=(0,1,0), to make it possible to position it anywhere on the y=0 plane.


Btw., if you dont want to change the interface atm, I think fixing up weird inputs in a way similar to this might be a good idea:
void Listener::setDirection(float x, float y, float z)
{
    priv::ensureALInit();

    y=0.0f;
    if(x==0.0f && z==0.0f)
        z=-1.0f;
    float orientation[] = {x, y, z, 0.f, 1.f, 0.f};
    alCheck(alListenerfv(AL_ORIENTATION, orientation));
}
 

71
For static variables, aren't there destroyed automatically ?
Thats a static function, not a static variable. :-X

72
Feature requests / Re: Extremely minimal support for 4x4 transforms
« on: February 25, 2014, 12:19:43 pm »
While you are at adding support for more dimensions, I can add I often thought it would be nice to be able to give a z coodinate to shapes/sprites/... .
That would be nice to use the z buffer for layering sprites, for example, 1st layer rain/snow, 2nd a bit deeper characters, 3rd trees/other objects, ..., 2nd last floor, last sky. They could then be drawn in the most convenient order without having to follow the painters algorithm.
Drawing a GUI could also profit from reordering some windows by setting a z-order.
Though blending may need to be tweaked to make it look right.

73
General / Re: Quadtrees
« on: February 25, 2014, 11:54:52 am »
Seems you are thinking backwards. You found some data structure (somehow its a habit in many internet-forums to tell everyone to make an octtree/quadtree first), you only half understand it and then you try to find some problem to apply it to, when normally you should have a problem first and then try to find a good solution. This will only complicate your program for no gain if you dont have a huge number of objects.
Calculating some bounding spheres to test against each other is much easier and if its really too slow after completing your game and profiling you can still change it.

74
SFML projects / Re: SFNUL
« on: February 23, 2014, 09:16:00 pm »
The old style replacement for noexcept (with a slightly different meaning) would be an empty "throw()" clause.

75
SFML website / Re: maybe tone down the white background a bit
« on: February 15, 2014, 11:43:13 pm »
IMO a monitor should be setup to truthfully show all colors and with right gamma. Screwing up the settings just because its fashionable to use white background on most websites feels very wrong.
Though its too widespread nowadays, so just changing one website will not help very much, therefore turning on the light to not sit in a completely dark room is a good idea.

I once read it was possible to supply a local css file for a browser to replace all websites css files for people that cant see well, maybe thats an option for you.

Pages: 1 ... 3 4 [5] 6 7 ... 17
anything