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

Pages: [1]
1
DotNet / [SFML2] Using Shaders
« on: January 29, 2011, 04:20:57 pm »
How would I create a shader instance from a file / from a string in SFML.NET 2.0?

I've tried:
Code: [Select]
TestShader = new Shader( "Shader.sfx" );
But I get a LoadingFailedException. The file definitely exists at the specified location.

Shader.sfx is just an example shader:
Code: [Select]
uniform sampler2D tex;

void main()
{
   gl_FragColor = texture2D(tex, gl_TexCoord[0].xy);
}


Loading from a string would be more suitable for my needs, but the LoadFromString() method requires an instance of Shader. I would have expected it to be a static method.

2
Graphics / [SFML 2] Crashing at random time
« on: February 09, 2010, 07:32:34 pm »
I have a load of small sprites (16*16, >64 of them) drawn onto my window each frame. After about one or two minutes, the app crashes with an access violation error:


The variable I use to work out how much the sprites should move (I use the time since they were last drawn) looks like this in the debugger:
Code: [Select]
4.316e-039#DEN

Could this be part of the problem?

Edit: It crashes on a line where I pass the variable mentioned to a function.

3
Graphics / [Resolved][SFML2] OpenGL Drawing texture
« on: January 14, 2010, 09:42:16 pm »
I have a sf::Image that I want to use as the faces of the standard example cube. What steps should I take in order to use it? I made a guess with this:
Code: [Select]
...

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

image.Bind();

glBegin(GL_QUADS);

glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f,  50.f, -50.f);
glVertex3f( 50.f,  50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);

glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f,  50.f, 50.f);
glVertex3f( 50.f,  50.f, 50.f);
glVertex3f( 50.f, -50.f, 50.f);

glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f,  50.f, -50.f);
glVertex3f(-50.f,  50.f,  50.f);
glVertex3f(-50.f, -50.f,  50.f);

glVertex3f(50.f, -50.f, -50.f);
glVertex3f(50.f,  50.f, -50.f);
glVertex3f(50.f,  50.f,  50.f);
glVertex3f(50.f, -50.f,  50.f);

glVertex3f(-50.f, -50.f,  50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f,  50.f);

glVertex3f(-50.f, 50.f,  50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f,  50.f);

glEnd();

...


Where "image" exists, and by simply commenting out the image.Bind() line the cube draws (although white), so the OpenGL part works.

What should I do?

4
Graphics / [SFML 2] Using opengl
« on: December 31, 2009, 11:56:33 pm »
(I'm using VC++ 2008 express)

I'm trying to use opengl in a project, but I keep getting errors similar to this:
Code: [Select]
1>.\main.cpp(23) : error C3861: 'glClearDepth': identifier not found
1>.\main.cpp(24) : error C3861: 'glClearColor': identifier not found
1>.\main.cpp(27) : error C2065: 'GL_DEPTH_TEST' : undeclared identifier
....


There are many more like that, one for each opengl related thing I reference.

I tested it with the opengl example from your tutorials (the errors above are from that). I have included the following things as additional dependencies in the linker settings:
Code: [Select]
glu32.lib
opengl32.lib
sfml-main.lib
sfml-system.lib
sfml-window.lib
sfml-graphics.lib


What could the problem be?

5
SFML projects / Hexagon Puzzle Thing
« on: December 28, 2009, 11:04:29 pm »
Just about finished my simple puzzle game. Got this far in about 2 days, thanks to SFML!



How to Play:

* Like minesweeper, try and work out where the mines are in the grid without clicking on them.

* When you click on a tile, it will give you two pieces of information:

- The colour of the tile tells you where the nearest mine is. A green tile is touching a mine, and a blue one is 2 tiles away from a mine.

- The number(s) on the tile tell you how many mines are near it. The green number tells you how many mines are in the neighbouring 6 tiles, and the blue number tells you how many mines are two tiles away from it.

- If you mouse over a tile, you will see two rings of tiles lit up around it, blue and green. This helps you see which tiles are next to the one you moused over, and which are two tiles away.

* If you want to remember where you worked out a mine is, right click on it to flag it. While flagged, you can't accidentally blow it up.

* If you find that you mistakenly flagged a tile, just right click on it again to de-flag it.

* If you click on a mine, you lose 50 points.

* The game ends when the mines are all located.

Download
http://www.robertandsherman.co.uk/downloads/hexpuzzle-0-1.zip - ( 1.22 mb )

6
Graphics / Drawing text onto an image?
« on: December 28, 2009, 05:51:45 pm »
Is it currently possible to draw from a sf::String onto a sf::Image?

I have a lot of tiles in my game which can have numbers written on them, but having lots of sf::Strings being drawn at once can slow it down a lot. If I could use a sf::Image as a buffer and draw the strings to it only when they change, I could speed the game up greatly.

Thanks in advance.

7
Graphics / Drawing onto transparent target
« on: December 27, 2009, 10:57:07 pm »
I can't draw onto a texture with Image.Copy() with applyAlpha = true if the area being copied onto has 0 alpha (the alpha is inherited for some reason). Any way to counter this without doing it pixel by pixel?

Pages: [1]