Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

md_lasalle

Simple Direct3d8/vb6 question...

This topic is 5297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m doing some sort of level editor for my game. I have an input form(A normal vb6 Form) where i get the inputs from the user and then, the users press a command button to make a 3d preview. So it is then that i initialise my dx objects and evrything for fullscreen mode, but i want to be able to return to my previous input form after, whitout quitting the program... How could I do this? I tried to Load/Unload Forms in certains orders, I tried not to kill the dx objects at the end but the screen would not return correctly.

Share this post


Link to post
Share on other sites
Advertisement
it should work fine if your preview window is a seperate .frm; destroy the various DX objects and unload the form.

Leave the original one running in the background (as such), i.e. don''t "unload me" on the form after a "preview.show" type command.

I''ve done this for several editor like tools in VB6/D3D8. It is most definitely possible

Jack

Share this post


Link to post
Share on other sites
I''ve tried what you said but it doesnt work,it freez my computer on the last rendered screen

i''ll paste some code to see if I did a little mistake i''m not aware of

that''s how my 3d preview form is called

...
frmPreview.Show
End Sub

and this is how it''s destroyed:

...
Set D3DDevice = Nothing
Set D3D = Nothing
Set Dx = Nothing
Debug.Print "All Objects Destroyed"
Debug.Print "Highest frame rate achieved whilst running this demo was: " & FPS_Highest & " frames per second"
ShowCursor True

''//Final termination:
Unload frmPreview

End Sub -->this is the End Sub of the Private Sub Form_Load()

Could it be that i''m unloading this form while being in the formLoad Sub?

Share this post


Link to post
Share on other sites
quote:
Could it be that i''m unloading this form while being in the formLoad Sub?


possible, make sure you stick:

frmPreview.show
DoEvents


At the start of ''frmPreview'' Form_Load( ). This makes sure that VB loads up the form as needed before you start messing about with DirectX. Sometimes caught me out.

hth
Jack

Share this post


Link to post
Share on other sites
Something must be missing, i sketched something for the main()...i've just put some boolean to know what to show:

Sub Main()

Inputing = True 'Are we Inputing??? or 3d previewing
MainRunning = True 'Program Runnning or Not

Unload frmPreview 'since i will be loading it,i will unload it first to prevent vb to tell me that the form is already loaded

notLoaded = True 'No form has been loaded yet

Do While MainRunning = True

If Inputing = True And notLoaded = True Then

notLoaded = False 'the inputform will be loaded
frmInput.Show 'show the input form
DoEvents
frmInput.WindowState = vbNormal 'make sure it's at the right state

ElseIf Inputing = False And notLoaded = True Then 'we are 3dpreviewing

notLoaded = False 'we are now loaded
frmInput.WindowState = vbMinimized 'minimize the input form so we cant see visual artifacts

Load frmPreview 'load the preview,theres a loop in there with do events dont worry

Unload frmPreview 'when i get out of the loop(with all dx objects = Nothing) i need to unload it

Debug.Print "frmPreview Onloaded"

End If

DoEvents
Loop

End Sub


By the way this is not final!!! it's only to test,i have a very big object model for my game so i'm testing before integrating it with the rest



[edited by - md_lasalle on April 14, 2004 5:08:45 PM]

Share this post


Link to post
Share on other sites
if someone has a better way of switching between a normal vb form to a direct3D8 fullscreen form i''d appreciate suggestions...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!