Jump to content
  • Advertisement

Jamie_Edwards

Member
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

123 Neutral

About Jamie_Edwards

  • Rank
    Member
  1. Jamie_Edwards

    Seg Fault when trying to access function in shared_ptr

    Using Netbeans 8.2 
  2. Jamie_Edwards

    Seg Fault when trying to access function in shared_ptr

    Except that the closed() case should not be triggered until the "x" button is pressed on the window? I have however changed break; to return; and it still gives the above error.
  3. Jamie_Edwards

    Seg Fault when trying to access function in shared_ptr

    It doesn't seem anything is null per say but I get the following in my InputManager class: void InputManager::handleEvents() { sf::Event event; while(mp_engine->getWindow()->pollEvent(event)) { // <-- This is where it segfaults. switch(event.type) { case sf::Event::Closed: mp_engine->getWindow()->close(); break; default: break; } } } It then kicks me to SFML's Window class to pollEvent(Event& event)?
  4. Hi guys,   So I have a weird problem, so I have the following in a class std::shared_ptr<gyroEngine::managers::InputManager> mp_inputManager; ... void GyroEngine::startManagers() {     mp_inputManager = std::make_shared<gyroEngine::managers::InputManager>(*this); } That is all fine and dandy, it seems to be working as is, I'm not getting any faults or anything from doing that and mp_inputManager is getting initialised.   Here's where my issue is. In my InputManager class I have: void InputManager::handleEvents() { sf::Event event; while(mp_engine->getWindow()->pollEvent(event)) { switch(event.type) { ... } } } Which also seems ok. I have the following back in my GyroEngine class: void GyroEngine::gameLoop() { while(mp_window->isOpen()) { mp_inputManager->handleEvents(); update(); render(); } } Here is where it gets interesting. When I start the program, I instantly get a Segmentation Fault and it's coming from mp_inputManager->handleEvents(). I know this because just before I inserted that function into the gameLoop(), I'd written a handleEvents() function into GyroEngine. My getWindow() function is as follows: const std::shared_ptr<sf::RenderWindow> getWindow() const { return mp_renderWindow; } What could be causing me to get this segfault?
  5. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

    Actually, I may have figured out my problem whilst doing a different problem... It could that I've not initialised everything in the right order...   Example:   I have two std::maps: std::map<std::string, GUI> m_guiMap; std::map<std::string,sf::Font> m_fontMap; if I have two functions that initialise each map, and the m_guiMap needs an m_fontMap entry to initialise one of its entries, so if I do: loadGui(); loadFont(); Because loadFont() is after loadGui(), the m_fontMap won't have been initialised when loadGui() needed it, thus throwing an error. But if I swapped them around it'll work fine.   So I think somewhere in my code I've got the initialisation order wrong and it's have a scits at me xD
  6. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

    Hi, any ideas?
  7. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

    Well upon looking at Game::m_world(m_window); which is the initialiser for my World class, it says the following for m_worldView: m_viewport: left: 4.59... top: 6.13... width: 0 height: -nan(0x7fdfd0) so by the looks of things, World is actually being given that value in the first place, but World is being initialised as it's supposed to be.   Where as, (and I actually got things the wrong way around) my m_window.setView(m_worldView); has the following: m_viewport: left: 0 top: -nan(0x7fffff) width: 0 height: 0
  8. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

    Pasting your code here isn't what mhagain is suggesting. The suggestion is to set a breakpoint and inspect the actual values when the code is being executed, to verify that they are actually valid when the error occurs. Have you done this?   Actually, is debugging with breakpoints something you've done before? Since this is in For Beginners, your experience level is hard to guess.   I have, but because I've moved over from WIndows originally and used VSC++, it was a lot easier to set break points and see it as it goes on there.   I'm now using Ubuntu 15.10 and CodeLite... So I'll try and give it a go, and post my findings...   EDIT:-   Ok, so here's what I'm seeing:   World::m_worldView: m_viewport: left: 4.5... top: 6.1... width: 0 height: -nan(0x7fdfd0) Do you know what that means?
  9. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

    So 3.0 is the correct version. So to answer the question That is the version your system is using. Nothing is "wrong", although it might be unexpected to you. Your configuration is set to use OpenGL version 3.0. If you want something newer you'll need to update your system's drivers or other configuration values. There are many different OpenGL drivers available on Linux systems with a wide range of configuration options.   You'll need to research what combinations work with your hardware and be prepared to undo whatever changes you did if you accidentally mess something up.   How would my drivers be an issue if, as I've already mentioned, I can get textures onto the screen if I completely bypass everything and create everything within my Game class?
  10. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

      If  that's the case then in my game class I have the following: void Game::render() { m_window.clear(); m_world.draw(); m_window.setView(m_window.getDefaultView()); m_window.display(); } And in my World class: World::World(sf::RenderWindow &window) : m_window(window), m_worldView(window.getDefaultView()), ... m_scrollSpeed(-50.0f), ... { ... m_worldView.setCenter(m_spawnPosition); } World::update(sf::Time dt) { // Scroll the world m_worldView.move(0.0f, m_scrollSpeed * dt.asSeconds()); ... } World::draw() { m_window.setView(m_worldView); .... } m_scrollSpeed is the only thing I know of that is in negative values apart from the players escorting aircraft.
  11. Jamie_Edwards

    OpenGL call failed in RenderTarget.cpp (SFML2)

      This is what I get from that: jamie@jamie:~$ glxinfo | grep -i opengl OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Bay Trail OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.0.2 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 11.0.2 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.0.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00 OpenGL ES profile extensions:
  12. Hi guys, So I'm now using CodeLite to develop my SFML game, and also reading from the SFML Game Development book and have hit a little bit of a hitch in the third chapter called "World". This is the github for the chapter: https://github.com/SFML/SFML-Game-Development-Book/tree/master/03_World Now onto my error... I've copied what's both in the book and the github word for word in terms of code (I've added extra functions here and there to break the code into more understandable parts for me). Now it all comes out error and warning free, but when I go to run the program I get a black window and the following runtime error:   An internal OpenGL call failed in RenderTarget.cpp(418). Expression: glViewport(viewport.left, top, viewport.width, viewport.height) Error description: GL_INVALID_VALUE A numeric argument is out of range. Now I've looked around the internet and found out that that error tends to lead to an out-of-date graphics card... But I've a very new Lenovo IdeaPad Flex 10 running Ubuntu 15.10. Also when I do the following in the main Game class: sf::Texture m_texture; sf::Sprite m_sprite; m_texture.loadFromFile("/Path/To/Texture/Resource.png"); m_sprite.setTexture(m_texture); m_window.clear(); m_window.draw(m_sprite); m_window.display(); And that single sprite displays fine.   I also placed the following into my Game::run() function to check the major version of OpenGL my graphics card can provide: sf::ContextSettings settings = m_window.getSettings(); std::cout << settings.majorVersion << "." << settings.minorVersion << std::endl; and it came out with a value of 3.0.    I don't understand what could be going wrong... Any ideas?
  13. Jamie_Edwards

    Learning C++ Interactively?

    Hi guys,   So, my native programming language is Java which although is becoming more and more of a game dev language, it's something that I'm not prepared to use. I have however dabbled in C/C++ and would like to learn the language even further to what I already know.   I'm here writing to you guys because I would like to know if anyone knows of any tutorials out there that teach C/C++ in an interactive way. What do I mean by that? Well, there's a website called "Codecademy" (some of you might of heard about this site) who teach you major web based languages such as HTML/CSS, JavaScript, Java and Python.   Yes I know that I could probably buy books that teach me C/C++ but I'm a learner who doesn't like reading and copying from a text book but rather be given an instruction and be expected to do it, which is what Codecademy does. But it doesn't do the langauge in question.   Also, as a sort of second question on the side that's kinda related to this one... What is your gamedev language and how did you learn it?   Thanks guys!   Jamie.
  14. Jamie_Edwards

    SDL2 Not Loading/Showing Images?

    OK, I've decided to follow the tutorial a little closer to get the gist of how to make SDL work, but it's still not working properly. It builds and runs fine, but when I ask it to load a ".bmp" image, it just shows a white surface.   I've tried putting the image in with the "Initialize.cpp", "main.cpp", "Gui.cpp" and in the root directory, and even in the bin/debug folder and it still comes up with a just a white screen.
  15. Jamie_Edwards

    SDL2 Not Loading/Showing Images?

      Right ok.     I tried doing as you said and I think I did it wrong as it threw errors at me. Could you show me how it should be implemented?     It's responsible for pretty much everything, it initializes the event loop, gui, render and finally the cleanup when the app is closed.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!