Welcome, Guest. Please login or register. Did you miss your activation email?

Recent Posts

Pages: [1] 2 3 ... 10
1
Feature requests / Re: Custom made event handling
« Last post by kaa#rad on June 24, 2019, 10:46:42 pm »
Hi, I like the same feature.  ;D
It is obvious that I need it due to the fact that window control (event-handling & window-update) should be in one thread, afai-understand; for MAC-OSX it must be also the thread of the main-function (afaiu too).
If this is so and I do not want to poll for SFML-events, I cannot react on other events than the SFML given one; I cannot react on timeouts for instance (precondition:  using API function sf::Window::waitEvent() ).
afai-see this function is the only way to give time/control fully back to the OS; this is - in my opinion - the best way to save process-time and have a full event driven system/process-program.
But if I can't wake up this by myself (other thread, e.g. via timeout), it could not work fully by using the waitEvent() function.
I - as many others too which I assume - would like to handle SFML in that way. It only needs a user-specific signal-event for instance, may be more than one event (e.g. with user-event-id) and "waitEvent" should be come back, if this is called - thread-save, because this must be done by another thread of course.
Hope I do not have some fully misunderstandings.
Thanks if you understand me and my wishes belonging to an event-driven thread. (It may be similar like wait for multiple events in a select() function of linux/POSIX).
2
so, are you going to post the code and/or the error?
3
Graphics / Re: gl_TexCoord undeclared
« Last post by Hapax on June 23, 2019, 10:42:02 pm »
Are you using a custom vertex shader? Are you preparing it there?
See the minimal vertex shader:
https://www.sfml-dev.org/tutorials/2.5/graphics-shader.php#minimal-shaders

Also, should you not also be specifying the components that are required?
e.g. gl_TexCoord[0].st
(or at least the components of the final result of your addition)
4
Graphics / gl_TexCoord undeclared
« Last post by abreu20011 on June 23, 2019, 07:27:25 pm »
Hi everyone  :)

I have a fragment program that works fine into my main machine, but into a laptop with updated graphics drivers (Intel HD Grapchics) throws an error. Anyone imagine what's happens?

Seems to be a internal problem into SFML to initialize this variable correctly.
Besides, into my main machine if I don't declare version shader, no error are generated, but in this laptop I need to declare versiĆ³n to stop complaining GLSL errors.

I tried all GLSL versions, from 110 to 420 and in all versions don't works.
Actually my current versions are declared like this: #version 150 core

This line...:

vec2 uv = gl_TexCoord[0] + make_uv_from_rotation();

Throws the next error:

Failed to compile fragment shader:
ERROR: 0:39: 'gl_TexCoord' : undeclared identifier
ERROR: 0:39: 'gl_TexCoord' : left of '[' is not of type array, matrix, or vector
 
5
SFML website / Re: Documentation Mistakes
« Last post by Nexus on June 23, 2019, 11:43:32 am »
Lincon, is this from the 2.5.1 documentation? Apart from the sf::Image description, I don't find the issues.

Quote
Single pixels are allowed to change, and only resize/reload is a problem, right?
With the current implementation, yes. The thing is that the pointer is not meant to be kept around as a read model for the sf::Image data, but rather requested and immediately used.
6
SFML website / Re: Documentation Mistakes
« Last post by danzyxr on June 23, 2019, 05:08:45 am »
Thanks for making this thread. I'm a SFML newbie, and so the first error I've found so far is that the "s" in the Visual "S"tudio tutorial is not uppercase, and it bothers me haha.

https://www.sfml-dev.org/tutorials/2.5/start-vc.php

7
General discussions / Fully static linkage using VS2017 and SFML2!!
« Last post by harrymickenzy on June 23, 2019, 03:53:04 am »
Software versions:
Visual Studio 2017 Community Edition
SFML 2.4.2, official 32-bit binaries for Visual Studio 2015

Intent:
Creating a simple SFML test program that has no .DLL dependencies.

Problem:

Cannot link1 with SFML if choosing a non-DLL Runtime Library option in:
Project -> MyProj Properties -> C/C++ -> Code Generation -> Runtime Library
Otherwise, resulting executable cannot run due to dependencies on:
MSVCP140.dll
VCRUNTIME140.dll
API-MS-WIN-CRT-*.dll

Suggestion:
Please release the upcoming binaries of SFML for VS2017 such that if static linkage is desired (SFML_STATIC) then the program will not depend on developer .DLLs.
8
Window / My Whole computer freezes when using sfml for a ray casting engine.
« Last post by bender66 on June 22, 2019, 10:31:56 pm »
Im using linux mint

When I run my code after about 30 seconds my whole computer freezes up and I have to reboot.
When I run it without any sfml stuff it works fine.

pls help.


(also how does the option thing work?)
9
Network / Re: UDP socket not sending packets.
« Last post by LordNani on June 22, 2019, 03:42:19 pm »
First of all, can you provide a minimal code showing the problem?

I'll try it on my own computer ;)

I fixed it... Firstly I had to change ports because I am using the local address for testing.
so now it is like this:
Server: bind to 20000, receive on 20000, send to 20001.
Client: bind to 20001, receive on 20001, send to 20000.
And the core problem
It seems that after udpSocket fails to send\receive data on some determined ip+port, it resets it completely, so I had to create temporary variables. If someone knows how to get rid of it, or optimize the current way, tell me please.
10
Network / Re: UDP socket not sending packets.
« Last post by LordNani on June 22, 2019, 12:24:17 pm »
First of all, can you provide a minimal code showing the problem ?

I'll try it on my own computer ;)

Sure, thank you!
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <math.h>
#include <vector>

enum Nodemode : char { SERVER = 's', CLIENT = 'c' };
sf::IpAddress hostIp = sf::IpAddress::getLocalAddress();
sf::UdpSocket udpSocket;
uint16_t port = 51234;
std::string recMsg = "";
std::string msg;

std::istream &operator>>(std::istream &is, Nodemode &i);
std::ostream &operator<<(std::ostream &out, const Nodemode value);

void sendData(std::string msg);
Nodemode nodestate;
sf::Thread secondThread(&sendData, msg);

int main() {

  std::cout << "Type 's' for server, and 'c' for client. If you want to close "
               "the app, type in 'stop' "
            << std::endl;
  std::cin >> nodestate;

  if (nodestate == SERVER) {
          udpSocket.bind(port);
  } else if (nodestate == CLIENT) {
          udpSocket.bind(port);
  }

  std::cout << "Current IP-address: " << hostIp.toString() << std::endl;
  std::cout << "Node state: " << nodestate << std::endl;
  std::cout << recMsg << std::endl;

  secondThread.launch();
  while (msg != "stop") {

    sf::Packet packet2;
        if (udpSocket.receive(packet2, hostIp, port) != sf::Socket::Done)
                std::cout << "~~error receiving data" << std::endl;
        else {
                std::cout << "--data received" << std::endl;
                packet2 >> recMsg;
                if (recMsg != "")
                        std::cout << "Other user: " << recMsg << std::endl;
        }
  }
  return 0;
}

std::istream &operator>>(std::istream &is, Nodemode &i) {
  char tmp;
  if (is >> tmp)
    i = static_cast<Nodemode>(tmp);
  return is;
}

std::ostream &operator<<(std::ostream &out, const Nodemode value) {
  static std::map<Nodemode, std::string> strings;
  if (strings.size() == 0) {
#define INSERT_ELEMENT(p) strings[p] = #p
    INSERT_ELEMENT(SERVER);
    INSERT_ELEMENT(CLIENT);
#undef INSERT_ELEMENT
  }
  return out << strings[value];
}

void sendData(std::string msg) {
  while (msg != "stop") {

    getline(std::cin, msg);
    sf::Packet packet;
    packet << msg;

        if (udpSocket.send(packet, hostIp, port) != sf::Socket::Done)
                std::cout << "~~Could not send data" << std::endl;
  }
}
 
Pages: [1] 2 3 ... 10
anything