ok i have found a work around, its not perfect but I don't have to maintain any changes to sfml or do anything to hackish.
I am using an FBO the same size as the screen, and then using glCopyTexImage2D to get the texture i want to use. its less then efficient but it works =). anyway i suppose i will post the code i used todo this.
// GuiImage.h
class GuiImage
{
private:
GLuint TextureObjectId;
static GLuint FrameObjectId;
static GLuint FBOTextureId;
GLuint Width,Height;
public:
GuiImage(sf::RenderWindow &App,GLuint w, GLuint h);
~GuiImage();
void SetActive( bool active);
void Update( sf::RenderWindow &App );
void Bind( void );
};
and
// GuiImage.cpp
GLuint GuiImage::FrameObjectId = 0;
GLuint GuiImage::FBOTextureId = 0;
GuiImage::GuiImage(sf::RenderWindow &App,GLuint w, GLuint h) :
Width(w), Height(h), TextureObjectId(0)
{
glGenTextures(1,&TextureObjectId);
glBindTexture(
GL_TEXTURE_RECTANGLE_ARB,
TextureObjectId);
glTexImage2D(
GL_TEXTURE_RECTANGLE_ARB,
0, GL_RGBA8,Width,Height,0,GL_RGBA8,GL_UNSIGNED_BYTE,0);
if(FrameObjectId == 0)
{
glGenFramebuffersEXT(1,&FrameObjectId);
glGenTextures(1,&FBOTextureId);
glBindTexture(
GL_TEXTURE_RECTANGLE_ARB,
FBOTextureId);
glTexImage2D(
GL_TEXTURE_RECTANGLE_ARB,
0, GL_RGBA8,
App.GetWidth(),App.GetHeight(),
0,GL_RGBA,GL_UNSIGNED_BYTE,0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,FrameObjectId );
glFramebufferTexture2DEXT(
GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_RECTANGLE_ARB,
FBOTextureId,0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
};
};
GuiImage::~GuiImage()
{
glDeleteTextures(1,&TextureObjectId);
};
void GuiImage::SetActive( bool active )
{
if(active)
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,FrameObjectId );
}
else
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
};
void GuiImage::Update( sf::RenderWindow &App )
{
glBindTexture(
GL_TEXTURE_RECTANGLE_ARB,
TextureObjectId);
glEnable(GL_TEXTURE_RECTANGLE_ARB);
glCopyTexImage2D(
GL_TEXTURE_RECTANGLE_ARB, //target
0, //level
GL_RGBA8, //internal format
0,
App.GetHeight() - Height,
Width,
App.GetHeight(),
0);
glDisable(GL_TEXTURE_RECTANGLE_ARB);
};
void GuiImage::Bind( void )
{
glBindTexture(
GL_TEXTURE_RECTANGLE_ARB,
TextureObjectId);
glEnable(GL_TEXTURE_RECTANGLE_ARB);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
int err = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if(err != 0x8CD5 )
std::cout<<"error using fbo! "<<err<<std::endl;
};