Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Bug in Resize?  (Read 853 times)
Dialex
Customers
Community Member
*****
Posts: 4


« on: October 21, 2007, 10:33:58 AM »

Hi all

I have a weird problem. My TV3D engine render is TV3D.Init3DWindowed(Handle, true); on a Control (in .Net 2.0 scenario). Whenever i resize the control the area rendered is not the same as the control's size (see screenshot where i've resized down - if I resize up, the logo dissapears out of control area).

I've tried using TV3D.ResizeDevice(); and TV3D.GetViewport().Resize(); (and SetAutoResize as well) with no luck.

It worked in my 6.2/6.3 implementation. What am i doing wrong?

Thanks in advance!

Logged
EagleEye
Customers
Community Member
*****
Posts: 321


WWW
« Reply #1 on: October 21, 2007, 07:16:00 PM »

Ensure that you're initializing to the handle of the control you're rendering to.  If you're rendering to the form, it's Form1.Handle, but if you have a panel IN the form, and you init to Panel1.Handle, then resize the form... if that panel is not docked or anchored properly so it resizes with the form, you'll see problems.
Logged

Vermund - A Matter of Life and Death MMORPG
My TV Projects - EEGUI (A GUI for TV6.5 with .NET 2005+), Material Editor, tutorials, and more!
Dialex
Customers
Community Member
*****
Posts: 4


« Reply #2 on: November 01, 2007, 06:21:05 PM »

Thanks Eagle Eye, but those issues were taken care of.

I digged some more, and found out that the fact that I'm initializing in one thread, before starting the other thread doing the actual handling and rendering, apparently caused this issue. That was definitely not the case in 6.2/6.3!

I don't know why, but when I do the initialization in the same thread, the resize works as expected..

If anyone wants to dig further into this, I'll be more than happy to post the source code which shows the above..

Thank you!
Logged
pizzayoyo
Customers
Community Member
*****
Posts: 1320


WWW
« Reply #3 on: November 01, 2007, 06:32:12 PM »

Maybe try Tv.EnableMultithreading? Never tried multithreading myself, but its worth a try.
Logged

Dialex
Customers
Community Member
*****
Posts: 4


« Reply #4 on: November 01, 2007, 06:41:13 PM »

I've already tried TV.AllowMultithreading(true), but with no luck..
Logged
WEst
Community Member
*
Posts: 813

Daniel Martinek


WWW
« Reply #5 on: November 02, 2007, 03:47:32 AM »

I've already tried TV.AllowMultithreading(true), but with no luck..

Be sure to call it before the initialization of the engine.
Logged

Greetings

Daniel Martinek
Lead Programmer
Roaming Nova Studios
Dialex
Customers
Community Member
*****
Posts: 4


« Reply #6 on: November 02, 2007, 05:12:11 AM »

This is the code i use which, with the TV3D logo on, gives the same scenario as the screenshot i posted:


        public void EngineLoop()
        {
            while (bDoLoop)
            {
                TV.Clear(false);
                // Render everything
                Scene.RenderAll(true);
                TV.RenderToScreen();
            }
        }

        public void Start(IntPtr Handle)
        {
            hHandle = Handle;

            // - Snip 1 -

            TV = new TVEngine();

            TV.SetDebugMode(true, true);
            TV.SetDebugFile(System.IO.Path.GetDirectoryName
                 (Application.ExecutablePath) + "\\debugfile.txt");

            //TV.AllowMultithreading(true);

            TV.Init3DWindowed(hHandle, true);

            TV.GetViewport().SetAutoResize(true);
            TV.DisplayFPS(true);
            TV.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);
            Scene = new TVScene();
            Globals = new TVGlobals();

            bDoLoop = true;

            // - snip 2 -

            LoopThread = new Thread(new ThreadStart(EngineLoop));
            LoopThread.Start();
        }


Please note, that this is only when the display is in a UserControl.. (hHandle is the this.Handle from the Control).

If i move the code between snip 1 and snip 2 into the thread, before  while (bDoLoop) there's no scaling "error"..
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #7 on: November 02, 2007, 06:23:47 PM »

I think the problem here is multithreading !

DirectX has a limitation with multithreading for initialization/reset/resizing.

Engine initialization must be in the same thread as reset, resizing and reset.

When you use viewport.SetAutoResize( true ), the resizing test is done in TV.Clear.
So I think that if you initialize the engine in your rendering thread, it should work correctly.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks