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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - luminous

Pages: [1]
1
SFML projects / DLgui Update Aug, 26
« on: August 24, 2009, 08:43:17 am »
Ohh you will need the Glew library to compile the code.

http://glew.sourceforge.net/

2
SFML projects / DLgui Update Aug, 26
« on: August 24, 2009, 08:41:28 am »
Update Aug 26,
   I have posted a screen shot of the current version i am working on. Hopefully it makes it easyer to see what i am trying todo?

Here's a project i have been working on, After i have it all cleaned up more I am going to release this gui library under the same license as SFML. Their is still a lot of ruff edges that i want to clean up before anyone uses it. Below I have provided a link to the current code if I could get some people to take a peek at it and tell me what you think.

http://www.distant-light.net/DistantLightSoftware.zip

Currently the feature list is pretty descent.
* Render once draw many style system prevents needlessly redrawing text and other things every frame by using FBO's to store textures of the rendered Gui
* Themeing support through 9 slice rendering This also benefits from the FBO use.
* completely Shader driven

Things I have planned after I can get some review of what I have already done.
* more widgets (I have more that I didn't include in the zip above I want to see reaction to my object model before I put to much effort into this)
* Everything theme able.
* Easier to integrate with game applications
* look and feel will be very modifiable.

If their is something you would like to see that I don't currently have listed, please tell me and I will maybe add that to what I am trying todo.


3
I am hardly the authority on the matter, But from my poking around in the SFML 2.0 code to get idea's on using FBO's of sizes differing from the screen size with SFML drawable objects it looked like most of the code would be compatible with sfml 1.x, likely only requiring minor changes and a recompile due to slight API differences.

Really I can't wait SFML 2.0 is something I am looking forward to.

I have a Gui project I am working on as well, if your interested I would be more then happy to post the code after I polish it a bit.

I have a working 9slice render that draws to an FBO and saves the result as a texture for use later to prevent having to re-render  the same thing every frame. My widgets use FBO's as well and my gui only "re-renders" when something changes.  Maybe this approach would help with sf:String speed issues as well?

4
Graphics / sf::view and FBO's
« on: August 11, 2009, 11:12:05 am »
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.

Code: [Select]

// 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

Code: [Select]

// 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;
};

5
Graphics / sf::view and FBO's
« on: July 29, 2009, 09:09:09 am »
A gave sfml 2.0 another read through just to be sure. I am pretty sure it is the call to glViewport in the RenderWindow.Draw function. the Text will show up distorted ether to tall or to fat and the positions seem to be off. if the fbo is small enough say 100x100  nothing will show on it with
sf::View view(sf::Vector2f(50.f,50.f),sf::Vector2f(50.f,50.f)); however  a view port of sf::View view(sf::Vector2f(400.f,100.f),sf::Vector2f(400.f,400.f)); almost correctly but distorted to be to large..

If i do something to get around sfml setting the matrix up like this.
Code: [Select]

class BadPracticeString : public sf::String
{
public:
BadPracticeString() : sf::String()
{};
void Draw2(sf::RenderTarget &App)
{

Render(App);
};
};

and then setup the matrix/blend mode etc... manually it seems to work correctly with any size FBO.

Might just have to wait for sfml 2.0 maybe =)

*note class named as such so no one gets the idea that that practice is a good idea......

6
Graphics / sf::view and FBO's
« on: July 29, 2009, 02:25:04 am »
I have been trying to intermingle sfml calls with opengl calls on FBO's and they work so long as the FBO is the same size as the screen. Mostly I want to be able to use sf::string to an FBO of some size other then whatever the screen is set to.  I am guessing that i am not setting up the sf::View correctly but after much experimentation I though it might be worthwhile to ask.

I will note that i am using the GL_TEXTURE_RECTANGLE_ARB extension.

Code: [Select]

class GuiImage
{
private:
GLuint FrameObjectId;
GLuint TextureObjectId;

GLuint Width,Height;

public:
GuiImage(GLuint w, GLuint h) :
 Width(w), Height(h), FrameObjectId(0), TextureObjectId(0)
{
glGenFramebuffersEXT(1,&FrameObjectId);
glGenTextures(1,&TextureObjectId);
glBindTexture(
GL_TEXTURE_RECTANGLE_ARB,
TextureObjectId);

glTexImage2D(
GL_TEXTURE_RECTANGLE_ARB,
0, GL_RGBA8,Width,Height,0,GL_RGBA,GL_UNSIGNED_BYTE,0);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,FrameObjectId  );

glFramebufferTexture2DEXT(
GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_RECTANGLE_ARB,
TextureObjectId,0);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
};

~GuiImage()
{
glDeleteFramebuffersEXT(1,&FrameObjectId);
glDeleteTextures(1,&TextureObjectId);
};

void SetActive( bool active)
{
if(active)
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,FrameObjectId  );

glViewport(0, 0, Width, Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluOrtho2D(0,Width,Height, 0);
glMatrixMode(GL_MODELVIEW);
glColor4f(1.f,1.f,1.f,1.f);
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

}
else
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
};

sf::View GetView( void )
{
//sf::View myview(
// sf::FloatRect(0.f,0.f,Width,Height));
sf::View myview(
sf::Vector2f(Width/2,Height/2),
sf::Vector2f(Width/2,Height/2));
return myview;
};

void 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;
};

GLuint GetWidthi() const
{
return Width;
};

GLuint GetHeighti() const
{
return Height;
};

GLfloat GetWidthf() const
{
return static_cast<GLfloat>(Width);
};

GLfloat GetHeightf() const
{
return static_cast<GLfloat>(Height);
};

};

7
General discussions / SFML 2.0
« on: June 01, 2009, 05:06:27 am »
ot, my mistake.

8
General discussions / SFML 2.0
« on: May 31, 2009, 08:18:35 am »
Been using SFML last couple weeks and I must say I do like it very much. The only thing i might suggest that wasn't in your list is to make all the file loading functions accept std::wstring for the filename in addition to std::string that they use currently.

Pages: [1]