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.


Topics - Rob92

Pages: [1]
1
DotNet / Multi-threaded rendering SFML .net
« on: April 21, 2016, 09:21:33 am »
Hello,

I want to create a loading screen with SFML .NET.
I read this:

http://www.sfml-dev.org/tutorials/2.0/graphics-draw.php

but there's no sfml thread in C# version of SFML.
or do I need to add some another module to my project?

2
DotNet / How to use Opengl 3.x in SFML
« on: April 16, 2016, 10:13:56 pm »
Hello, I'm trying to modify the standard vertex and fragment shader to be used with version 330.
Is it possible to do this without directly using opengl?

This is the vertex shader I'd like to use:

#version 330 core

layout(location = 0) in vec2 in_position;
layout(location = 1) in vec3 in_color;
layout(location = 2) in vec2 in_tex_coord;

out vec4 v2f_color;
out vec2 v2f_tex_coord;

uniform mat4 mvp;

void main()
{
    gl_Position = mvp * vec4(in_position.x, in_position.y, 0, 1);
        v2f_color = vec4(in_color, 1);
        v2f_tex_coord = in_tex_coord;
}

I draw to the render window using the VertexArray class.
Is it possible to get the model view projection matrix and send it to the shader?
Also, how would I go about sending "in" values to the vertex shader using sfml?

Or do I just have to go back to version 120 in order to not be bothered directly with opengl?

3
DotNet / [Solved] Audio Listener doenst seem to be working.
« on: April 01, 2016, 10:56:44 pm »
I'm trying to use the Listener in a 2D world.
I have a mono channel .WAV sound buffer which I play through a Sound.

            s.Position = new Vector3f(position.X, 0.0f, position.Y);
            s.Attenuation = 1.0f;
            s.RelativeToListener = true;
            s.Play();
 

I have set the Listener.Position to the same position as the Sound.
But I hear nothing, only when I make Attenuation 0.001 I hear something softly, but then it doesnt seem to matter what the Sound's position is. Even when I make the difference huge, the sound remains the same volume through my speakers.
Also, the Listener.GlobalVolume is set to 100.0f

Am I doing something wrong here?

4
DotNet / High CPU usage with very basic SFML program
« on: March 24, 2016, 03:13:22 am »
I have really high cpu usage (max for 1 core) for my sfml program.
At first I thought it was something in my framework but the profiler showed that 97% of all performance came from external code.
So I created a very basic SFML program and I have the same issue:



Yellow text is Fraps, confirming the program runs with 60 fps.
The only way I get the cpu to calm down abit is by manually letting the thread goto sleep, but even then its using way more than I would expect.

Any thoughts?

5
DotNet / SetParameter not working with integer
« on: March 17, 2016, 02:15:07 am »
Hello again  ;D

A while ago I posted this thread on C++ side of SFML:

http://en.sfml-dev.org/forums/index.php?topic=19872.msg143047#msg143047

I had problems using integers with shader->SetParameter. People suggested me to build the latest version of the SFML source and use the new functino: SetUniform instead.
This worked, however, SFML .NET version seems to have to old SetParameter function, and the problem I had in my previous post has returned.

Are there any plans of updating the .NET version to SetUniform as well?

Thanks,

Rob

6
DotNet / I need the Transform.GetMatrix() function but it isn't there!
« on: March 13, 2016, 07:44:10 pm »
Hello,

So I need to access some values from the matrix, in C++ I used to call transform.getMatrix() but there doesnt seem to be a function like this in the .NET version of SFML.

Why not?
And how can I still access the individual values of the matrix?

7
I am batching sprites whi use same texture together in 1 draw call.
The sfml forum suggested that i do scene graph by using the transform component in renderstates.
However, i now use different sprites with same renderstates since theyre batched.

Do I need to create more draw calls or compute matrices of local and world seperatly?

8
Graphics / How to do shaders on the frame buffer correctly?
« on: February 27, 2016, 08:00:03 pm »
I want to apply a fragment shader to the screen, so I can manipulate the frame buffer.

At the moment I am doing it like this:

if (m_frameBufferStates.shader != nullptr)
{
        m_frameBufferTexture.update(*m_window);
        m_frameBufferSprite.setTexture(m_frameBufferTexture);
        m_window->draw(m_frameBufferSprite, m_frameBufferStates);
}

I noticed that this cost me a substantial chunk of performance. (because of sf::Texture update function)
I still have more than enough FPS but I was wondering if there is a better way to do this?

9
I'm getting this error when I try to set a uniform in my fragment shader:

An internal OpenGL call failed in Shader.cpp(286).
Expression:
      GLEXT_glUniform(location, x)
Error description:
      GL_INVALID_OPERATION
      The specified operation is not allowed in the current state.


I'm simply trying to set a uniform int in my fragment shader.
Good thing to note: This error does NOT occur when I build in Release mode, just in Debug mode.

10
Graphics / How to add a range of vertices to a sf::VertexArray?
« on: February 16, 2016, 02:12:53 am »
I was wondering if it is possible to add more than 1 vertex at a time to an sf::VertexArray.
At the moment I use the append function but I thought that I might be able to increase performance by adding multiple vertices at once. Is that possible without modifying the source code?

11
Graphics / [Solved] Need help with drawing Text using VertexArray
« on: February 11, 2016, 02:51:47 pm »
I'm trying to draw text using the sf::VertexArray because then, my text is drawed in the same place and way as my sprites and its easier for me to manage things like draw order and its overal more consistent.

I have sprites working but with text it looks as if the vertices are in the wrong order (see attachment)

I have simply taken the origin sf::Text source code and modified it to fit my needs (I kept the vertex append order the same).

      // Add a quad for the current character
                        m_vertices.append(Vertex(Vector2f(x + left - italic * top, y + top), m_color, Vector2f(u1, v1)));
                        m_vertices.append(Vertex(Vector2f(x + right - italic * top, y + top), m_color, Vector2f(u2, v1)));
                        m_vertices.append(Vertex(Vector2f(x + left - italic * bottom, y + bottom), m_color, Vector2f(u1, v2)));
                        m_vertices.append(Vertex(Vector2f(x + left - italic * bottom, y + bottom), m_color, Vector2f(u1, v2)));
                        m_vertices.append(Vertex(Vector2f(x + right - italic * top, y + top), m_color, Vector2f(u2, v1)));
                        m_vertices.append(Vertex(Vector2f(x + right - italic * bottom, y + bottom), m_color, Vector2f(u2, v2)));

for (size_t i = 0; i < m_vertices.getVertexCount(); i++)
                        m_batch->addVertex(m_vertices[i]);

Can anyone help me figure out the correct order to add the vertices?

(the text should spell "Hello!")

Pages: [1]