Page 1 of 2
Effects with CEGUI
Posted: Tue Apr 28, 2009 10:29
by nooby
Hello CE!
I have a question about what kind of effects I can realise with CEGUI.
Can I make my own effects? In what way (hetitage from your class, etc. ?)? I will use OpenGL renderer!
Thank you!
Re: Effects with CEGUI
Posted: Tue Apr 28, 2009 20:16
by CrazyEddie
This is still an area that I need to put some time into testing out various ideas and then gauge the success or failure, so at the moment I'm not 100% sure what is and is not possible myself, I have some ideas of things I need to test, but until I get around to that I'm going to stay pretty quiet - for two reasons, first I do not want to put my foot in my mouth, and second, I don't want to promise something I later fail to deliver.
Having said all that, the general approach is to implement the CEGUI::RenderEffect interface (the docs on that tell you what each function is for) and then set instances of that effect on the RenderingSurface for the Window(s) you want the effect on (like what's done in demo 7). I'll be adding better and more automatic support for binding effects to windows sometime soon (was going to be last week; didn't happen. Maybe next week, or so).
CE.
Re: Effects with CEGUI
Posted: Wed Apr 29, 2009 07:45
by nooby
Oki thanks!
Re: Effects with CEGUI
Posted: Thu Apr 30, 2009 14:10
by nooby
Hello!
I have an other question! Is it possible to display video in a CEGUI window?
Thanks!
Re: Effects with CEGUI
Posted: Fri May 01, 2009 08:57
by CrazyEddie
You can display anything you can get into a texture, so yes. It's been done many times before.
If this is using trunk, then obviously with the new caching system in place you will likely have to manually request that the window hosting the video be redrawn at appropriate intervals (which would be when the video frame changes, and not every frame - since if you're running at 1000FPS and the video is running at 25FPS then the redraw of 975 frames is a waste). Alternatively you could disable any texture caching on the sub-hierarchy that's hosting the video.
HTH
CE.
Re: Effects with CEGUI
Posted: Fri May 01, 2009 11:10
by nooby
Ok thank you! I will try this!
For now I try an effect that is to be able to throw a window. What I mean is that the window still slides during a while after press mice off.
I achieve this effect but there is a bug: when the window stop, I can not move it on anymore. I think I have to indicate somewhere the new position of the window but I don't know which method use.
My effect code is located in a renderEffect class.
To move the windows I use CEGUI::RenderingWindow::setPosition() method.
Thanks
Re: Effects with CEGUI
Posted: Fri May 01, 2009 14:22
by masch
Hello: nooby.
Can you share the effect that you made it??
I want to make some effect but I do not have so much experience, Do you have any documentation to recommend?
Salu2...
masch...
Re: Effects with CEGUI
Posted: Sat May 02, 2009 07:46
by CrazyEddie
nooby wrote:when the window stop, I can not move it on anymore. I think I have to indicate somewhere the new position of the window but I don't know which method use.
My effect code is located in a renderEffect class.
To move the windows I use CEGUI::RenderingWindow::setPosition() method.
Because the mouse interaction and hit-testing is done a a higher level of abstraction (CEGUI::Window), when you move the CEGUI::RenderingWindow the logical representation becomes 'detached' from the visual representation. What you have to do is move the window via the normal CEGUI::Window interface; this will automatically move the CEGUI::RenderingWindow and keep the logical and visual representations synched.
Obviously the next question may then be how do we obtain a CEGUI::Window from the CEGUI::RenderingWindow? The answer is that we do not; they are at completely different levels of abstraction so RenderingWindow does not know anything about the interactive components that just happen to draw to it. The solution is to store a pointer to the CEGUI::Window in the CEGUI::Effect subclass, which can then be accessed to perform the animated move operation.
HTH
CE.
Re: Effects with CEGUI
Posted: Sat May 02, 2009 20:32
by nooby
Oki thanks!
But type of setPosition is not the same with RenderingWindow class (float) and Window class(UDim). To get float data I try:
Code: Select all
Window win->getPosition().d_x.asAbsolute(1.0f);
but It seams that it is not the same reference than RenderingWindow ::getPosition() method.
Since I use float datas in my trajectory calculation function I need float!
Can you help me please?
Thank you!
marsh>> sorry I edit instead of quote but it still ok for share you what I have done!
Re: Effects with CEGUI
Posted: Sun May 03, 2009 01:25
by masch
nooby>> Can you share me that effect do you have??... I saw the wobbly effect of the example7, but It's to hard for me to understand it.
Right now I made a simple merge between CEGUI and Box2d (an open source 2D physics engine for games.), but I want to add some more effects.
Re: Effects with CEGUI
Posted: Mon May 04, 2009 15:11
by nooby
Something else that is not specificly related to effects, but about projet compilation!
I want to write Effects subclass in others files *.h and *.cpp. Then I include *.h file in the file that use it but when I make it doesn't know the subclass. I search in the Makefile and changes some things but I stil have errors!
Maybe you can help me because I'm not an expert in makefile!
Thanks!
Re: Effects with CEGUI
Posted: Mon May 04, 2009 17:53
by masch
nooby wrote:Something else that is not specificly related to effects, but about projet compilation!
I want to write Effects subclass in others files *.h and *.cpp. Then I include *.h file in the file that use it but when I make it doesn't know the subclass. I search in the Makefile and changes some things but I stil have errors!
Maybe you can help me because I'm not an expert in makefile!
Thanks!
I do not know if I understand you, For example...Do you want to create a new effect in another file?? Something like in the sample7, but in different files??
Re: Effects with CEGUI
Posted: Tue May 05, 2009 07:37
by nooby
Yes!
I want to write my own effects subclass code in file name MyEffects.cpp for instance and include MyEffects.h in sample_demo.cpp. But I don't know how to do! I try to modify makefile but nothing change! I think I modify the wrong variable!
Re: Effects with CEGUI
Posted: Tue May 05, 2009 16:41
by masch
nooby wrote:Yes!
I want to write my own effects subclass code in file name MyEffects.cpp for instance and include MyEffects.h in sample_demo.cpp. But I don't know how to do! I try to modify makefile but nothing change! I think I modify the wrong variable!
I just move the wobbly effect to an cpp and h and then I change the Makefile.am adding the MyEffect.cpp file:
Original:
Demo7_SOURCES = Sample_Demo7.cpp
New:
Demo7_SOURCES = Sample_Demo7.cpp MyEffect.cpp
You just need to add this line.
Re: Effects with CEGUI
Posted: Wed May 06, 2009 08:17
by nooby
Ok thank, that the modification i've done but it still doesn't work!
In fact I try to implement my videoPlayer in a renderEffect subclass. This implementation is in MyVideoPlayer .cpp and .h files, and I want to use MyVideoPlayer methods in sample_demo7 class!
Here result of make:
/bin/sh ../../libtool --tag=CXX --mode=link g++ -g -O2 -o Demo7 Sample_Demo7.o ../../cegui/src/libCEGUIBase.la ../../Samples/common/src/libCEGUISampleHelper.la -lglut -lGLU -lGL -lSM -lICE -L/usr/lib64 -L/home/nooby/Softwares/ffmpeg_0.5/usr/local/lib
g++ -g -O2 -o .libs/Demo7 Sample_Demo7.o ../../cegui/src/.libs/libCEGUIBase.so -L/usr/lib64 ../../Samples/common/src/.libs/libCEGUISampleHelper.so /home/nooby/CEGUI6.2/trunk/cegui/src/RendererModules/OpenGL/.libs/libCEGUIOpenGLRenderer.so /home/nooby/CEGUI6.2/trunk/cegui/src/.libs/libCEGUIBase.so -lfreetype -lpcre -lGLEW -lglut -lGLU -lGL -lSM -lICE -L/home/nooby/Softwares/ffmpeg_0.5/usr/local/lib -Wl,--rpath -Wl,/home/nooby/CEGUI6.2/local/lib
Sample_Demo7.o: In function `Demo7Sample::handleVideoPause(CEGUI::EventArgs const&)':
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.cpp:885: undefined reference to `MyVideoPlayer::pauseVideo()'
Sample_Demo7.o: In function `Demo7Sample::handleVideoPlay(CEGUI::EventArgs const&)':
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.cpp:878: undefined reference to `MyVideoPlayer::playVideo()'
Sample_Demo7.o: In function `Demo7Sample':
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.h:118: undefined reference to `MyVideoPlayer::MyVideoPlayer()'
Sample_Demo7.o: In function `~Demo7Sample':
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.h:118: undefined reference to `MyVideoPlayer::~MyVideoPlayer()'
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.h:118: undefined reference to `MyVideoPlayer::~MyVideoPlayer()'
Sample_Demo7.o: In function `Demo7Sample::setTaharezLook2()':
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.cpp:739: undefined reference to `MyVideoPlayer::MyVideoPlayer(CEGUI::Window*)'
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.cpp:739: undefined reference to `MyVideoPlayer::~MyVideoPlayer()'
Sample_Demo7.o: In function `~Demo7Sample':
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.h:118: undefined reference to `MyVideoPlayer::~MyVideoPlayer()'
/home/nooby/CEGUI6.2/trunk/Samples/MyDemo7/Sample_Demo7.h:118: undefined reference to `MyVideoPlayer::~MyVideoPlayer()'
collect2: ld returned 1 exit status
make: *** [Demo7] Error 1
Maybe you can help me!
Thanks!