sfml

Learning to use VBOs properly

天大地大妈咪最大 提交于 2019-12-22 07:12:08
问题 So I've been trying to teach myself to use VBOs, in order to boost the performance of my OpenGL project and learn more advanced stuff than fixed-function rendering. But I haven't found much in the way of a decent tutorial; the best ones I've found so far are Songho's tutorials and the stuff at OpenGL.org, but I seem to be missing some kind of background knowledge to fully understand what's going on, though I can't tell exactly what it is I'm not getting, save the usage of a few parameters. In

The procedure entry point _ZSt24__throw_out_of_range_fmtPKcz could not be located in the dynamic link library sfml-graphics-2.dll

蹲街弑〆低调 提交于 2019-12-21 04:27:05
问题 Today I decided to download, install, and attempt to use SFML 2.2. I also downloaded Code::Blocks with the MinGW compiler. I set up everything and installed everything correctly (or so I thought) and tried to run a sample code to see if it would work: #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent

Large text appears blurry

青春壹個敷衍的年華 提交于 2019-12-20 02:37:26
问题 I'm using SFML 1.6 to make a small game, and I need to display some text, so I use the sf::String class. The problem is, when I increase the size to 96pt, the edges appear a little blurry. When I increase the size of text in Microsoft Word though, it appears very clean and has crisp edges. Is there a way to do that with SFML? 回答1: Looking at the SFML sources, it appears that it is using the embedded Arial font. Yes, it can also load the .ttf font file, but I guess you didn't load it yet. So

Failed to Initialize GLEW. Missing GL version

戏子无情 提交于 2019-12-18 03:50:09
问题 I've tried to set up SFML 2.0 with the latest version of the qt creator, I've set up SFML right and I imported a small game I wrote in visual studio. Upon compilation, I get this: What I tried Reinstalling the entire qt SDK and qt creator IDE from scratch Reinstalling SFML reinstalling mingw I tried to write a simple program to make sure it's not my code, the program compiles correctly but when I close the application, I get OpenGL errors which is not normal I tried posting a thread on the

sf::Texture as class member doesn't work?

北战南征 提交于 2019-12-17 14:52:20
问题 Heyy, I want to draw a sprite in my SFML application but its texture is always white when I use an image and a texture that are class members Class members: sf::Sprite myimg; sf::Image myimg_image; sf::Texture myimg_texture; When I then create the sprite like this in my cpp file // create image myimg_image.create(icon.width, icon.height, icon.pixelData); // create texture from image myimg_texture.create(icon.width, icon.height); myimg_texture.update(myimg_image); // apply texture to sprite

C++/SFML display glitch with sprite member changed by mouseclick

一笑奈何 提交于 2019-12-14 03:54:45
问题 I am learning C++/SFML and as a practice exercise I am making a small program that dispalys a 10x10 grid of 64x64 px square brown sprites in a window. This program allows you to select green/yellow/blue/grey/brown square sprites using the keyboard and replace any tile on said grid with this selected sprite. Game loop below: while (window.isOpen()) { window.clear(sf::Color(sf::Color::Black)); sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close()

SFML 2.1 and Codeblocks Error: sfml-graphics-2.dll is missing from your computer

穿精又带淫゛_ 提交于 2019-12-14 02:21:02
问题 I've just begun to use c++ and SFML, and everything FINALLY ran fine. Before I would get Undefined Reference Errors, but I realized that I had been downloading the wrong type of SFML, getting SJLJ instead of DW2. The problem was fixed, but was replaced with another; now whenever I run an SFML program, it opens a small windows: It says: The program can't start because sfml-graphics-2.dll is missing from your computer. Try reinstalling the program to fix this problem. And then when you press

SFML image not loading

六眼飞鱼酱① 提交于 2019-12-14 01:23:13
问题 I am using Xcode with SFML. I placed my file in the Xcode project which copied it to the directory. However, I still am unable to load it into the program. Any ideas? Code: int main(int argc, const char * argv[]) { sf::RenderWindow(window); window.create(sf::VideoMode(800, 600), "My window"); sf::Texture img; if(!img.loadFromFile("colorfull small.jpg")) return 0; sf::Sprite sprite; sprite.setTexture(img); window.draw(sprite); window.display(); while(window.isOpen()) { sf::Event event; while

Visual Studio Linker Error while linking SFML-2.1

旧巷老猫 提交于 2019-12-14 00:09:44
问题 #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); window.draw(shape); window.display(); } return 0; } i included additional directories to C:/SFML-2.1/include and linker to C:/SFML-2.1/lib i get the errors such as following

Segfault when drawing text with SFML

这一生的挚爱 提交于 2019-12-13 17:08:13
问题 I have made a Button class that should draw some vertices and a string to a RenderWindow . Here's the code with irrelevant pieces snipped out: (here is the full code) namespace game { class Button { public: Button(int _x, int _y, int _width, int _height, std::string text) { ... sf::Font font; font.loadFromFile("res/SF Intermosaic B.ttf"); label.setFont(font); label.setString(text); label.setCharacterSize(16); label.setColor(sf::Color(20, 20, 20)); ... } ... void draw(sf::RenderWindow& window)