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

Pages: [1] 2
1
Figured it out.
OpenGL shaders compiled the shaders differently and assigned different locations.

My post-fx shaders have these attributes;
// some_post_fx.glsl

#version 150

in vec2 inputPosition;             // 0
in vec2 inputTexCoords;    // 1

int main() {
  //
}

 

And the locations on my computer after the shader compiled is:
pos = 0
tex = 1

And on his computer, these two were flipped.
tex = 0
pos = 1

Which results in that weird double in top corner pattern.
I was using (layout = 0) before, but when I downgraded all my shaders to OpenGL 3.2 I forgot to make a system to make sure the locations were correct for attributes. Fuck me.

But very interesting.


2
Any ideas?

3
I also added a bunch of logs to locate the issue. But nothing out of the ordinary.

Windowsize: 1920, 1080 (correct)
Viewport: (0, 0, 1920, 1080) (correct?)
VA: 1, FB: 1, Sampler: 1, ColorAttachment(texture): 1


4
The only log from SFML was that:

"The sf::ContextSettings is not supported, we changed it a bit."
I have contextsettings to 3.2, which he also has.
And the only setting that didn't work is AA, it went down from 16 -> 8.
So there's not anything to go on there either.


5
Hey, I'm using both OpenGL and SFML.

Trying the game on a friend's computer (kinda old).
And I'm getting this result. [see attachment]

I've got no clue where to look.
I messed around with glViewport but that didn't give the "repeating" pattern. Like, why are there four of them?

Anyone got an idea?

6
SFML projects / Re: Break the Game [On Steam!]
« on: April 17, 2019, 04:02:56 pm »
Haha, that would've been fitting actually.

7
SFML projects / Break the Game [On Steam!]
« on: April 17, 2019, 03:25:49 pm »
It's nearing the end.

4 years ago I started making small fun projects in SFML. (2014 something)
Nothing serious, but I really fell in love with it.
2 years and a half ago I released Escape the Game, a prototype for the game I wanted to make:
https://store.steampowered.com/app/542310/Escape_the_Game/.

The game, to my surprise got a lot of attention.
I was very happy!
It gave me the motivation to start working on the actual game.
And I'm releasing it in a month or two.
https://store.steampowered.com/app/739540/Break_the_Game/

It might be my last project in SFML.
But I'll keep recommending SFML it to everyone I talk to.
Thank you all, expecially the SFML Team!

 (:
 
 Simon

8
Graphics / Re: Simple way of avoiding scaled outlines
« on: November 08, 2018, 07:30:41 pm »
FUCK.

Now the applied texture/sprite on the shapes doesn't get scaled.
God fucking damnit.

And I need to do SetOrigin() each time as well.



9
Graphics / Re: Simple way of avoiding scaled outlines
« on: November 08, 2018, 01:54:06 pm »
Yeah.
The only problem is that I have sf::ConvexShape and sf::CircleShape (and sf::RoundedRectangle) too.

So that leaves me to save a enum { Convex, Circle, Rectangle, Rounded }
1. Check type
2. Cast
3. Perform adjustment, SetSize() / SetRadius / Blabla

Meh, it'll work, I guess.

Thanks for the help pal.

(:

10
Graphics / Simple way of avoiding scaled outlines
« on: November 05, 2018, 09:46:53 pm »
Is there a clean/simple way of making the outlines of a sf::Shape not get affected by scale?
(See attached picture to see what I mean.)

Because I can't decrease the scaling by setting another OutlineThickness, because on different scales, horizontal and vertical get affected differently..

I could do this as a seperate shader, I guess.
But I want to avoid that.

And I COULD use sf::RectangleShape::SetSize() instead of using Scale at all.
But I've built everything around SetScale now, because I'm only using sf::Shape pointers everywhere, and I don't want to cast all the time.



11
Graphics / Re: sf::RenderWindow and resetGLStates()
« on: April 19, 2018, 07:39:44 pm »
Nah, I'm using 2.4.2.

I can't really show the specific code, because It's a pretty large project, and I don't know the real cause of it.
But it might have something to do with the shader, it might not get reset correctly.

This is the code for when I end my OpenGL shader execution and I'm resetting the things as they were before using the shader.

    void End()
    {
        // Closing up vertex attributes channels
        for (unsigned int i = 0; i < AttributeChannels; i++)
            glDisableVertexAttribArray(i);

        // Setting previous values
        glUseProgram(PrevValues.ProgramID);
        glBindVertexArray(PrevValues.VertexArray);
        glBindBuffer(GL_ARRAY_BUFFER, PrevValues.VertexBuffer);
        glClientActiveTexture(PrevValues.ClientTexture);

        // Setting previous blending
        if (PrevValues.BlendUsed)
        {
            if (PrevValues.BlendOn) glEnable(GL_BLEND);
            else                    glDisable(GL_BLEND);
            glBlendFunc(PrevValues.SRC_Alpha | PrevValues.SRC_RGB,
                        PrevValues.DST_Alpha | PrevValues.DST_RGB);
            PrevValues.BlendUsed = false;
        }
    }

After this, some time later.
I call ImGui::SFML::Render();
Which inside calls the resetGLStates();
Which gives the error on the first glCheck() execution. (Not connected to the multitexture thing)

So is the problem that the first actual glGetError() function produces the error?
Or I'm just getting it wrong?

So are any of these states not compatible with SFML?

12
Graphics / Re: sf::RenderWindow and resetGLStates()
« on: April 19, 2018, 06:42:38 pm »
Oh. It got nothing to do with that line specificly. It's the first row that calls glCheck..

Hmm.

I'll be back.

13
Graphics / sf::RenderWindow and resetGLStates()
« on: April 19, 2018, 06:32:13 pm »
When I call the function resetGLStates() from the sf::RenderWindow after rendering my stuff (First SFML and then my OpenGL stuff.)

I get this error:

An internal OpenGL call failed in RenderTarget.cpp(369).
Expression:
   GLEXT_glClientActiveTexture(GLEXT_GL_TEXTURE0)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

The visuals are correct, so there's nothing visually wrong at least.
But the error constantly pops up in the console. It's bugging me.

Here's the link to the actual line of the error in SFML's code.

https://github.com/SFML/SFML/blob/2cd479755732fc048322f9759aa4af0c7ea76e7a/src/SFML/Graphics/RenderTarget.cpp#L502

The error doesn't make any sense at all.

And according to the OpenGL docs; https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glClientActiveTexture.xml, the function can't even give the INVALID_OPERATION error. So what's up with that?

I'm not even using multiple textures.

Gahhhhhh.

Help?  :'(

 - S




14
Graphics / How to implement this shader correct?
« on: May 23, 2016, 06:33:33 pm »
Hey, I don't feel like I'm doing shader's the correct way.

This is the shader;

uniform vec2 frag_LightOrigin;                 
uniform vec3 frag_LightColor;                  
uniform float frag_LightAttenuation;

void main()
{      
        vec2 baseDistance               = gl_FragCoord.xy;                                                                           
        vec2 distance                   = frag_LightOrigin - baseDistance;                                           
        float linear_distance   = length(distance);                                                                            
        float attenuation               = 1.0 / (frag_LightAttenuation * linear_distance +
                                                                         frag_LightAttenuation * linear_distance);                                     
        vec4 lightColor                 = vec4(frag_LightColor, 1.0);
        vec4 color                              = vec4(attenuation, attenuation, attenuation, 0.75) * lightColor;      

        gl_FragColor                    = color;                                                                                                   
}
 


The following is in the draw-function of all particles;

                rTexture.clear(sf::Color(0, 0, 0, 255));

                for (size_t i = 0; i < particles.size(); i++)
                {
                        shader.setParameter("frag_LightOrigin", particles.at(i)->position);
                        shader.setParameter("frag_LightColor", particles.at(i)->color);
                        shader.setParameter("frag_LightAttenuation", particles.at(i)->strength);
                        rTexture.draw(painting, states);
                }

                rTexture.display();
 

(painting is a sf::RectangleShape covering the whole screen)

Currently, I'm drawing each new state of the shader on a sf::RectangleShape(painting) for as many lightsources (particles).
This makes the whole game lag so much when there's many lights.

The game works and all, but I feel like something is wrong.
Is there a way of drawing each particle on the same shape or something?

15
Audio / Re: Is the Audio Package enough to make a music visualizer?
« on: April 30, 2015, 02:48:52 pm »

Pages: [1] 2
anything