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

Recent Posts

Pages: [1] 2 3 ... 10
General / glFlush() error.
« Last post by Riser on September 18, 2020, 10:39:01 pm »
This error comes when I'm working with textures sometimes and I don't know exactly what causes it, even weirder is that when i pops up there are no apparent issues, and everything seems to work just fine, but I want to know what causes it, and how I can avoid it:

Since I don't know exactly what causes the error I didn't post any code, but I'll do so if needed.
SFML projects / AlgoSketch - Algorithm Visualizer created with SFML
« Last post by zedrex on September 18, 2020, 08:10:37 pm »
Hello everyone,

AlgoSketch is an algorithm visualizer (for 5 sorting algorithms and 3 grid algorithms currently) created with SFML and C++. It was developed by me and one of my buddies for our undergrad course. We are still newbies but the project is somehow finalized (and we are proud of it :3).

We implemented a pseudo application library based on SFML and built the project on top of it. The application engine consists of basic window, state and event managers and some basic UI element classes. The project is still buggy because we have very little experience in SFML and OO principles. Thanks in advance for any advice or tips for us since we plan to put some more work on the project in the future.

For grid algorithms, you can create a custom sized 2D grid and draw a maze. Then you can specify the source/destination for the algorithm. For sorting algorithms, you can specify the size of the array and a list of that size will be created with randomly generated values as height. You can pause and resume the algorithms as you wish.

The code is open source and you can find it here: https://github.com/zedrex/AlgoSketch

Here are 3 visualizations from the project:

Thank you very much.
Graphics / Re: Just cannot get sf::Text to draw without crash
« Last post by ThatOneGuyThatDoesStuff on September 17, 2020, 09:45:33 pm »
Go to the Intel's website and find the latest driver for your integrated graphics chip and install that.

I'll try that, but like I said, I also tried it on my new windows 10 PC and get the exact same issue, so I have my doubts it will work. If it does though, you have my eternal gratitude.
Graphics / macOS Texture::update -> glTexSubImage2D crash
« Last post by j.keller51 on September 17, 2020, 09:22:09 pm »

I'm experiencing a crash in Texture::update. It happens on the line:

glCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels));

I am on MacOS 10.15.6 using SFML 2.5.1, self-built with CMake.

The crash is due to EXC_BAD_ACCESS.

Here's where it gets weird.

The image dimensions are 1403 x 132. Since each pixel is 4 bytes, we have a total data size of 740784 bytes. When debugging, the size of Texture::m_pixels is exactly 740784 bytes.

Inside Texture::update(), const Uint8* pixels is a valid pointer to the start of Texture::m_pixels's internal buffer.

However the bad access crash is telling me it was trying to access a memory location 741376 bytes past pixels. It's over-reading by 592 bytes for some reason.

Just to confirm the input arguments once more:
x = 0
y = 0
width = 1403
height = 132

I don't know anything about OpenGL but it doesn't make sense to me that it is reading more data than width * height * 4. Could another application be interfering somehow?

General / Beginner struggling with getting first program to run.
« Last post by Bigbidoof on September 17, 2020, 08:16:50 am »
As the title said, I'm struggling with baby's first program. I installed SFML and followed the instructions from the SFML and Linux page. I got everything to compile, but when I do the final step and try to run it, I get this error.

Code: [Select]
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  56
  Current serial number in output stream:  57

I've tried searching around for this, but I haven't been able to find anything that helps or matches the the last two lines's serial numbers. Based on searching, I'm lead to believe this has something to do with my graphics card drivers. But I've tried reinstalling them. Any help is appreciated.
General / Re: Check player collisions in a maze
« Last post by eXpl0it3r on September 16, 2020, 08:16:20 am »
You can simplify the code quite a bit by calculating which position in the maze the player will move to, regardless of the direction the go, then before moving, check whether the player can move there and if so move them.

That way you have one location where you check whether the player can move to a place instead of four for each direction.
If getCell() returns the wrong position, make sure you double check your math on calculating the right cell.
Graphics / Re: glGenVertexArrays on the Mac
« Last post by eXpl0it3r on September 16, 2020, 08:04:16 am »
SFML only exposes the OpenGL symbols that it uses itself.
GLEW is a relatively outdated way to get OpenGL symbols and it's probably better to use something like Glad.
General / Re: CMake Static Linking SFML Libraries [undefined reference]
« Last post by eXpl0it3r on September 16, 2020, 08:01:38 am »
You CMake code isn't how you find SFML.

Like mentioned in this thread you really just need to have the following three statements for linking SFML statically:

find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
target_link_libraries(SFMLTest sfml-graphics sfml-audio)

This requires that you set SFML_DIR to the directory where the SFML config files are located (usually SFML/lib/cmake/SFML).

Note also that SFML will automatically look for its dependencies and link them, so you don't really need to search for freetype in your own CMake script.
Graphics / Re: Unicode Text Appearing as Boxes With Question Marks
« Last post by eXpl0it3r on September 16, 2020, 07:54:41 am »
Interesting...I'm surprised that it worked when displaying in the command prompt then.  I'll try a different font and see if that fixes anything.
They probably have some fallback font defined for other character sets.
General discussions / Re: 2D skeletal animation with SFML?
« Last post by eXpl0it3r on September 16, 2020, 07:53:42 am »
You could use Spine for your animations. They already provide a runtime for SFML.
There are also alternatives like Spriter with a generic C++ API.
Pages: [1] 2 3 ... 10