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

Author Topic: Creating RenderImage  (Read 2702 times)

0 Members and 2 Guests are viewing this topic.

TheDistur

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating RenderImage
« on: June 04, 2011, 07:20:26 pm »
I am able to call Create on a RenderImage in the main() function of a program. If I call it in a member function of a class, my main window, a RenderWindow draws nothing. The program seems to continue running.  What am I missing here?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Creating RenderImage
« Reply #1 on: June 04, 2011, 08:38:32 pm »
The error is at line 42.

Seriously, show your code ;)
Laurent Gomila - SFML developer

TheDistur

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating RenderImage
« Reply #2 on: June 04, 2011, 09:34:02 pm »
Okay here's a minimum example of the trouble I am having.

Code: [Select]
#include <SFML/Graphics.hpp>
#include "include/MyObject.h"

int main()
{
    sf::RenderWindow MyRenderWindow(sf::VideoMode(640, 320, 32), "Title");

    MyObject MyObjectInstance;
    MyObjectInstance.CreateRenderImage();

while (MyRenderWindow.IsOpened())
{
   sf::Event Event;
        while (MyRenderWindow.PollEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                MyRenderWindow.Close();
        }
        MyRenderWindow.Clear();
        MyRenderWindow.Display();
}
return EXIT_SUCCESS;
}



MyObject.cpp
Code: [Select]
#include "MyObject.h"

MyObject::MyObject()
{
}

MyObject::~MyObject()
{
}

void MyObject::CreateRenderImage(void)
{
    sf::RenderImage MyRenderImage;
    MyRenderImage.Create(30, 30);  // MyRenderWindow stops drawing. Code after this would execute though.

}

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Creating RenderImage
« Reply #3 on: June 04, 2011, 10:15:09 pm »
MyRenderImage only exists in the scope of the member function. You have to declare it as a member variable if you want to keep it.

This is basic C++ or any other programming language, my suggestion is that you study that trough a book or tutorial. Before or along side SFML doesn't matter.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TheDistur

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating RenderImage
« Reply #4 on: June 04, 2011, 10:32:34 pm »
Quote from: "Groogy"
MyRenderImage only exists in the scope of the member function. You have to declare it as a member variable if you want to keep it.

This is basic C++ or any other programming language, my suggestion is that you study that trough a book or tutorial. Before or along side SFML doesn't matter.
That's not the issue. The code is a minimum example to show the issue I am having. Please run the code and watch what happens when Create is called.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Creating RenderImage
« Reply #5 on: June 04, 2011, 10:51:33 pm »
Thanks for the minimal code. I'll try to test it as soon as possible.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Creating RenderImage
« Reply #6 on: June 05, 2011, 10:39:39 am »
What exactly is your code supposed to show? It should be a black window, so what else do you see after you create/destroy the render image?
Laurent Gomila - SFML developer

TheDistur

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating RenderImage
« Reply #7 on: June 05, 2011, 07:39:32 pm »
This is what I'm seeing.



If there's anything else you need, let me know.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Creating RenderImage
« Reply #8 on: June 05, 2011, 08:34:03 pm »
Thanks.

What's your graphics card? Is it a crappy Intel integrated chipset?
Laurent Gomila - SFML developer

TheDistur

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating RenderImage
« Reply #9 on: June 05, 2011, 09:03:31 pm »
Guess so, GMA 950 in my netbook.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Creating RenderImage
« Reply #10 on: June 05, 2011, 09:15:43 pm »
sf::RenderImage has a lot of problems with this chipset. I'm afraid I won't be able to fix them for SFML 2.0.
Laurent Gomila - SFML developer

TheDistur

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating RenderImage
« Reply #11 on: June 05, 2011, 09:17:48 pm »
Oh, thanks for having a look at my problem anyway.