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

Pages: [1]
1
DotNet / Re: Updated from 2.0 RC to 2.0, now shader doesn't work
« on: June 25, 2013, 04:44:43 pm »
No problem, seems like I always forget to mention some important piece of information  :)

Anyway, I took those lines out of the main project and created a new project with only those lines and it seems to work by itself with the new libraries.  So it must have something to do with the order I am doing things.  I'll have to try to reorder some things to see if anything changes.

2
DotNet / Re: Updated from 2.0 RC to 2.0, now shader doesn't work
« on: June 24, 2013, 08:37:31 pm »
Thanks for the reply.  Mixing up the DLL versions is definately a possibility that crossed my mind.  When I updated I copied the 32 bit DLLs to my bin/debug and also bin/Release directories.  I am reasonable sure that I'm doing this right because I've copied the RC dlls back into the directories to get it back into a working state for now.

These are the dlls I am copying.  I don't use any of the audio ones.
  • csfml-graphics-2.dll
  • csfml-window-2.dll
  • sfmlnet-graphics-2.dll
  • sfmlnet-window-2.dll

It's always been my understanding that when using sfmlnet dlls that the csfml dll also need to be present because the sfmlnet dll refer back to the csfml dll for all of the actual functions.  I've seen before that if they are not present you get an error that they can not be found.

Also, in my VS2010 project I have references added for sfmlnet-graphics-2.dll and sfmlnet-window-2.dll.

I've been working on this program off and on since SFML 1.6  :) and I've been using this same setup the whole time.

3
DotNet / Updated from 2.0 RC to 2.0, now shader doesn't work
« on: June 24, 2013, 05:57:28 pm »
Hi,

I've been developing an application that uses SFML for visualizing data.  I was using 2.0 RC but finally updated to the 2.0 release today and found that my code related to a fragment shader no longer works.  Here is the code with the issue:

Code: [Select]
private Shader shader;

private RenderStates states;

shader = new Shader(null, "colormaps\\threshold_and_colormap.frag");

states = new RenderStates(shader);


I don't get any compile errors.  This is pretty barebone, but I get an runtime error on the last line the states

EntryPointNotFoundException was unhandled:  Unable to find an entry point named 'sfTransform_create' in DLL 'csfml-graphics-2'.

Also, I am not sure if it matters but here is the shader code.  This worked in the RC so I dont think it is the problem.

Code: [Select]
uniform sampler2D tex;
uniform float lowThreshold;
uniform float lowColormapLimit;
uniform float highColormapLimit;

uniform sampler2D colormap;

void main()
{
//read data in
vec4 pixelIn = texture2D(tex,gl_TexCoord[0].st);

//if all all channels are 255 this is the code for no data present
if ((pixelIn[3] == 1.0) && (pixelIn[2] == 1.0) && (pixelIn[1] == 1.0) && (pixelIn[0] == 1.0))
{
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}
else
{
//calculate the value of the pixel
float dataValue = pixelIn[3] * 4294967296.0 + pixelIn[2] * 16777216.0 + pixelIn[1] * 65536.0 + pixelIn[0] * 256.0;
vec4 newcolor;

//apply the low threshold
if (dataValue < lowThreshold)
{
newcolor = vec4(1.0, 0.0, 0.0, 1.0);
}
else
{
int index = int((dataValue - lowColormapLimit) * (255.0/(highColormapLimit - lowColormapLimit)));
if (index < 0)
{
index = 0;
}
else if (index > 255)
{
index = 255;
}
newcolor = texelFetch(colormap, ivec2(index, 0), 0);
}
gl_FragColor = newcolor;
}
}


So did anything change in the way shaders are used in the 2.0 release?  Any help would be appreciated.  Thanks

4
DotNet / Texture Pixels using floats?
« on: July 09, 2012, 10:57:50 pm »
Hi,

I am trying to use SFML for some data visualization.  I'm having some good success but I think my conversion can be simplified.  My source data is 32 bit uint and can't be changed.  Right now this is how my data gets processed.

2D uint array -> 8 bit rgba -> SFML.Image -> SFML.Texture -> SFML.Sprite

Then after the data is a sprite, I can do some very cool things with a GLSL fragment shader like assigning colormaps and thresholds to the data :)  When I do the calculations in GLSL the pixel data is a float, although I don't know where this last conversion is done.

My question is, is there someway to bypass the conversion to 8 bit rgba?  If I could go directly from the source uints to floats that would seems to be the best option.  Depending on my GLSL calculations converting to 8 bit rgba could cause me to lose resolution in my final displayed result.  I don't know openGL very well but from the research I've done it seems to support this.  Am I going to have to bite the bullet and put some openGL calls in my C# code?

5
DotNet / Re: Create Image from 2D array
« on: April 20, 2012, 04:59:22 am »
Isn't this the convention that normally used?  Though I'm not saying that it is just a matter of convention, the underlying code seems to expect [y,x] but the .Net constructor uses [x,y].  If this is the case than this constructor wouldn't work for anything that is not a square 2D array.  I am not able to get it to work with nonsquare arrays.

I did manage to get it working by using the other constructor for a flattened byte array instead of the 2D color array.  If this flattened array were reformed into a 2D it would follow [y,x] convention.  Heres the code:

Code: [Select]
int sizex = 127;
            int sizey = 256;

            byte[] imageColor = new byte[sizex * sizey * 4];

            for (int j = 0; j < sizey; j++)
            {
                for (int i = 0; i < sizex; i++)
                {
                    //red channel
                    imageColor[j * sizex * 4 + 4 * i] = (byte)i;

                    //green channel
                    imageColor[j * sizex * 4 + 4 * i + 1] = (byte)j;

                    //blue channel
                    imageColor[j * sizex * 4 + 4 * i + 2] = 0;

                    //alpha channel
                    imageColor[j * sizex * 4 + 4 * i + 3] = 255;
                }
            }           

            SFML.Graphics.Image image = new SFML.Graphics.Image((uint)sizex, (uint)sizey, imageColor);

            Texture texture = new Texture(image);

            Sprite sprite = new Sprite(texture);

            app.Draw(sprite);

            while (true)
            {

                app.Clear();
               
                app.Draw(sprite);
               
                app.Display();

            }

I did try to have a look through the source code to try to get an idea of whats going on.  The only thing I could find is the constructor in Image.cpp, but by that point width and height are already separately and probably correctly :) defined.  Where would I find the code for the .Net constructor if I wanted to take a look at that?

6
DotNet / Create Image from 2D array
« on: April 18, 2012, 09:34:19 pm »
I was having a problem creating an image from a 2D color array.  After some troubleshooting I think I narrowed it down to a bug.  If I do the following:

Code: [Select]
            SFML.Graphics.Color[,] imageColor = new SFML.Graphics.Color[256, 256];

            for (int j = 0; j < imageColor.GetLength(0); j++)
            {
                for (int i = 0; i < imageColor.GetLength(1); i++)
                {
                    imageColor[j, i] = new SFML.Graphics.Color((byte)i, (byte)j, 0);
                }
            }

            SFML.Graphics.Image image= new SFML.Graphics.Image(imageColor);

            Texture texture = new Texture(image);

            Sprite sprite = new Sprite(texture);

            app.Draw(sprite);

            app.Display();

I get a nice square image with the red color increasing in the X direction and the green color increasing in Y.  But if I change the array dimension so that it is not square the image is no longer drawn correctly.

It seems like the image constructor is mixing up the dimensions, when the array is not square it sets X size equal to dimension(0) and Y size equal to dimension(1).  This should be the opposite correct?  The data seems to be copied correctly, but because the width and height are wrong the image is not drawn right.

The code above was from the 2.0 RC but 1.6 seems to have the same behavior.  Am I doing something wrong here or is this really a bug?

Pages: [1]