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

Pages: [1]
1
General / loadFromFile UNICODE path not working
« on: June 17, 2017, 05:27:34 pm »
I am trying to load a file from this path:

C:\Testи\\pic.jpg

using this code (not using code tag, since it destroy the Cyrillic char):

   std::string file = u8"C:\\Testи\\UnicodePathCheck\\pic.jpg"; //does not work

   sf::Texture tex;
   tex.loadFromFile(file) //returns false



It works fine without the Cyrillic character in the path.

Since SFML does not provide a std::wstring overload, I guess it's impossible to load files from paths with characters outside the ASCII range?!

I checked the sources and figured that underlying stb_image library also would need an update to make this work. std::ifstream refuses to load the file. using std::wifstream with std::wstring works

My questions:

2
General / SFML compatibility context
« on: October 02, 2016, 06:08:20 pm »
Hi,

I am trying to learn OpenGL and use SFML instead of GLFW. Since I want to combine it later on.
Everything is working fine with the Default attributeFlag (compatibility mode). Using the Core profile, gives me an error when calling

window.pushGLStates();
Error is: an internal opengl call failed in texture cpp pushGLStates...

AFAIK its because the OpenGL Core profile won't tolerate immediate calls made by SFML (I read, that SFML still uses the fixed function pipeline for compatibility with older hardware, that's okay)

My Question is:
When using VAOs to paint my nice triangles and semi professional models and then use sf::Text or Shape or Sprite to draw something, will pushGLStates do the trick or will things maybe get messed up at some point?!?!

                // Draw the triangle !
                glDrawArrays(GL_TRIANGLES, 0, 3); // Starting from vertex 0; 3 vertices total -> 1 triangle
                glDisableVertexAttribArray(0);

                window.pushGLStates();

                //---SFML STUFF

                window.popGLStates();
               
        //Maybe more OpenGL Stuff here...

                // Done => Display everything
                window.display();
 

This works fine, I just want to know if I will run into several problems later on, especially when drawing the GUI with SFML for example, using the compatibility mode. I am still learning. Maybe someone can give me a little head start here? :)

3
General discussions / [SOLVED] Learning OpenGL with SFML
« on: September 27, 2016, 07:34:12 pm »
Hi,

I want to learn some basic OpenGL and use SFML for everything else, no GLUT/GLEW. I found this online tutorials: http://www.opengl-tutorial.org/.

My system supports OpenGL 4.5. And afaik glBegin()-tutorials are outdated. Is it possible to use "modern" openGL with SFML. I get compilation errors with these lines:
                GLuint VertexArrayID;
                glGenVertexArrays(1, &VertexArrayID);
                glBindVertexArray(VertexArrayID);
 

Error is: identifier "glGenVertexArrays" is undefined

So I have 3 questions:
1.) Does OpenGL 4.5 work with SFML? (I would like to use SFML 2D functionality with OpenGL 3D)
2.) glGenVertexXXX is GLEW/GLUT?! Maybe that's why I get the error?!
3.) Any good tutorial or book suggestions for a beginner?! :)
EDIT:
4.) Yeah, maybe I should keep in mind, that not all systems support the latest. Is there some info somewhere which OS supports which version of OpenGL?! .. Edit2.) http://store.steampowered.com/hwsurvey guess most users seem to have at least a OpenGL 3.0 compatible card (compared to DX10) ...

Regards,
Wafthrudnir

Edit: I just read, that under windows the default headers are OpenGL 1.1. Someone suggested to use Glew. urgh...really?! (http://stackoverflow.com/questions/37736829/glgenvertexarrays-not-available-in-c)

I am using Visual Studio 2015, the included GL.h doesn't contain the stated functions and the header says:
BUILD Version: 0004    // Increment this if a change has global effects

Copyright (c) 1985-96, Microsoft Corporation
 
Path is: c:\Program Files (x86)\Windows Kits\8.1\Include\um\gl\GL.h

4
Graphics / Lighten/Darken Brush Photoshop style
« on: July 18, 2015, 01:04:13 am »
Hi,

I want to create a (circle) brush to lighten or darken pixels of a sprite/texture.

I thought about getting all the pixels inside the radius of my circle.
loop through the pixels from the inside to the outside and change the color depending on the distance of the circle origin.

I am struggling with a good way to implement this feature and my implementation seems to suck hard. First step is to find ALL the pixels inside the circle from a sprite ... fails :(

Here's my code:
        static List<Vector2f> FindPixelsOnSprite(CircleShape c, Sprite s)
        {
            List<Vector2f> pixels = new List<Vector2f>();

            float radius = c.Radius;
            float m1 = c.Position.X - s.Position.X;
            float m2 = c.Position.Y - s.Position.Y;

            for (float x = 0; x < s.TextureRect.Width; x++)
            {
                for (float y = 0; y < s.TextureRect.Height; y++)
                {                
                    float dx = x - m1;
                    float dy = y - m2;
                    float distance = dx * dx + dy * dy;

                    if(distance <= c.Radius)
                    {
                        pixels.Add(new Vector2f(x, y));
                    }
                }
            }

            return pixels;
        }
 

I attached my Visual Studio 2013 (Premium) project too ... set the working directory to the project directory, so the program will find the pic.png
Also add the NuGet SFML package (couldn't upload the whole solution)

Maybe you can help me out here :/

Edit:
This is the effect I want to achieve on mouse click:

5
DotNet / [SOLVED] RenderWindow as Control with own Render loop
« on: July 15, 2015, 10:49:40 pm »
Hi,

I am using a WinForms UserControl with a private RenderWindow property referencing the UserControl handle.
I am struggleing with the update of my UC. I tried a thread and inside OnPaint (stupid me ;D).

Can anyone think of a good way to get it to work?! :/

Here's my Code:
    using System.Windows.Forms;
    using SFML.Graphics;
    using SFML.System;

    internal class Viewport : UserControl
    {
        private RenderWindow _renderwindow;

        public Viewport()
        {
            _renderwindow = new SFML.Graphics.RenderWindow(this.Handle);
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            //base.OnPaint(e);
        }

        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
        {
            //base.OnPaintBackground(pevent);
        }
    }
 

6
General / [SOLVED] Make SFML + Ubuntu 10.10 | Maverick Meerkat
« on: December 30, 2010, 11:19:21 pm »
Hi everyone,
I'm new here, but a silent fan of SFML...best library ever :> But now I have a silly problem  :oops:

I normally used SFML with Wintendo, but this time I wanted to use Linux. Anyway...

I tried to compile the libs via make.

Code: [Select]

make


seems to work

Code: [Select]

sudo make install


seems to work too, see here:
Code: [Select]

nakkvarr@midgard:~/Downloads/SFML-1.6$ sudo make install
[sudo] password for nakkvarr:
make[1]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML'
make[2]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/System'
make[2]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/System'
make[2]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Window'
make[2]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Window'
make[2]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Network'
make[2]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Network'
make[2]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Graphics'
make[2]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Graphics'
make[2]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Audio'
make[2]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/Audio'
make[1]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML'

(Betrete/Verlasse Verzeichnis means: entering/leaving directory) ;D

Anyway...can't find any libs in /usr/lib

And when i try to execute
Code: [Select]

sudo make install STATIC=yes


make fails hard:
Code: [Select]

nakkvarr@midgard:~/Downloads/SFML-1.6$ sudo make install STATIC=yes
[sudo] password for nakkvarr:
make[1]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML'
make[2]: Betrete Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/System'
cp: Aufruf von stat für „../../../lib/libsfml-system-s.a“ nicht möglich: Datei oder Verzeichnis nicht gefunden
make[2]: *** [install] Fehler 1
make[2]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML/System'
make[1]: *** [install] Fehler 2
make[1]: Verlasse Verzeichnis '/home/nakkvarr/Downloads/SFML-1.6/src/SFML'
make: *** [install] Fehler 2


Can't find the file „../../../lib/libsfml-system-s.a“ ?! :/

What's the problem? I downloaded SFML 1.6 and installed all dependencies via the Ubuntu repo...

I don't like shared libs so I wanted to build the static lib for sfml (like the ones in the windows pre build from this site) ...

Hope anyone can help me :>

Regards,

Wafthrudnir

Pages: [1]
anything