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.


Topics - luminous

Pages: [1]
1
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.


2
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);
};

};

Pages: [1]
anything