Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Fullscreen issue when init the engine from the NEW function of a class  (Read 855 times)
Raul
Customers
Community Member
*****
Posts: 550

I like games.


WWW
« on: August 16, 2009, 06:28:24 AM »

I really don't know if this is a programming bug or a TV one but I will try:
In this topic I had a problem:

http://www.truevision3d.com/forums/tv3d_sdk_65/strange_behaviour_in_fullscreen-t19397.0.html

I made myself a cTV3DEngine Class, in order to have a clean code.

Well I am using VB.NET and when I init my class I have the NEW sub, something like that:

Code:
Public Sub New
 InitAllTVObjects
 InitTV3DEngine
End Sub

In VB, when I create:

MyEngine = New cTV3DEngine

this NEW sub is automatically runned, but if I init in FullScreen the engine will fail. If I am using only WindowMode, everything is fine.
Logged

jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #1 on: August 16, 2009, 10:04:15 AM »

Hmmm, which DLL are you using? You should be using the .NET DLL.
Also, with the .NET DLL, you want to be using the classes without the c in front, so TVEngine rather than cTVengine....etc...

It would help if you posted the code on how you init in fullscren though
« Last Edit: August 16, 2009, 10:11:38 AM by jviper » Logged

JAbstract.....Don't just imagine, make it happen!
Raul
Customers
Community Member
*****
Posts: 550

I like games.


WWW
« Reply #2 on: August 16, 2009, 01:28:27 PM »

"cTV3DEngine" is a custom class made by me. it is not the same name as TVEngine

Anywhay here is my cTV3DEngine:

Code:
Imports MTV3D65

Public Class cTV3DEngine

    Public Sub InitTVEngine()
        TV = New TVEngine
        TVdi = New TVDeviceInfo
        Scene = New TVScene
        Mat = New TVMaterialFactory
        Tex = New TVTextureFactory
        Inp = New TVInputEngine
        GraphicFX = New TVGraphicEffect

        Atmos = New TVAtmosphere

        LightEngine = New TVLightEngine

        Screen2D = New TVScreen2DImmediate
        Text2D = New TVScreen2DText
        Globals = New TVGlobals
        Maths = New TVMathLibrary

        CameraFactory = New TVCameraFactory

        InitTVEngineWindow()
    End Sub

    Private Sub InitTVEngineWindow()
        With TV
            If MySettings.MISC_IsDebug = 1 Then
                .SetDebugMode(True)
                .SetDebugFile(Windows.Forms.Application.StartupPath & "\DebugLog.txt")
            Else
                .SetDebugMode(False)
            End If

            .SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE)
            .SetSearchDirectory(Windows.Forms.Application.StartupPath)
            '.DisplayFPS(False)
            .SetWatermarkParameters(CONST_TV_WATERMARKPLACE.TV_WATERMARK_TOPRIGHT, 0.5)

            If MySettings.VIDEO_IsFullScreen = 0 Then
                frmMain.Width = MySettings.VIDEO_ResX
                frmMain.Height = MySettings.VIDEO_ResY
                .Init3DWindowed(frmMain.Handle)
            Else
                .Init3DFullscreen(MySettings.VIDEO_ResX, MySettings.VIDEO_ResY, 32, True, False, CONST_TV_DEPTHBUFFERFORMAT.TV_DEPTHBUFFER_BESTBUFFER, 1, frmMain.Handle)
            End If

            If MySettings.VIDEO_AA = 0 Then
                .SetAntialiasing(False, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_NONE)
            ElseIf MySettings.VIDEO_AA = 2 Then
                .SetAntialiasing(True, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES)
            ElseIf MySettings.VIDEO_AA = 3 Then
                .SetAntialiasing(True, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_3_SAMPLES)
            ElseIf MySettings.VIDEO_AA = 4 Then
                .SetAntialiasing(True, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_4_SAMPLES)
            End If

            If MySettings.VIDEO_VSync = 1 Then
                .SetVSync(True)
            Else
                .SetVSync(False)
            End If

            .ShowWinCursor(True)
        End With

        Inp.Initialize(True, True)

        With Scene
            .SetAutoTransColor(CONST_TV_COLORKEY.TV_COLORKEY_USE_ALPHA_CHANNEL)
            .SetDepthBuffer(CONST_TV_DEPTHBUFFER.TV_WBUFFER)
            .SetRenderMode(CONST_TV_RENDERMODE.TV_SOLID)
            .SetBackgroundColor(0, 0, 0)
            .SetTextureFilter(CONST_TV_TEXTUREFILTER.TV_FILTER_ANISOTROPIC)
        End With

        GraphicFX.ChangeGamma(1.0!)
        Screen2D.Settings_SetTextureFilter(CONST_TV_TEXTUREFILTER.TV_FILTER_ANISOTROPIC)
        Tex.SetTextureMode(CONST_TV_TEXTUREMODE.TV_TEXTUREMODE_BETTER)
        Text2D.TextureFont_Create("font_tex1", "Arial", 10, True, False, False, False)
        Text2D.TextureFont_Create("font_tex2", "Arial", 30, True, False, False, False, True)
    End Sub
    Public Sub EndEngine()
        TV = Nothing
        End
    End Sub

End Class

There are 2 Subs:
InitTVEngine and InitTVEngineWindow. First time this 2 functions were called when I had a New sub:

Code:
    Public Sub New()
        InitTVEngine()
        InitTVEngineWindow()
    End Sub

But when I have tried to Init in fullscreen... a blank black screen was shown.
Logged

SylvainTV
Administrator
Community Member
*****
Posts: 4946


WWW
« Reply #3 on: August 16, 2009, 02:37:54 PM »

Make sure that the form is shown and focused before you call Init3DFullscreen.
Also for fullscreen mode, you should avoid initializing the engine in a picturebox or some other component than a form.
And lastly, make sure the form size is not 0x0.
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 !
Raul
Customers
Community Member
*****
Posts: 550

I like games.


WWW
« Reply #4 on: August 16, 2009, 03:18:47 PM »

before calling TV init and all things i have:

Code:
Me.Show
Me.Focus

on the Form_Load.

My form size is: 1024 x 768 (no borders or anything)

I do not init the engine in Picture. I am using form.handle...
Logged

Pages: [1]
  Print  
 
Jump to:  

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