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

Author Topic: Textures and RenderTextures broken  (Read 5199 times)

0 Members and 1 Guest are viewing this topic.

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Textures and RenderTextures broken
« Reply #15 on: August 26, 2011, 01:15:39 am »
Update on this, I just downloaded SFML 1.6 from the downloads page and it works fine.
So unless there is any major changes between how 1.6 manages images and how 2.0 does it then it must be something to do with my build

Just tried rebuilding SFML 2 and same problem

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Textures and RenderTextures broken
« Reply #16 on: August 26, 2011, 09:01:27 am »
What happens if you load the texture after creating the window?

PS: please fix your indentation :shock:
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Textures and RenderTextures broken
« Reply #17 on: August 26, 2011, 02:29:22 pm »
Recompiled SFML (I was messing with it last night) and the test minimal project works now :D

But for some reason the openGL one doesnt
:/

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Textures and RenderTextures broken
« Reply #18 on: August 26, 2011, 06:48:38 pm »
Well the program doesnt crash now, and it works ok except that it doesnt show the image.
Just to check is this the correct way of using it?


in main
Code: [Select]

//main loop
case menu:
            {
                titleScreen.Update();

                App.SaveGLStates();
                titleScreen.Draw(App);
                App.RestoreGLStates();
                break;
            }


title screen header

Code: [Select]

#ifndef TITLESCREEN_HPP_INCLUDED
#define TITLESCREEN_HPP_INCLUDED

#include <SFML/Graphics.hpp>

class TitleScreen
{
    sf::Texture titleImage;
public:
    TitleScreen();
    ~TitleScreen();
    void Draw(sf::RenderWindow &App);
    void Update();
};

#endif // TITLESCREEN_HPP_INCLUDED



titlescreen code

Code: [Select]

#include "TitleScreen.hpp"

TitleScreen::TitleScreen()
{

    titleImage.LoadFromFile("./data/Title.png");

}

TitleScreen::~TitleScreen() {}

void TitleScreen::Update()
{

}

void TitleScreen::Draw(sf::RenderWindow &App)
{
    App.Draw(sf::Sprite( titleImage ) );

}



Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Textures and RenderTextures broken
« Reply #19 on: August 26, 2011, 06:49:55 pm »
Yes, should be ok.
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Textures and RenderTextures broken
« Reply #20 on: August 26, 2011, 07:52:29 pm »
Im going to stickk with SFML 1.6 for the moment, 2.0 must not like my system too much :P

Is there any way to specify what version of openGL you want with SFML 1.6?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Textures and RenderTextures broken
« Reply #21 on: August 26, 2011, 08:28:09 pm »
Nop.
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Textures and RenderTextures broken
« Reply #22 on: August 31, 2011, 08:24:26 pm »
Just tried using valgrind thought this might give some more details about the porblem

Code: [Select]
==6759== Conditional jump or move depends on uninitialised value(s)
==6759==    at 0x4049DFA: sf::Renderer::SetShader(sf::Shader const*) (in /usr/local/lib/libsfml-graphics.so.2.0)
==6759==    by 0x4395FFFF: ???
==6759==
==6759== Conditional jump or move depends on uninitialised value(s)
==6759==    at 0x4049C28: sf::Renderer::SetBlendMode(sf::Blend::Mode) (in /usr/local/lib/libsfml-graphics.so.2.0)
==6759==    by 0x4395FFFF: ???
==6759==
==6759== Conditional jump or move depends on uninitialised value(s)
==6759==    at 0x4049D48: sf::Renderer::SetTexture(sf::Texture const*) (in /usr/local/lib/libsfml-graphics.so.2.0)
==6759==    by 0x404F191: sf::Sprite::Render(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0)
==6759==    by 0x4033F57: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0)
==6759==    by 0x4395FFFF: ???


Seems this is the problem, just tried something and it crashed with any drawable not just textures/sprites

 

anything