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

Pages: 1 [2]
16
DotNet / A few design questions
« on: March 02, 2012, 09:35:54 pm »
Why is renderWindow.Height and Width "uint" instead of "int" ?
Sure, they cant be negative, but the casts are unnecessary.
Size, Rectangle and other classes / structs in the DotNet environment are just int to make handling easier (no casts).
Is there any real reason to keep uint ?

The next thing is less a question, more like a bugreport.
The Events of "RenderWindow" shold begin with "OnX"
That means, OnResize, OnLostFocus, OnWhateverHappend.
See: http://msdn.microsoft.com/en-us/library/ms229045.aspx


Is CPointer of any use in the .NET environment ?
Of course it might be needed to have the pointer to the object ready in case its needed by the wrapper.
But that's and implementation detail, which should be "private".
Unless of course you can do something nice with it. (Please explain)

What do PushGLStates(), PopGLStates() and ResetGLStates() do?
When should they be used? What can they be used for?

What direction is "up" ?
Mouse coordinates are returned with +Y equals downwards, that also matches with how vertices are defined.
But shouldn't +Y be upwards in openGL ? Is this a SFML specific thing ?
I don't care what way is upwards as long as it is consistent over all the stuff that SFML provides.

Btw:
Is there any way to clip stuff ? Like a clip region ?
I've seen that in some other engines.
I think its drawing to the stencil buffer, then setting the stencil buffer as blend mode or something like that.
Or is the only available way for this using RenderTextures?
I don't have anything against them, but is there a limit on how many of those you can use ?

Thanks for the awesome libaray btw.
I really love it.

17
DotNet / Rotate images while batching
« on: March 02, 2012, 07:38:24 pm »
Ah, sorry.
Yes it is a bit slow. I tested it without calculating Cos/Sin and performance increases by 10%.

Quote

It will not compute the cosine for you.

Some NVidia GPUs can calculate both sine and cosine of an angle in one single hardware tick. "__sincosf"

Shaders (min SM1.1) can compute cos and sin too, but I don't know if it's as fast.

Can't I use that somehow ?

18
DotNet / Rotate images while batching
« on: March 02, 2012, 05:28:02 pm »
I didn't make myself clear sorry.
I used a tile map only as an example for rotations of 90 degrees.
You are right it doesnt make any sense to rotate tiles by steps other than 90°.

I want arbitrary rotation for something else.
For my particle system I need to rotate the particles arbitrarily.

Currently I'm taking the angle and get the sine and cosine value of it to offset the position of each vertex.

That works, but I wonder if it isn't possible to just give the angle to the GPU, and let the it to the trigonometric functions while its rendering.

Because one call to Math.Cos is nearly as slow as a Dictionary lookup...

Without batching performance is horrible, but thanks to the new access to vertexarrays stuff became MUCH faster.

After the number of drawcalls (that problem is resolved thanks to vertex arrays), the transformation / rotation seems to be the biggest resource hog.

19
DotNet / Rotate images while batching
« on: March 02, 2012, 04:10:33 pm »
Hi,

im using the new vertexarray introduced in SFML2 to batch all the tiles from my tile map.
I add all the quads to the vertex array and set the texture coordinates accordingly.
This works good.

I can rotate the tiles in steps of 90°, or mirror them by swapping the texture coordinates.
But how can I rotate the image by an arbitrary value ? For example 15°

Do I have to rotate my vertices by the required value myself ?
Applying a series of trigonometric functions to every vertex doesnt seem to be the correct way, because its relatively expensive to do those calculations every frame.
Can I somehow utilize the GPU to do that work for me ?
If so, how ?

I know I can use Sprite and set its Rotation to the desired value, but will using "Sprite" still make use of batching ?? I think not, but correct me if I'm wrong

20
DotNet / Threaded window disappears, still thinks its open?
« on: March 02, 2012, 03:29:42 pm »
The problem is that the process terminates maybe because the Main function returns...

Code: [Select]

 static void Main(string[] args)
        {
           
            thread.Start(); //window will immediately disappear
            //run(); //runs fine

while(true)
{
// Sleep or do anything else here to prevent the process from exiting.
Thread.Sleep(100);

}

        }



Try this!

Pages: 1 [2]
anything