Information on Porting 1.x to 2.x? [Solved]

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
User avatar
WilliamKappler
Kobold
Posts: 33
Joined: Mon Feb 16, 2015 8:37 pm
Location: Raleigh, NC
x 2
Contact:

Information on Porting 1.x to 2.x? [Solved]

Post by WilliamKappler »

Due to some unexplained performance issues with my project on Ogre 1.x, I'm currently working on porting it to Ogre 2.x. It needed to happen anyway.

However, I ran into one big issue off the bat. It seems almost all my contact with Ogre is now deprecated. Specifically, I made heavy use of the hardware buffers (vertex/pixel).

Is there a source of information on porting? Especially that would cover how to deal with porting hardware buffer usage? All I have been able to find is the API reference (not so useful when trying to figure out how to do things), header comments (which are basically the same thing), the source itself, and the forums (which only cover what people have asked). The wiki was very helpful learning Ogre initially, but it seems to have no content relating to 2.x.

To avoid this being potentially an XY problem, I have been using these buffers for two main tasks:
  1. Direct control of vertexes/UVs in my GUI system, in which I felt manual objects were unnecessarily complex while not giving me enough access to do what I needed to in the most efficient way possible. (Basically like how overlays worked in 1.9)
  2. Write to textures, primarily for doing memory copies out of Pango-Cairo into Ogre, for my GUI engine's text rendering.
There's some other bits, but those are my main concerns.
Last edited by WilliamKappler on Sun Nov 15, 2015 7:05 am, edited 1 time in total.
Software Designer • World Builder • Game Designer • Engineer

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1100
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 153

Re: Information on Porting 1.x to 2.x?

Post by xrgo »

2.0 or 2.1?
1) don't know
2) I can confirm that textures are handled in the same way that it was in 1.9, just add v1 namespace in stuffs like "Ogre::v1::HardwarePixelBufferSharedPtr" or "Ogre::v1::HardwareBuffer::HBL_NORMAL", I haven't encounter any difference yet.
and if 2.1, you have to make your texture Ogre::TEX_TYPE_2D_ARRAY to put it on a pbs material.

al2950
OGRE Expert User
OGRE Expert User
Posts: 1214
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 149

Re: Information on Porting 1.x to 2.x?

Post by al2950 »

Porting manual can be found here;
https://bitbucket.org/sinbad/ogre/src/3 ... dt?at=v2-1

1) Agree manual objects are unnecessary. In 2.1 the vertex buffer control is much easier in my view. Ensure you run cmake with the 'OGRE_BUILD_SAMPLES2' option selected and look at the following samples
- Sample_CustomRenderable
- Sample_DynamicGeometry

2) Dont know any more than xrgo on this one I am afraid!

I am just finishing porting my system, at least to the point it runs anyway, and the improvements in both performance and quality are dramatic (And I have not even authored proper PBR textures yet), so I would urge you to stick with 2.1, even though the learning curve may be a little steep :D

User avatar
WilliamKappler
Kobold
Posts: 33
Joined: Mon Feb 16, 2015 8:37 pm
Location: Raleigh, NC
x 2
Contact:

Re: Information on Porting 1.x to 2.x?

Post by WilliamKappler »

Thank you both for your responses! That porting manual looks like exactly what I was looking for overall, but if in the interim I can keep using the 1.x style buffers with Ogre::v1::, that will definitely save some time. I will take a look at those the samples as well.

Also, it's 2.1 I am working with.
Software Designer • World Builder • Game Designer • Engineer

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4211
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 802
Contact:

Re: Information on Porting 1.x to 2.x?

Post by dark_sylinc »

I recommend reading the porting manual in OpenOffice (MS Word messes up the formatting). You can export to PDF.

As for the deprecated v1 objects:

They've been kept exactly for easier porting of preexisting engines (i.e. don't use them if you're starting from scratch). It makes our lives much easier. The biggest disadvantage you get from using the v1 formats (these issues affected 1.x anyway):
  • Less control over stalls (i.e. CPU waiting for GPU, driver randomly stalling). V2 objects stall much less, behave more predictibly and are much more explicit (e.g. StagingBuffer::canDownload & StagingBuffer::uploadWillStall)
  • v1 objects are slower in OpenGL. It incurs in higher draw call overhead and also MDI (MultiDrawIndirect) can't be used. But D3D11 is faster when it comes to v1 objects compared to GL. You still get auto instancing though.
As for the v1 hardware buffers:
  • For controlling textures, it's still the only interface that can be used, so no changes there.
  • You can use it to control things like UI, though I personally prefer to port this part to v2 buffers, since they're quite fast (MDI is great for UIs) and the predictability of the stalls and the ability to use StagingBuffers to update the data is wonderful. You can draw UIs extremely efficiently using the v2 objects.

hydexon
Gremlin
Posts: 164
Joined: Sun Apr 14, 2013 8:51 pm
x 10

Re: Information on Porting 1.x to 2.x?

Post by hydexon »

Well i was going to ask almost the same about getting access to the vertex buffers/UV since i'm still struggling how to integrate ImGUI into OGRE 2.1, since ImGUI needs access to vertex buffers and command lists. something like: https://github.com/ocornut/imgui/blob/m ... fw_gl3.cpp at ImGui_ImplGlfwGL3_RenderDrawLists function, which outputs the vertex data, i saw 1.8 implementations of various simple UI systems (Gorilla i had to discard it, too complex and dirty) but i have my thoughts if i tried to integrate with 2.1 using 1.8 practices, the usage of HLMS confused me a bit more....

User avatar
WilliamKappler
Kobold
Posts: 33
Joined: Mon Feb 16, 2015 8:37 pm
Location: Raleigh, NC
x 2
Contact:

Re: Information on Porting 1.x to 2.x?

Post by WilliamKappler »

Well, I'm glad this topic was helpful.

I've decided that I am going to hold off porting for now. I feel like Ogre2 needs to be better documented before I'm going to be able to move to it... I'm still having a hard time understanding what is going on with it even after reading the porting guide and looking at the samples. Which is fine, really, it's fairly developmental at the moment, I just get very irate when documentation is incomplete/difficult to follow.

Besides, I managed to solve the issue my GUI system was having in Ogre 1, so I don't feel a pressing need anymore. Turns out, it wasn't Ogre's fault at all, it was mine for not checking if I needed to update textures for the text objects.
Software Designer • World Builder • Game Designer • Engineer

Post Reply