sfml

OpenGL - Object Transformations and VBOs

拥有回忆 提交于 2019-12-24 05:03:37
问题 So I've written a program that renders a mesh using a Vertex Buffer Object, and lets me move the camera around. I now want to make the object move independently of the camera/view. However, I'm not sure how to go about moving my meshes through space. Googling tends to find sources either telling me to rotate the objects with glRotatef(), etc., or that using glRotatef() and its siblings is a bad idea because they are deprecated. Perhaps I'm not using the right search terms, but I'm not finding

SFML RenderWindow taking a long time to open a window

青春壹個敷衍的年華 提交于 2019-12-24 00:08:33
问题 I know this is essentially a duplicate, but this wasn't ever answered. I'd like to mention that I have followed the tutorial for using SFML along with Visual Studio, and I'm running a 64-bit project with 64-bit SFML. The window loaded instantly a few times, and now consistently takes 40 seconds to open on new builds/debugs. I also have the downloading of debug symbols off. My graphics drivers are up to date and my HDD is fine. This is the code: #include <SFML/Graphics.hpp> int main() { sf:

Rotate Sprite to Mouse Position

倖福魔咒の 提交于 2019-12-23 19:16:38
问题 I've been using the SFML 1.6 library, and I'd like to know. How does one rotate a sprite so it always turns toward where the mouse is located on screen? Thanks. (SFML specific code is preferred) 回答1: If you have the position of the sprite : S = (Sx, Sy) and the position of the cursor C = (Cx, Cy) You can calculate the angle between the vector = (Cx - Sx, Cy - Sy) and a unit vector for example = (1, 0, 0). To calculate the angle you can use the cross product : And then : then you calculate the

SFML 2.0 – drawing with vector of sprites

我的未来我决定 提交于 2019-12-23 19:01:29
问题 I'm trying to create a loop to draw 10 blocks on the screen, but nothing is showing. I got no error, so I think that the vector is not storing the sprites. I'm new to SFML, so I don't really know what I'm doing wrong. sf::Texture bTexture; sf::Texture bloqueTexture; sf::Sprite bloqueSprite; //create vector of blocks std::vector<sf::Sprite> bricks(10, sf::Sprite(bloqueTexture)); fondo.setTexture(img_mgr.getImage("fondo.jpg")); personaje.setTexture(img_mgr.getImage("jumper.png")); personaje

Can't get SFML for Python 2.7

安稳与你 提交于 2019-12-23 15:59:46
问题 What I'm trying to do I'm trying to get the SFML binding for Python 2.7. 32-bit version of python using windows. https://python-sfml.org/download.html What I've tried There exe doesn't work because when you click or save the link it returns nothing and says it's missing. I also used PIP to install Cython which I have, though when I try to use PIP to download pysfml, pySFML, python-sfml or sfml-python, pip tells me: Could not find a version that satisfies the requirement sfml(from versions:)

Applying a blur shader to sf::RectangleShape

北慕城南 提交于 2019-12-23 04:35:09
问题 I have an object that is a 2d array of sf::RectangleShapes (for a tile-based game). It's supposed to look like a cloud, so I want to add some blur to it. Here is what it looks like now: And I want it to look like this: Instinctively, it seems to achieve this blur effect on the low level, I would have to draw the cloud object to a buffer, and then apply the blur object to the buffer. But I'm not sure if SFML is doing this already. In my main loop, I have this: for( CloudIterator it = clouds

C++ having trouble returning sf::Texture

谁说胖子不能爱 提交于 2019-12-23 02:48:12
问题 I'm trying to store all my textures in an array. but the images aren't getting returned it would seem here's my code I was under the assumption that my loadTex and loadSpri functions would return and store their data in the array that i made, but it doesn't seem to be working that way because when i run the game they don't show up, just white space. My code probably looks bad, but i'm quite the beginner still and trying to get the hang of things Here's render.cpp #include "render.h"

How can I generate Visual Studio projects for a specific configuration?

折月煮酒 提交于 2019-12-22 14:51:52
问题 Using CMake's ExternalProject_Add , I automate builds of my dependencies. However, I build configurations don't match in the end even though I pass CMAKE_BUILD_TYPE and BUILD_SHARED_LIBS as described in the Tutorial. # SFML include(ExternalProject) set(SFML_PREFIX ${CMAKE_SOURCE_DIR}/SFML) # Download, configure, build and install. ExternalProject_Add(SFML # DEPENDS PREFIX ${SFML_PREFIX} TMP_DIR ${SFML_PREFIX}/temp STAMP_DIR ${SFML_PREFIX}/stamp #--Download step-------------- GIT_REPOSITORY

How can I share my SFML game with others without errors?

烂漫一生 提交于 2019-12-22 08:19:25
问题 So, I finished a game in C ++ / SFML and I would like to send it to someone but when I send it there are errors: I tested the exe on another computer with SFML DLLs required and it shows me that libstdc ++ - 6.dll is missing, so I added it and I tried again and it tells me that there are still other dll missing, it is very embarrassing. How can I share my game without all those errors and missing DLLs? 回答1: You could use Dependency Walker (depends.exe) to find all the dll-s your application

Learning to use VBOs properly

谁都会走 提交于 2019-12-22 07:14:07
问题 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