Need to render static graphics and dynamic graphic at the same time

Teamz
04-08-2003, 12:21 PM
Here's my problem :

I need to render a 3D model and I need to render 2D buttons that I have created at the same time.

When the user click on one of the buttons, it will do something like rotate the 3D model or resize it, etc.. but the buttons also rotate and I don't want the 2D buttons to rotate. I want the buttons to be static.

I have absolutetly no idea how to do this, anyone can give me any hint plz? :confused:

Incan
04-08-2003, 01:53 PM
I need to render a 3D model and I need to render 2D buttons that I have created at the same time.

When the user click on one of the buttons, it will do something like rotate the 3D model or resize it, etc.. but the buttons also rotate and I don't want the 2D buttons to rotate. I want the buttons to be static.


I'm taking a guess that you haven't decided what to use to accomplish your task so i'd say you'll need to use directx 8 with VB6 or if you are using VB.NET then DirectX9 is the way to go.. its not easier to start with directx 7 then do 8, then 9 etc.. you'll be much better off just jumping in at the most recent version available to you :)

DirectX is one of the most complicated API's you can use with VB, learning how to use it is not a simple task. Check out http://www.directx4vb.com/, studying the tutorials there will get you started. Also search the forums here, gamedev.net, google. There are a lot of pieces of info around.. although most of the advanced stuff is in C++ but the directX calls are quite easy to pick out and translate to VB pretty easily. Most importantly, read and become familiar with the DirectX SDK documentation.

The model i would create in a 3d package and save in microsoft's .x file format (Milkshape3D is good one, 30day trial and amazingly cheap too with a large base of plugins). there are directx 'helper' functions to load .x files into your application directly. I would use the D3DXSprite class for the 2d buttons...

DirectX is not for the faint hearted or for the beginner programmer and an understanding of 3D concepts is useful.. be prepared for a long term learning project and things may not make a lot of sense until you get your head around it. But, once you do start getting comfortable with the way it all works, the possibilities are immense :D

Teamz
04-08-2003, 02:24 PM
My project is started, as I said in my previous post, when I click on my 2D button to resize or rotate my 3D model, both the model AND the buttons are resized/rotated.

I want to be able to resize/rotate ONLY the 3D model, not the buttons.

AtonalPanic
04-08-2003, 02:40 PM
Try posting some code, otherwise it will be pretty hard to tell you the problem.

Teamz
04-08-2003, 02:48 PM
Pasting some code?

it's not a bug

my buttons are 2 triangles that forms a square. I apply a texture to this square and I'm using DirectInput.

my 3D model is a mesh

this is my matrix code to rotate/resize

Private Sub SetupMatrices()
Dim matTrans As Matrix = Nothing
Dim matRot As Matrix = Nothing
Dim matFinal As Matrix = Nothing
Dim matScale As Matrix = Nothing

Dim matWorld As Matrix = Matrix.Translation(New Vector3(0.0F, 0.0F, 0.0F))

If RenderSettings.type = eDisplayType.type3D Then
Select Case RotationType
Case "Horizontale"
matRot = Matrix.RotationX((Environment.TickCount / 3000.0F))
matWorld.Multiply(matRot)
Case "Verticale"
matRot = Matrix.RotationY((Environment.TickCount / 3000.0F))
matWorld.Multiply(matRot)
Case Else
End Select

If scale.doScale Then
matWorld.Multiply(Matrix.Scaling(scale.x, scale.y, 0))
End If

DisplayDevice.Transform.World = matWorld
End If

'device.Transform.View = Matrix.LookAtLH(New Vector3(0.0F, 3.0F, -5.0F), New Vector3(0.0F, 0.0F, 0.0F), New Vector3(0.0F, 1.0F, 0.0F))
DisplayDevice.Transform.View = Matrix.LookAtLH(New Vector3(0.0F, 0.0F, 5.0F), New Vector3(0.0F, 0.0F, 0.0F), New Vector3(0.0F, 1.0F, 0.0F))
'DisplayDevice.Transform.View = Matrix.LookAtLH(New Vector3(0.0F, 0.0F, 5.0F), New Vector3(0.0F, 0.0F, 0.0F), New Vector3(0.0F, 0.0F, 0.0F))

If RenderSettings.type = eDisplayType.type2D Then
DisplayDevice.Transform.Projection = Matrix.OrthoLH(MainWindow.ClientSize.Width, MainWindow.ClientSize.Height, 0, 100)
Else
DisplayDevice.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI) / 2.0F, 1.0F, 1.0F, 500.0F)
End If
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum