Canvas

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
TWO
Halfling
Posts: 61
Joined: Sat Jan 26, 2008 9:30 pm
Location: Germany
Contact:

Re: Canvas

Post by TWO »

With Ogre 1.6, Canvas is crashing for me.

Details:
line 281 in Atlas.cpp: delete rect;
OgreMain_d.dll!Ogre::Image::~Image() line 71
OgreMain_d.dll!Ogre::MemoryTracker::_recordDealloc(void * ptr=0x0e936640) line 73

Seems that it doesn't like the new mem allocators. Hope somebody managed to fix the issues and can give me a piece of advice :)

Thanks
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Canvas

Post by jacmoe »

You need to use OGRE_MALLOC and OGRE_FREE when you create/destroy Ogre managed resources.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Curtaoa
Gnoblar
Posts: 15
Joined: Thu Jan 08, 2009 8:50 pm

Re: Canvas

Post by Curtaoa »

Spent all morning NOT checking the forum and figuring it out for myself ;)

Only two changes are needed, in Atlas.cpp:

Code: Select all

217c217
<                       unsigned char* buffer = new unsigned char[bitmap.rows * bitmap.pitch * 2];
---
>                       unsigned char* buffer = OGRE_ALLOC_T(unsigned char, bitmap.rows * bitmap.pitch * 2, Ogre::MEMCATEGORY_GENERAL);
253c253
<       unsigned char* vcolBuffer = new unsigned char[16];
---
>       unsigned char* vcolBuffer = OGRE_ALLOC_T(unsigned char, 16, Ogre::MEMCATEGORY_GENERAL);
arete
Gnoblar
Posts: 2
Joined: Thu Jul 17, 2008 4:03 pm

Canvas+PSSM

Post by arete »

Hiya!

Has anyone tried Canvas with PSSM shadows? The shadows work fine without Canvas. As soon as I create a Canvas all the shadows disappear.

Any ideas?
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: Canvas

Post by Nargil »

Code: Select all

1>Document.cpp
1>c:\users\nargil\desktop\canvax\src\demo\source\document.cpp(72) : error C2259: 'Canvas' : cannot instantiate abstract class
1>        due to following members:
1>        'void Ogre::MovableObject::visitRenderables(Ogre::Renderable::Visitor *,bool)' : is abstract
1>        d:\programowanie\gra\ogresdk\include\ogremovableobject.h(484) : see declaration of 'Ogre::MovableObject::visitRenderables'
trying to compile the demo against 1.6.1
its this line

Code: Select all

	canvas = new Canvas(atlas, viewport);
there is also some kind of missconfiguration for the VC. Commenting the line out (just to try if it compiles) results in:

Code: Select all

1>Embedding manifest...
1>mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file ".\Bin\debug\Demo.exe". The binary is not a valid Windows image.
but this is less important as i can fix it. The first error I can't
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: Canvas

Post by AshMcConnell »

Does anyone get a large Canvas.lib and a small Canvas_d.lib - seems odd to me.

Canvas.lib = 19,902K
Canvas_d.lib = 4,183K

Any ideas why? I am trying to track down why my game is running slow in VS2008 (it was fine in 2005).

All the best,
Ash

PS. Nargil: - http://www.ogre3d.org/forums/viewtopic.php?f=2&t=46767
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Canvas

Post by toglia »

Has anyone faced problems showing canvas boxes when using a compositor effect. In my case its the glow implementation found here: http://www.ogre3d.org/forums/viewtopic.php?t=52316, when I enable it, the canvas stops showing up, is there any workaround on this?
User avatar
Superfeesh
Halfling
Posts: 62
Joined: Tue Jun 23, 2009 4:53 pm
x 1

Re: Canvas

Post by Superfeesh »

toglia wrote:Has anyone faced problems showing canvas boxes when using a compositor effect. In my case its the glow implementation found here: http://www.ogre3d.org/forums/viewtopic.php?t=52316, when I enable it, the canvas stops showing up, is there any workaround on this?
Yea, I'm having the same problem too! :( It would be great to know how to resolve this.
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Canvas

Post by toglia »

Its like the canvas is not yet in the rendertarget when it goes to the compositor... (Bump :mrgreen: )
Last edited by toglia on Wed Nov 25, 2009 8:54 pm, edited 1 time in total.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Canvas

Post by xavier »

Do not bump. You likely will have better luck asking the author in his own forums at www.princeofcode.com.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Canvas

Post by toglia »

Hi all,

I have been using this lib since I first saw it in AJ's "Player Demo" and I really like it cause of the speed, but apart from the compositor issue, I have been experiencing some trouble to (Z) order "GUICanvas" instances, they sometimes switch without any reason. I have a couple of GUIs, one to show error messages for example, and sometimes (almost randomly) the TextList renders on the bottom of my other guis :shock: ... If there is a way to control this? princeofcode forum is almost unactive...

Isn't Canvas like the fastest way to put 2d stuff on the screen? Seems like I'm the only one using it... :roll: :roll:
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Re: Canvas

Post by ajs15822 »

toglia wrote:Hi all,

I have been using this lib since I first saw it in AJ's "Player Demo" and I really like it cause of the speed, but apart from the compositor issue, I have been experiencing some trouble to (Z) order "GUICanvas" instances, they sometimes switch without any reason. I have a couple of GUIs, one to show error messages for example, and sometimes (almost randomly) the TextList renders on the bottom of my other guis :shock: ... If there is a way to control this? princeofcode forum is almost unactive...

Isn't Canvas like the fastest way to put 2d stuff on the screen? Seems like I'm the only one using it... :roll: :roll:
Hey toglia,

It's been a while since I looked at the code but I suspect that you're experiencing z-fighting because you need to manually declare the z-order of each GUICanvas instance. For example, to specify the z-order of a Canvas instance, you might change its constructor to something like this:

Code: Select all

Canvas::Canvas(Atlas* atlas, Ogre::Viewport* viewport, Ogre::uint zOrder) : atlas(atlas), viewport(viewport), vertexData(0), indexData(0), bufferSize(100), renderQueueID(Ogre::RENDER_QUEUE_OVERLAY + zOrder), isDirty(false), visibility(true)
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Canvas and dds format

Post by toglia »

Thanks aj, it worked nicely. One more thing, after completing my gui, frames have dropped to 30 (on the target pc) :(

I thought I would boost the app again by using the dds format for all my gui textures, but its throwing me:
OGRE EXCEPTION(9:UnimplementedException): This method can not be used to compress or decompress images in PixelUtil::bulkPixelConversion at ..\src\OgrePixelFormat.cpp (line 1194)
on

Code: Select all

Ogre::PixelUtil::bulkPixelConversion((*i)->image.getPixelBox(), convPixels);
I tried changing the pixel format of the texture here:

Code: Select all

	Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(
		texName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
		Ogre::TEX_TYPE_2D, dimensions.first, dimensions.second, 0, Ogre::PF_DXT5,
		Ogre::TU_STATIC_WRITE_ONLY, this);
...
Ogre::PixelBox convPixels(Ogre::Box(0, 0, (*i)->width, (*i)->height), Ogre::PF_DXT5, conversionBuf);
...
texture->setFormat(Ogre::PF_DXT5);
and almost everywhere I saw PF_BYTE_BGRA, but I still get a crash. I really don't know if the texture format of the atlas is meaningful, I certainly know I have gained quite a few frames using dds formats for my meshes...
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Re: Canvas

Post by ajs15822 »

Converting the texture atlas to a DDS would provide some amount of speedup (at least in the amount of texture memory used since certain cards can use compressed DDS natively without unpacking) however I would expect the effect to be pretty negligible in this case. Plus, it seems Ogre's bulkPixelConversion utility doesn't support DDS creation (which is why you're getting an UnimplementedException).

How many separate instances of GUICanvas are you using in your UI? (Each instance of Canvas adds another batch count) Also, what are the final dimensions of your packed texture atlas?
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Canvas

Post by toglia »

Hi Aj, sorry for the late response, I only have two GUI instances, one is for error messages and some debug information, and the other one is for the game itself. For the game ui I almost have 500 little boxes, but how can I calculate the size of the packed atlas?
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Re: Canvas

Post by ajs15822 »

You can get the dimensions of the Texture Atlas via Atlas::getDimensions(). The reason I'm asking is that if your final texture size is very large (2048 or larger), it might make more sense to split up your atlas and sacrifice some of your batch count.
seiky
Gnoblar
Posts: 7
Joined: Tue Mar 17, 2009 4:15 pm

Re: Canvas

Post by seiky »

Hi,

I have a question about the canvas and the updateGeometry function.

in the function you set the *vBuffer++ = 0;
for the Z coordinate, what happen if you change this value ?

The canvas is a plane (correct me if I'm wrong), in that case, is it possible to change the shape of the plane, or using the canvas like another 3D element (rotation, changing depth in the screen,...) ?

I mean use it like a Navi in the 3D space :
http://navi.agelessanime.com/wiki/index ... creen1.jpg

thank you
rebol
Kobold
Posts: 34
Joined: Tue Sep 09, 2008 2:28 am

Re: Canvas

Post by rebol »

Curtaoa wrote:Spent all morning NOT checking the forum and figuring it out for myself ;)

Only two changes are needed, in Atlas.cpp:

Code: Select all

217c217
<                       unsigned char* buffer = new unsigned char[bitmap.rows * bitmap.pitch * 2];
---
>                       unsigned char* buffer = OGRE_ALLOC_T(unsigned char, bitmap.rows * bitmap.pitch * 2, Ogre::MEMCATEGORY_GENERAL);
253c253
<       unsigned char* vcolBuffer = new unsigned char[16];
---
>       unsigned char* vcolBuffer = OGRE_ALLOC_T(unsigned char, 16, Ogre::MEMCATEGORY_GENERAL);
Thanks for your porting to 1.6, :)
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Canvas

Post by toglia »

I was just reading the alimer engine showcase and got somewhat nostalgic by the 2d features. The author talks about sprites being fully batch but also allowing rotations and transparency.

That made me wonder, is it possible to do transparency per sprite with Canvas? I understand Canvas is packing all the textures into one, so at first it doesn't make much sense...

I love Canvas, but also love doing transparent transitions :(
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Canvas

Post by Beauty »

If there exists a port or wrapper for use with Mogre (C#/.NET), please let me know.
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
boyamer
Orc
Posts: 459
Joined: Sat Jan 24, 2009 11:16 am
Location: Italy
x 6

Re: Canvas

Post by boyamer »

Well maybe i can release my 2d drawing stuff open source.. :) no problem at all.

I'll made two version :
1 ) Pure c++ Ogre
2 ) Mogre C# version.

Hope you like the idea :)
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Canvas

Post by Beauty »

Oh boyamer, my sunshine - you are like a wizard, who conjures up useful helpers out of your tophat. ImageImage
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Canvas

Post by Beauty »

It's sad to see that's so quiet around Canvas, although it's really nice.
Is it usable with Ogre 1.7 or 1.8?
Are there any news?
Does some people use Canvas?

boyamer, you wanted to release 2D stuff for Mogre. (A port of Canvas?)
Unfortunately I didn't see a release. Did you do? Do you plan do do?
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Canvas

Post by toglia »

I still use Canvas for my simple 2d needs. I have found it to be a superb solution when framerate is priority. I think it works seamless with 1.7.

There seems to be a lot of fuss with Beatjaen's Gorilla though (Another 2d solution for Ogre). But it expects you to do the spritesheet yourself along with the sprite info file. In terms of implementation I really don't know how does gorilla work or who's faster. My bets are on Canvas. Should be nice to know.

Anyway, I'd also like to know the future of Ogre's 2d needs.

AT.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Canvas

Post by jacmoe »

My bet is on Gorilla. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply