yozefx / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

to let the gui support iphone. #259

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
it seems that the librocket gui don't support iphone ogre,   no demo.    i try 
to port gui demo to iphone , but fail.   always crash at 
render_system->_render(ogre3d_geometry->render_operation);

ps:  i had change indexbuffer from 32bit to 16bit .

Original issue reported on code.google.com by lin...@gmail.com on 9 Aug 2012 at 4:09

GoogleCodeExporter commented 8 years ago
the lib rocket owner had not slove the  the ogre intergrate .   
http://forums.librocket.com/viewtopic.php?f=6&t=813

Original comment by lin...@gmail.com on 9 Aug 2012 at 4:18

GoogleCodeExporter commented 8 years ago
did you try to ask in the ogre-forums? Maybe they know a solution?

Original comment by tomag...@googlemail.com on 9 Aug 2012 at 9:14

GoogleCodeExporter commented 8 years ago
yeah , i will try it .  
do you have something plan to design an abrastract layer to support ui engine 
select, then we can support other ui engine, like mygui/cegui/qt. etc.   i know 
mygui can port to iphone. i had succeed tested on ogre1.7.  

Original comment by lin...@gmail.com on 12 Aug 2012 at 1:38

GoogleCodeExporter commented 8 years ago
Did you already ask in the ogre forums? I'm currently having the same problem. 

But I'm not sure whether libRocket doesn't support ios. Because they provide 
XCode projects to compile librocket for ios. Although there is no demo 
project... 

Original comment by underd...@gmail.com on 13 Aug 2012 at 10:51

GoogleCodeExporter commented 8 years ago
Some time ago when I wanted to get librocket running on android I struggled 
also over the 32bit indexbuffer and my lack of ogre-knowledge (that might be a 
bit different now). I converted the buffer to 16bit, but didn't get it to work. 
I think it should(!) be possible to get it work on android and iOS. At least on 
the librocket they say that there is a game out using it...
@lin: eventhough a ui-layer would be the gamekit-way I don't plan something 
like this(not sure about DiThi). Feel free to contribute something like this. 
An abstract UI-Layer would be a great thing. :D

Original comment by tomag...@googlemail.com on 13 Aug 2012 at 3:14

GoogleCodeExporter commented 8 years ago
i had asked in the ogre forum.  
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=71384 ,  but not answer till 
now.   

i think no demo , no true. i had asked librocket's owner,  but no answer.  if 
it can , why not to write a demo,  it just a little time.

Original comment by lin...@gmail.com on 13 Aug 2012 at 6:01

GoogleCodeExporter commented 8 years ago
Well that's life. From time to time you have to dig into something reallly deep 
which can last days for just 2 lines of code :D You can't actually demand from 
the librocket-guy(s) to write a demo for you. Simple or not. 
On the frontpage of the librocket side they say there are games on android and 
iOS using librocket (even though I can't see anything about it in that 
videos)...

Original comment by tomag...@googlemail.com on 13 Aug 2012 at 9:53

GoogleCodeExporter commented 8 years ago
yeah , that is the point "many days for just 2 lines code".  thanks for you 
reply  probably must to check the ogre-ios shader system , which i am 
unfamiliar.  i think i must spent double spare days to learn it, then back to 
this.

Original comment by lin...@gmail.com on 14 Aug 2012 at 2:05

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Yeah, sad but true. It is always like this... It's all about learning, and this 
is not lost...you will always stay limited and dependent on others if you are 
not willing to dig. You won't believe how many hours I just read 
ogrekit-sourcecode to find out what's going on :D
Actually don't think you have to have a look at the shader. I think you were 
already at the right spot switching to the 16bit index. First step would be to 
get it work for the desktop-version as this is much easier to debug. (Actually 
I don't see a reason of 32bit an index for a ui-system :D) It must be something 
going wrong with creating the ogre-geomerty...

Original comment by thomas.t...@googlemail.com on 14 Aug 2012 at 8:53

GoogleCodeExporter commented 8 years ago
Actually it seems to be really a gles2-rendersystem-issue. Maybe updating ogre 
will solve the problem as they have done much stuff concerning 
ogles2...updating will need some time...but you can give it a try...

Original comment by tomag...@googlemail.com on 14 Aug 2012 at 10:09

GoogleCodeExporter commented 8 years ago
thanks for you reply,  of course i belive.  "more and more hour to read/debug 
the source code" .  that is the main point of the opensource project.   i had   
read the code  in fact.   but about the shader , i had some  doubts and 
suspicions  that i can't master, so i must dig into,  use any way ,  debug or 
read more issue code to check it ,then master it.

Original comment by lin...@gmail.com on 15 Aug 2012 at 12:24

GoogleCodeExporter commented 8 years ago
I'm not sure how save this method is, but by filling the indices like this, it 
seems to work on the iphone. At least it's not crashing...

// Create the index buffer.
        Ogre::HardwareIndexBufferSharedPtr index_buffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT, num_indices, Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
        geometry->render_operation.indexData->indexBuffer = index_buffer;
        geometry->render_operation.useIndexes = true;

        // Fill the index buffer.
    uint16_t* ogre_indices = (uint16_t*)index_buffer->lock(0, index_buffer->getSizeInBytes(), Ogre::HardwareBuffer::HBL_NORMAL);
        //memcpy(ogre_indices, indices, sizeof(unsigned int) * num_indices);
        for (int i = 0; i < num_indices; ++i)
        {
        ogre_indices[i] = indices[i];
    }
    index_buffer->unlock();

Only problem I have right now is that the font doesn't get rendered, All I see 
is white squares representing letters...

Original comment by underd...@gmail.com on 16 Aug 2012 at 4:41

GoogleCodeExporter commented 8 years ago
did you .     that is my   iphonedemo  main.mm file.   i just add the fonts and 
the assert file to the iphonedemo target.

i awlays crack at the gles2rendersystem.   it seems programPipeline  is zero.

LSLESProgramPipeline* programPipeline = 
                    GLSLESProgramPipelineManager::getSingleton().getActiveProgramPipeline();
                if (!programPipeline->isAttributeValid(sem, elem->getIndex()))
                {
                    continue;
                }

did you change  anything else?   what about your 
arch/sdk/deployent_target/device_family/mac version/xcode version?

archs:armv7 i386/ios5.1/ios 4.0/ipad-iphone/lion 10.7.4/xcode 4.3.1.   i use 
cmake 2.8.8.

Original comment by lin...@gmail.com on 16 Aug 2012 at 10:26

Attachments:

GoogleCodeExporter commented 8 years ago
this is my renderinterfaceogre3d.cpp/rocketrenderlistener.cpp

it seems that render_system unbindthegpuprogram  .  where did you bind the gpu 
program ?

Original comment by lin...@gmail.com on 16 Aug 2012 at 10:39

Attachments:

GoogleCodeExporter commented 8 years ago
i know you , you just use gles1 no gles2  /   i make it with gles1  ,  got the 
same result with you 

Original comment by lin...@gmail.com on 17 Aug 2012 at 2:49

GoogleCodeExporter commented 8 years ago
Thanks for the files. Do those work for you with the font as well?

Original comment by underd...@gmail.com on 17 Aug 2012 at 8:34

GoogleCodeExporter commented 8 years ago
no, the font is square  in gles1/   but gles2  always crack.     i will try 
to fix font  in the following days.

Original comment by lin...@gmail.com on 17 Aug 2012 at 7:58

GoogleCodeExporter commented 8 years ago
OK. What do you mean by "but gles2 always crack"?

Original comment by underd...@gmail.com on 18 Aug 2012 at 11:10

GoogleCodeExporter commented 8 years ago
it is only work on gles1 rendersystem .  but no work for gles2 render.

Original comment by lin...@gmail.com on 19 Aug 2012 at 12:03

GoogleCodeExporter commented 8 years ago
Did you get anywhere with also supporting gles2. I'm also working on it, but it 
segfaults. I'm trying because the font is not working with gles1 and it might 
ork with gles2. maybe...

Original comment by underd...@gmail.com on 23 Aug 2012 at 8:08

GoogleCodeExporter commented 8 years ago
thanks for you reply.

what is the real meaning of  segfaults ?  

yes , i try a lot of times . but always got the wrong result .

following is my stack  ,  i don't konw why glslesprogramcommon is nil, and 
where to bind the program on gles2? 

#0  0x00923586 in 
Ogre::GLSLESProgramCommon::isAttributeValid(Ogre::VertexElementSemantic, 
unsigned int) at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/RenderSystems/GLES2/src/GLSLES/src/Ogre
GLSLESProgramCommon.cpp:159
#1  0x00922d74 in Ogre::GLES2RenderSystem::_render(Ogre::RenderOperation const&) 
at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/RenderSystems/GLES2/src/OgreGLES2Render
System.cpp:1521
#2  0x0018390c in RenderInterfaceOgre3D::RenderCompiledGeometry(unsigned long, 
Rocket::Core::Vector2<float> const&) at 
/volumes/MacData/Work/ogrekit/Engine/GUI/rocket/RenderInterfaceOgre3D.cpp:201
#3  0x00a04fea in Rocket::Core::Geometry::Render(Rocket::Core::Vector2<float> 
const&) at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/Geometry
.cpp:137
#4  0x0094e7c8 in 
Rocket::Core::DecoratorTiledBox::RenderElement(Rocket::Core::Element*, unsigned 
long) at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/Decorato
rTiledBox.cpp:297
#5  0x00964308 in Rocket::Core::ElementDecoration::RenderDecorators() at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/ElementD
ecoration.cpp:172
#6  0x0099c996 in Rocket::Core::Element::Render() at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/Element.
cpp:182
#7  0x0099c9c6 in Rocket::Core::Element::Render() at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/Element.
cpp:189
#8  0x0099c9c6 in Rocket::Core::Element::Render() at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/Element.
cpp:189
#9  0x00987962 in Rocket::Core::Context::Render() at 
/volumes/MacData/Work/ogrekit/Dependencies/Source/libRocket/Source/Core/Context.
cpp:161
#10 0x0018488a in 
RocketRenderListener::postRenderTargetUpdate(Ogre::RenderTargetEvent const&) at 
/volumes/MacData/Work/ogrekit/Engine/GUI/rocket/RocketRenderListener.cpp:65
#11 0x0039b2ba in Ogre::RenderTarget::firePostUpdate() at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRenderTarget.cpp:432
#12 0x0039a568 in Ogre::RenderTarget::_endUpdate() at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRenderTarget.cpp:186
#13 0x0039a4ac in Ogre::RenderTarget::updateImpl() at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRenderTarget.cpp:155
#14 0x0039c0dc in Ogre::RenderTarget::update(bool) at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRenderTarget.cpp:611
#15 0x003892b2 in Ogre::RenderSystem::_updateAllRenderTargets(bool) at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRenderSystem.cpp:122
#16 0x003b04d0 in Ogre::Root::_updateAllRenderTargets() at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRoot.cpp:1393
#17 0x003b0484 in Ogre::Root::renderOneFrame() at 
/volumes/MacData/Work/ogrekit/Ogre-1.8rc/OgreMain/src/OgreRoot.cpp:978
#18 0x000c4896 in gkEngine::stepOneFrame() at 
/volumes/MacData/Work/ogrekit/Engine/gkEngine.cpp:638
#19 0x0000734c in OgreKit::stepOneFrame() at 
/volumes/MacData/Work/ogrekit/Samples/IPhoneDemo/Main.mm:82
#20 0x00006fe0 in -[AppDelegate stepOneFrame:] at 
/volumes/MacData/Work/ogrekit/Samples/IPhoneDemo/Main.mm:353
#21 0x378e7422 in CA::Display::DisplayLink::dispatch(unsigned long long, 
unsigned long long) ()
#22 0x378e7378 in 
CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long 
long, unsigned long long, unsigned long long, void*) ()
#23 0x34ff6f92 in IOMobileFramebufferVsyncNotifyFunc ()
#24 0x37ace890 in IODispatchCalloutFromCFMessage ()
#25 0x38269f42 in __CFMachPortPerform ()
#26 0x38274552 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#27 0x382744f4 in __CFRunLoopDoSource1 ()
#28 0x38273342 in __CFRunLoopRun ()
#29 0x381f64dc in CFRunLoopRunSpecific ()
#30 0x381f63a4 in CFRunLoopRunInMode ()
#31 0x37fcdfcc in GSEventRunModal ()
#32 0x31d76742 in UIApplicationMain ()

Original comment by lin...@gmail.com on 24 Aug 2012 at 12:40

GoogleCodeExporter commented 8 years ago
in this weekend i had update ogre form 1.8rc to 1.8  ,  but i got the white 
result .  just the scene but no the dialog .  it is very strange.

Original comment by lin...@gmail.com on 27 Aug 2012 at 9:44

Attachments:

GoogleCodeExporter commented 8 years ago
That's strange. Is this rendered with GLES1 or 2? Did the gui work?

I tried to upgrade to the newest ogre dev version from bitbucket but had the 
same results as with the 1.8rc

Original comment by underd...@gmail.com on 27 Aug 2012 at 9:47

GoogleCodeExporter commented 8 years ago
the gles1 render is this.

Original comment by lin...@gmail.com on 27 Aug 2012 at 10:02

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
why can't see anything with gles2?
can master give me the right to update the code ogre1.8 to source trunk ? 

Original comment by lin...@gmail.com on 27 Aug 2012 at 8:33

GoogleCodeExporter commented 8 years ago
to underd:the gui work, but the result is wrong,  it is gles2.  i use 1.8 r no 
rc.

Original comment by lin...@gmail.com on 27 Aug 2012 at 8:36

GoogleCodeExporter commented 8 years ago
It is not as easy to update to the trunk. Some functions have changed. I tried 
it once and commented all the parts out that did not work. but I had the same 
results as wirth the 18.r

Original comment by underd...@gmail.com on 28 Aug 2012 at 10:39

GoogleCodeExporter commented 8 years ago
 need i commit 1.8r and a few change of ogrekit to  ogrekit trunk.    or you can do it ?

Original comment by lin...@gmail.com on 28 Aug 2012 at 3:12

GoogleCodeExporter commented 8 years ago
No, I can't do it. But you should ask Tom and tell him what files exactly you 
have used...

Original comment by underd...@gmail.com on 29 Aug 2012 at 12:51

GoogleCodeExporter commented 8 years ago
who is tom, what is his e-mail

Original comment by lin...@gmail.com on 30 Aug 2012 at 5:31

GoogleCodeExporter commented 8 years ago
http://code.google.com/u/112068207251644828378/#

He also commented on this issue.

Original comment by underd...@gmail.com on 30 Aug 2012 at 5:42

GoogleCodeExporter commented 8 years ago
I can't follow here, has linccg fixed the problem? Just create a patch-file and 
I will have a look and commit

Original comment by thomas.t...@googlemail.com on 31 Aug 2012 at 7:53

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
i only fix some,  i think this issue is huge,just too deep to dig, so i patch 
for the following.
1\update ogre from 1.8rc to 1.8
2\integrate gui demo to iphone demo.   50%  (has two problem:
  1\for gles1,  font mess up hav't fix , see:IMG_0019.PNG, 
  2\for gles2  the render no crash,render succeful , but see nothing on the scene, see:IMG_0021.PNG )  

upload my patch now,  hope this can help other.

Original comment by lin...@gmail.com on 2 Sep 2012 at 7:17

Attachments: