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

Pages: [1]
1
General / Linux quit error / Shader units
« on: May 11, 2010, 09:06:12 pm »
Hi again :)

This time I have two questions.

First, what is the unit defined in opengl that is the equivalent of one pixel un sfml ? I coded a quick gaussian blur shader in which i can choose the offset. In the beginning i was surprised when I set the offset to 1.0 thinking that it was one pixel (in fact it stretched the first column / row of pixel accross the whole screen). To do a decent blur I have to set the offset to 0.002 or less...

 Second, I just compiled SFML2 under Archlinux, everything went smoothly, I built my project ok, the program runs good too. The only "problem" is when I quit (I used the same code I made under Windows) the application, I have the following exit error :

Code: [Select]
X Error of failed request:  GLXBadPbuffer
  Major opcode of failed request:  131 (GLX)
  Minor opcode of failed request:  28 (X_GLXDestroyPbuffer)
  Serial number of failed request:  45
  Current serial number in output stream:  46

RUN FAILED (exit value 1, total time: 3m 13s)


(Note that it's better than when I crash under Windows, where the return value is something like -1'038'034'567 :D)

2
General / Really stuck, GUI project (sf::Drawable problem)
« on: May 07, 2010, 07:50:10 pm »
Finally got rid of this horrible runtime error O______O
Instead of doing this :
Code: [Select]
window.add(&Button(blah blah));
I had to do this :
Code: [Select]
Button button(blah blah);
Widget *ptr = &btn;
window.add(ptr);


Hiura also pointed that I could do :
Code: [Select]
Button* button = new Button(blah blah);
window.add(btn);


I just still don't understand what went wrong with the 1st one... Also with this method I must clean pointers afterwards :(

3
General / Really stuck, GUI project (sf::Drawable problem)
« on: May 07, 2010, 06:25:40 pm »
In fact I already tried rendering directly to the target. But when I do
Code: [Select]
void Window::Render(sf::RenderTarget &target, sf::Renderer &renderer) const
{
target.Draw(main_box);
for (unsigned int i = 0; i < widgets.size(); i++)
{
target.Draw(*widgets[i]);
}
}

Runtime error R6025 "pure virtual function call" happens.
The only pure virtual function I have here is Widget::Render(...). In my widget pointer vector here, I only have a Button which inherits from Widget. So normally it should call Button::Render and not Widget::Render.. Sorry to bother, I'm really noob ^^

The same for loop worked perfectly in another function than Window::Render (I did it first in a function "Update()" which renders everything in a RenderImage and then updates a sprite which I drawed in Window::Render)

Hope it's not too confusing xD

4
General / Really stuck, GUI project (sf::Drawable problem)
« on: May 07, 2010, 12:00:40 pm »
Thanks, I didn't realize it was const !

Well. All my widgets have local window coordinates so I draw them all in the RenderImage and then I just have to correctly position it where the window actually is.

5
General / Really stuck, GUI project (sf::Drawable problem)
« on: May 07, 2010, 02:24:02 am »
Hi everyone !

I've been beginning a GUI recently for a game project with a friend. I've already coded a kind of rich-text:



I'm now trying to implement several GUI classes, all inheriting from sf::Drawable :
    Every part of a window will be inheriting of Widget
    For example in the source I added Button : Widget which draws a box and a text label
    Window, which contains a sf::RenderImage container where we will draw every Widget that has been added to the vector of widgets via void add(Widget widget)


My problem occurs when I try to draw all my Drawable Widgets in my sf::RenderImage named container. I really don't see what I do wrong and the compiler error message doesn't help me much :
Code: [Select]

void Window::Render(sf::RenderTarget &target, sf::Renderer &renderer) const
{
for (unsigned int i = 0; i < widgets.size(); i++)
{
container.Draw(widgets[i]);
}

sprite.SetImage(container.GetImage());
sprite.SetPosition(pos.x, pos.y);
target.Draw(sprite);

}

1>c:\users\tenchi\documents\visual studio 2008\projects\sfmlgui\sfmlgui\gui.cpp(133) : error C2663: 'sf::RenderTarget::Draw' : 2 overloads have no legal conversion for 'this' pointer
1>c:\users\tenchi\documents\visual studio 2008\projects\sfmlgui\sfmlgui\gui.cpp(136) : error C2662: 'sf::Sprite::SetImage' : cannot convert 'this' pointer from 'const sf::Sprite' to 'sf::Sprite &'
1>        Conversion loses qualifiers
1>c:\users\tenchi\documents\visual studio 2008\projects\sfmlgui\sfmlgui\gui.cpp(137) : error C2663: 'sf::Drawable::SetPosition' : 2 overloads have no legal conversion for 'this' pointer


I have uploaded the VC2008 project here. The preceding errors occur in gui.cpp at the very bottom (I commented the lines that don't compile so you can build the project normally to test it)

(If you build it, don't run it from visual studio but from either Debug/ or Release/ so that the program finds resources/ ... didn't find how to do this clean)

6
Graphics / sf::RenderImage problem (SFML2)
« on: May 06, 2010, 02:41:36 pm »
It was that, thanks =]
My pseudo rich-text is approaching completion now ^^

7
Graphics / sf::RenderImage problem (SFML2)
« on: May 06, 2010, 01:38:53 pm »
Hello everyone !

First of all, I'm pretty new to SFML and Cpp so please bare with me :D
I started developing a GUI for a project of mine some days ago with SFML 1.6. I then started to realize I needed some functions that were not present there. sf::RenderImage is exactly what I needed to do a buffer and then draw it on the screen.

My problem is that I want to resize my sf::RenderImage buffer each time I resize my widget on the screen. So I thought I could just redo buffer.Create(new X, new Y) all the time but it doesn't seem to resize anything : the rendered Image keeps the same size. I found a workaround by doing a sf::RenderImage that fills the whole screen but it isn't very clean..

Do I do something wrong ? Is it SFML 2 ? ^^

Pages: [1]