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

Pages: 1 [2] 3 4 ... 6
16
SFML projects / Re: pseuthe - casual survival game
« on: July 02, 2015, 04:47:51 am »
This is really cool. I like the ambient music and the particle effects. I think this could be a great Android / mobile game (although, like other people mentioned the physics is... different).

Awesome work!

17
SFML projects / Re: Non-rectangular semi-transparent window
« on: June 07, 2015, 01:18:49 am »
That's pretty neat!

18
SFML projects / Re: Escape From Fog - 3D Maze game
« on: June 03, 2015, 05:02:58 am »
@DarkRoku and Hapax, thanks for the feedback  :)!

I added a new video to the OP which shows the combat features, animations, crosshair, and some other stuff I've been working on. My next step will be better instancing and a more descriptive HUD (maybe one that has the top-down view of a level). Also some kind of options menu / GUI would be useful, but I don't want to go overboard. I'll probably just use the FreeType and set the color of the text when the user mouses over (although that could cause issues since the mouse locks (and disappears) right now when the user clicks.

Does anyone know OpenGL instancing really well? I figured out how to set it up but I'm not sure how to translate each individual instance (after they've been initialized). I have a call that looks like:

(click to show/hide)

This will handle the positions of each instance correctly using the transformData vector, but I can't quite figure out how to translate the instances during gameplay. I have an object which represents the instances, Model, and I can transform the Model object but it will make those transformations to every instance. Here's what my shader code looks like:

(click to show/hide)

I figure I have to use the "gl_InstanceID" variable I think but I'm not quite sure how. I think maybe have a uniform mat4 container which contains the appropriate translation, and then index the container using gl_InstanceID?

19
General / Re: can't set up sfml 2.3 on code::blocks
« on: June 02, 2015, 01:23:42 am »
Try setting it up as debug and see if you get the same errors. I know that setting it up as static requires additional dependencies- did you test those?

20
SFML projects / Re: Zloxx II - An action Jump'n'Run
« on: May 31, 2015, 11:11:28 pm »
zwookie, what exactly flickered? Was it the background (i.e. the mountain/sky/forest painting) or something else? Always in fullscreen mode?

It appears that using full-screen with fixed frame rate fixes the issue. When I tested full-screen with Vsync or Dynamic frame rate the screen would like superimpose, flicker, normalize, and then superimpose itself again. Windowed version is fine no matter what frame rate is set.

21
Feature requests / Shader Subroutines
« on: May 31, 2015, 12:40:05 am »
On my SFML fork I tried to implement subroutine functionality. This feature would allow the sf::Shader class to modify subroutines in a similar fashion to modifying parameters or uniforms in Vertex, Fragment, or Geometry shader files. I think this could be beneficial to a SFML user as it can reduce the number of shader files that the they need to manage. Currently, the user could use uniform variables and the "setParameter(...)" overloads but that could become cumbersome with many different branches of execution. I believe they would need to constantly set every uniform false or true due to the previous iteration of execution maintaining the respective uniform's value. The specific subroutine is specified using a Shader class object:

myShader.setSubroutine("subroutineName", sf::Shader::Type, 1);

The last parameter is the index of the subroutine array according to OpenGL documentation. I created a brief example below to display the functionality below and I only tested an array length of 1.

In this example, a single vertex file is used with a subroutine that can modify the text graphics using the "wave" or "storm" vertex shaders taken from the SFML examples.

#include <iostream>
#include <SFML/Graphics.hpp>
#include <cmath>

using namespace sf;

int main(void)
{
    RenderWindow window (VideoMode(800, 600), "My SFML Window", sf::Style::Default);
    window.setPosition(sf::Vector2i(0, 0));

    Shader shader;
    if(!sf::Shader::isAvailable())
        return EXIT_FAILURE;
    if(!shader.loadFromFile("vertex.glsl", Shader::Vertex))
        return EXIT_FAILURE;

    Font ubuntuFont;
    if(!ubuntuFont.loadFromFile("Ubuntu-M.ttf"))
        return EXIT_FAILURE;

    Text textToShow ("SFML Rocks!", ubuntuFont, 100);
    textToShow.setColor(sf::Color::Green);
    textToShow.setPosition(0, 600 / 2 - 100);

    Clock clock;

    bool waveEffect = true;

    while(window.isOpen()) {
        float elapsedTime = clock.getElapsedTime().asSeconds();

        sf::Event event;
        while(window.pollEvent(event)) {
            if(event.type == event.Closed) {
                window.close();
            }
            else if(event.type == Event::KeyPressed && event.key.code == Keyboard::Escape) {
                window.close();
            }
            else if(event.type == Event::KeyPressed && event.key.code == Keyboard::Num1) {
                shader.setSubroutine("wave", Shader::Vertex, 1);
                waveEffect = true;
            }
            else if(event.type == Event::KeyPressed && event.key.code == Keyboard::Num2) {
                shader.setSubroutine("storm", Shader::Vertex, 1);
                waveEffect = false;
            }
        }

        // update shaders
        if(waveEffect) {
            shader.setParameter("wave_phase", elapsedTime);
            shader.setParameter("wave_amplitude", 40 * 0.3f, 40 * 0.002f);
        }
        else {
            float x = static_cast<float>(sf::Mouse::getPosition(window).x) / window.getSize().x;
            float y = static_cast<float>(sf::Mouse::getPosition(window).y) / window.getSize().y;
            float radius = 200 + std::cos(elapsedTime) * 150;
            shader.setParameter("storm_position", x * 800, y * 600);
            shader.setParameter("storm_inner_radius", radius / 3);
            shader.setParameter("storm_total_radius", radius);
        }

        // render
        window.clear(sf::Color::White);

        RenderStates states;
        states.shader = &shader;
        window.draw(textToShow, states);

        window.display();

    }

    return EXIT_SUCCESS;
}

... And here is the corresponding vertex shader file.

// wave and storm effects from SFML examples

subroutine vec4 VertexModType();
subroutine uniform VertexModType GetModifiedVertex;

// uniforms for wave shader
uniform float wave_phase;
uniform vec2 wave_amplitude;

// uniforms for storm shader
uniform vec2 storm_position;
uniform float storm_total_radius;
uniform float storm_inner_radius;

subroutine(VertexModType)
vec4 wave()
{
    vec4 vertex = gl_Vertex;
    vertex.x += cos(gl_Vertex.y * 0.02 + wave_phase * 3.8) * wave_amplitude.x
              + sin(gl_Vertex.y * 0.02 + wave_phase * 6.3) * wave_amplitude.x * 0.3;
    vertex.y += sin(gl_Vertex.x * 0.02 + wave_phase * 2.4) * wave_amplitude.y
              + cos(gl_Vertex.x * 0.02 + wave_phase * 5.2) * wave_amplitude.y * 0.3;
    return gl_ModelViewProjectionMatrix * vertex;
}

subroutine(VertexModType)
vec4 storm()
{
    vec4 vertex = gl_ModelViewMatrix * gl_Vertex;
    vec2 offset = vertex.xy - storm_position;
    float len = length(offset);
    if (len < storm_total_radius)
    {
        float push_distance = storm_inner_radius + len / storm_total_radius * (storm_total_radius - storm_inner_radius);
        vertex.xy = storm_position + normalize(offset) * push_distance;
    }

    return gl_ProjectionMatrix * vertex;
}

void main()
{
        gl_Position = GetModifiedVertex();
        gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
        gl_FrontColor = gl_Color;
}

I know there might be some underlying issues with my implementation. For starters, subroutines require OpenGL 4.0 Core context and I think SFML only supports 3.0 I think. This is my first time modifying the SFML library directly, so I think I may have butchered some of the conventions (sorry!). I mainly did this to see what kind of feedback I could get as I've been looking for ways to contribute to this library and I noticed there's been some disuccsion on this topic. I did talk with Mario on IRC very briefly but I don't think he understood what I was referring to and then I went to sleep.  ::)

edit: added clarification as to why the feature may be useful

22
General / Re: Draw text with OpenGL?
« on: May 30, 2015, 09:13:21 am »
@oOhttpOo, if you need help using OpenGL directly to draw text then I would recommend this tutorial. It shows you how to get started using the FreeType libraries directly.

23
SFML projects / Re: Zloxx II - An action Jump'n'Run
« on: May 24, 2015, 08:48:18 pm »
I did the first three levels and I'm hooked  ::) ... Also, I got some strange flickering off the background texture in Linux (Ubuntu 14.04) full screen, but windowed version works fine.

24
General discussions / Re: Shader uniform API -- part II
« on: May 16, 2015, 11:38:28 pm »
Some of these topics go over my head, but I will agree on changing the
setParameter(...)
call to a
setUniform(...)
call or something similar due to the reasons already mentioned by Nexus and Binary. It does feel more explicit and conveys what is being modified better I think.

25
SFML projects / Re: Escape From Fog - 3D Maze game
« on: May 16, 2015, 09:22:41 am »
I'm back to trying to make this into a basic first-person shooter. I'm trying to give it kind of a surrealistic vibe. I have bullets working and I'm now working on getting some enemies (which will be billboarded sprites). I made some changes to the lighting, models, and added a Post-Processor class which lets you use grayscale, inversion, sharpen, and other render effects. I have all the controls listed in the README.md file on GitHub. I hope to make a general video once I have the enemies implemented.

edit: video walk-through added

26
General discussions / Re: SFML 2.3 released!
« on: May 10, 2015, 12:46:41 am »
Congrats on all the hard work! I'm going to start testing it out right now.  8)

27
General / Re: Online Game Programming
« on: April 18, 2015, 08:19:55 pm »
There's a good (albeit brief) example of client-server architecture in the SFML game book. I'm looking to learn more about the SFML network module too and that's the resource I've been using. It sounds like what you suggested is the general idea though.

28
Window / Re: SFML joystick problem?
« on: March 28, 2015, 07:03:04 pm »
I'm not sure if its still needed but here's the output from
Code: [Select]
find /dev/input/* -not -path "/dev/input/by-path*" -exec udevadm info -q all '{}' \;
(click to show/hide)

And the output from
Code: [Select]
udevadm monitor --property
(click to show/hide)

I also checked out the ca7776b branch and everything seems to work swell.

On a side note, I was wondering what it would take to get more functionality from my XBox 360 controller? I basically would hope to be able to use the 'A' button and D-pad for my games.

If you need any more help testing I will try to be useful. I'll make sure to build the right libraries when I test (instead of building the release and then testing the debug libraries from master ... hehe).

29
General / Re: SFML not drawing anything on window [Linux, Eclipse]
« on: February 24, 2015, 09:33:36 pm »
Hm, that's weird. I wonder if it's an issue with video drivers? I'm using FGLRX now but I've used the Mesa3D open source driver before with no issues.

30
General / Re: cmake error
« on: February 24, 2015, 09:24:37 pm »
Did you install the libxcb-iccm-dev libraries? I remember that I ran into a CMake issue building the latest SFML 2.2 (on Ubuntu 14.04) and I needed to get the dev version of the libraries and that fixed it. I think I used the libraries from here.

Pages: 1 [2] 3 4 ... 6
anything