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

Pages: 1 2 [3] 4 5 ... 9
31
Graphics / Maximum amount of RenderImages?
« on: July 17, 2011, 01:25:10 pm »
Is there a maximum amount of RenderImages that a graphics card can support? I'm currently programming mostly on my laptop, which only has an integrated graphics chip, and I'm running into seemingly unrelated problems of flickering screens when working with RenderImages.

And what happens when I create more than the maximum amount? Will different RenderImages start to target the same data?

32
Graphics / Shader not working on "newer" machines
« on: July 03, 2011, 12:12:33 pm »
Alright, here's a basic example of how to use the shader code:

Code: [Select]

#include <sfml/graphics.hpp>
#include <sfml/window.hpp>

int main()
{
    sf::RenderWindow window;
    window.Create(sf::VideoMode(800,600,32),"test");

    sf::Image i; i.LoadFromFile("load your favourite bitmap here");
    sf::Sprite spr(i,sf::Vector2f(300,300));
    sf::Shader bloomblur;
    bloomblur.LoadFromFile("put the shader in a text file and put it here");
    bloomblur.SetTexture("texture", *spr.GetImage());
    bloomblur.SetParameter("target_size",spr.GetSize());
    bloomblur.SetParameter("scale", 3.0f);

    bool running = true;
    while(running)
    {
       sf::Event e;
       while(sf::PollEvent(e)
       {
            if(e.Type == sf::Event::KeyPressed)
                 running =false;
       }

       window.Clear(sf::Color::Green);
       window.Draw(spr,bloomblur);
       window.Display();
    }
    return 0;
}


I've hacked this into the browser, so it may not work initially, however, since all of you know how to set up a basic application you should be able to fix it quickly.

It should work though.

33
Graphics / Shader not working on "newer" machines
« on: June 29, 2011, 08:37:27 pm »
They certainly are. I also doubt that this is a driver problem.

Has anyone here tried the shader? It's not that hard to test. Just draw a sprite using this shader, and set the values of the variable to whatever you want them to be.

34
Graphics / Shader not working on "newer" machines
« on: June 29, 2011, 02:14:15 pm »
The 2.0 version as of about a week ago. I already thought about the ATI bug, but that (to my knowledge) has been fixed a long time ago.

35
Graphics / Shader not working on "newer" machines
« on: June 28, 2011, 01:34:45 pm »
of course I do. Otherwise it wouldn't work no my laptop, either. Target size is simply the size of the sprite (width/height), scale is just a factor that I send to the shader every frame, and the texture is the image of the sprite itself.

36
Graphics / Shader not working on "newer" machines
« on: June 28, 2011, 12:42:37 pm »
If I put that at the top of the shader it fails to compile the shader, telling me that this version is not supported by GL2.

Putting "#version 110" compiles, but it doesn't fix the problem on the other machines (shader still doesn't show anything).

37
Graphics / Shader not working on "newer" machines
« on: June 26, 2011, 09:37:57 pm »
Hey, I have this shader in my program:

Code: [Select]


uniform sampler2D texture;
uniform vec2 target_size;
uniform float scale;

vec4 bloom(vec4 original)
{
   return original*scale;
}

void main()
{
   vec4 color = texture2D(texture,gl_TexCoord[0].xy);
   vec2 step = scale/target_size;
   //right and left
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(step.x,0.0));
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(-step.x,0.0));
   //up and down
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(0.0,step.y));
   color *= texture2D(texture,gl_TexCoord[0].xy + vec2(0.0,-step.y));
   gl_FragColor = bloom(color);
}


It's a simple blur+bloom shader (I think it's gaussian blur, although I'm not sure about the terminology), which blurs the image according to a factor (bigger factor = bigger blur) and blooms it, also depending on the factor.

This shader runs on my really crappy old laptop, with Intel Integrated Graphics set (which uses software 2D rendering), but not on the PCs of two other people who tested the application. Both have ATI graphics cards (one of them has got a HD 5770, the other one a pretty new mobile graphics card).

A more simple shader, like this:

Code: [Select]

void main()
{
     gl_FragColor = vec4(0.0,1.0,0.0,1.0);
}


however, works perfectly fine with them and simply draws a green rectangle to every sprite that it is applied to.

What could this be? Could it be that "newer" graphics cards( HD 5770 isn't exactly new though, afaik OpenGL 3.0 ? ) don't support gl_TexCoord etc. anymore?

38
Graphics / Tile based theory
« on: June 09, 2011, 07:36:07 pm »
You should consider the tradeoffs though - if you have large maps and want to use only one sprite per type to render everything, you're going to need to set all of its necessary data for ever time when you render the Sprite. This can cost a lot of performance, especially when you need to set more than just position (for example rotation, scale, subrect, etc.).

So you'll have to think about what you want: Maximum runtime performance or minimum memory requirement. Sprites will cause a overhead in memory, but it really isn't that much. One Sprite in memory will maybe be something like 400-500 or so bytes big, so 1000 tiles would just create an overhead of about 50kB, which is absolutely nothing in todays terms.

On the other hand, a couple of function calls almost won't cost any performance on today's CPUs either, especially with the kinds of optimizations which compilers are able to perform today. But I'd still take more memory over less performance.

39
Feature requests / Shaders, vertex shaders?
« on: May 31, 2011, 07:05:17 pm »
Quote from: "Laurent"
For anything that can be defined as a linear transformation (in 4D space), using a matrix will be much more efficient than a vertex shader.


Are you sure about that? I'm sure there's a reason that basically any graphics engine using OpenGL 3.0 and DirectX10 and above does all of their transformations using vertex shaders.

As far as I know, even a very very good CPU doesn't even scratch the surface of what a GPU can do, due to the high amount of shading units on a good graphics card and therefor very good parallelization.

40
General discussions / SDL vs. SFML
« on: May 07, 2011, 09:19:51 pm »
As Laurent said, Windowing and Event handling consumes only a completely negligble part of performance on any system that was built in the last 10 years.

If you're teaching OpenGL using C++, you should definitely use SFML since it has a much clearer and easier to use design.

41
SFML projects / ParabolaEngine - 2D Game Framework
« on: March 30, 2011, 03:06:00 pm »
How's the next version coming up? :P

42
Graphics / Blurring
« on: March 28, 2011, 04:34:23 pm »
Quote from: "msteele"
Quote from: "Nexus"
Quote from: "msteele"
Now on to the arduous process of compiling another library... ;)
There's no need to, SFML supports shaders. Take a look at sf::Shader and GLSL.

Oh, I just meant sfml2. sfml1.6 only has pfx.


those are exactly the same shaders (pixel/fragment shaders) which sfml 2.0 uses. sfml 2.0 just gets rid of a couple of sfml specific key words in order to make shaders exactly like GLSL shaders.

43
Graphics / Blending shadows correctly
« on: March 14, 2011, 12:26:50 pm »
Ooops. Shame on me :)

Now I just need to wait for your Radeon HD fix and I can actually try it out!

44
Graphics / Blending shadows correctly
« on: March 14, 2011, 09:34:19 am »
That code is SFML 1.6 right? How much work would it take to convert it to 2.0, just change the way stuff is drawn?

45
General discussions / SFML 1.6 and 2 BUGS
« on: March 14, 2011, 09:32:27 am »
Awesome!

Pages: 1 2 [3] 4 5 ... 9