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

Pages: [1]
1
DotNet / Re: 2 questions regarding shaders and the entity example.
« on: September 27, 2013, 05:23:27 pm »
Bah, sorry must have forgotten. But it works now! :D At first i found it strange that it didn't work, but am i correct that you pass the texture like this?:

Code: [Select]
Shader shader = new Shader( "media/shaders/basic.vert", "media/shaders/basic.frag" );
shader.SetParameter( "texture", Shader.CurrentTexture );
RenderStates rState = new RenderStates( shader );
rState.Texture = texture;

2
DotNet / Re: 2 questions regarding shaders and the entity example.
« on: September 27, 2013, 03:38:33 pm »
I updated the code at the same link: https://gist.github.com/arxae/71ff6c188162d8b2c0d8
Took a different texture, one that is not black/white. But now it displays nothing at all anymore

3
DotNet / Re: 2 questions regarding shaders and the entity example.
« on: September 27, 2013, 02:03:40 pm »
Entity thingy works now :D One down :p

Shaders still don't work, i copied the minimal shaders given on your tutorial page (http://www.sfml-dev.org/tutorials/2.1/graphics-shader.php) but still just a black square.
vert
Code: [Select]
//gl_Position = ftransform();

void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
}
frag
Code: [Select]
uniform sampler2D texture;

void main()
{
vec4 pixel = texture2D(texture, gl_TexCoord[0].st);
gl_FragColor = gl_Color * pixel;
}

4
DotNet / Re: 2 questions regarding shaders and the entity example.
« on: September 27, 2013, 01:21:41 pm »
The shaders are also in the gist, at the bottom. or what do you mean fixing the shaders? :p

And maybe calling it system is kind of a stretch, but it's from this page: http://sfml-dev.org/tutorials/2.1/graphics-vertex-array.php
About halfway down the page

5
DotNet / Re: 2 questions regarding shaders and the entity example.
« on: September 27, 2013, 11:57:29 am »
Yay, fast response :p

The title of the tutorial was Designing you own entities with vertex arrays, the Creating a SFML-like entity part, sorry my bad :)

using Shader.CurrentTexture doesn't work, the square is still completely black.
Problem 1 and 2 are sepparate btw. I think you mean that i want to draw Shaders with the entity system, but i just switch the draw statement to the entity when i wanted to test that. If that is the case, sorry for being conusing :P

6
DotNet / 2 questions regarding shaders and the entity example.
« on: September 27, 2013, 11:30:45 am »
Hi, i'm a bit new to SFML and the whole graphics programming stuff, but SFML has been really helpfull in learning it all. I've looked at the tutorials on the site and some others and got the basics down (moving a sprite around, even got box2dx working). But there are 2 problems that i have no idea what i'm doing wrong.

It is probably really obvious, but sometimes you need someone to press your face against the issue :P

It's a small project test project, so some variables might be badly named: https://gist.github.com/arxae/71ff6c188162d8b2c0d8

Problem 1, shaders:
I draw a quad and try to apply a texture to it using shaders, but all i get is a black square. The texture itself is the black and white 2x2 block from tetris.
Side question: i presume using a shader on a sprite works the same as drawing a quad. Because if it is, my second problem isn't that huge :p

Problem 2, the entity example:
I followed the entity example from the C++ tutorials. Drawing works, the problem is that if pass a new vector2f to it to change it's position, it doesn't do anything.
The tutorial says that i should use getTransform(), but that method is not available in the C# bindings.

Can i get any assistance on this? It's been bugging me for the past week and i really wan't to know what i'm doing wrong here :p

Pages: [1]
anything