Archived

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

Bizarre Mising Meshes

This topic is 5010 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 all, I have a weird program problem. I have developed a 3D world editor for creating levels for another program of mine. I fully checked it and wrote an installer for it etc. BUT, whenever someone else uses the program any meshes they load in are never made visible! The rest of the program works fine as the names of the mesehes appear in the boxes etc. Its just that they are not being drawn. I guess its a problem in either my DX initialisation or in the rendering. Anyhoo the code is below. I will post a link to the completed file ASAP incase someone wants to have a look at it for me. Cheers DRb2k2
      Public Function InitializeGraphics() As Boolean
            Try

                '' Now let''s setup our D3D stuff
                Dim presentParams As New PresentParameters()
                presentParams.Windowed = True
                presentParams.SwapEffect = SwapEffect.Discard
                presentParams.EnableAutoDepthStencil = True
                presentParams.AutoDepthStencilFormat = DepthFormat.D16


                Dim renderDevice As CreateFlags
                Dim caps As New Caps()
                If caps.DeviceCaps.SupportsHardwareTransformAndLight Then
                    renderDevice = renderDevice.HardwareVertexProcessing
                    MessageBox.Show("HArdware")
                Else
                    renderDevice = renderDevice.SoftwareVertexProcessing
                    MessageBox.Show("software")
                End If

                g_Camera.SetCamera(0, 12, -35, 0, 0, 0)

                device = New Device(0, DeviceType.Hardware, Me.RenderArea, renderDevice, presentParams)


                device.RenderState.ZBufferEnable = True
                '' Turn on ambient lighting 
                device.RenderState.Ambient = System.Drawing.Color.White

                AddHandler device.DeviceCreated, AddressOf Me.OnCreateDevice
                Me.OnCreateDevice(device, Nothing)
                Return True
            Catch e As DirectXException
                Return False
            End Try
        End Function ''InitializeGraphics
and then the render code
 Private Sub Render()
            If device Is Nothing Then
                Return
            End If
            ''Clear the backbuffer to a blue color 
            device.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, System.Drawing.Color.Blue, 1.0F, 0)
            ''Begin the scene
            device.BeginScene()

            SetupMatrices()
            g_MatrixStack.LoadIdentity()
            g_MatrixStack.LoadMatrix(g_View)


            Dim i As Integer
            For i = 0 To Me.g_NumberOfObjects - 1
                If Me.g_ObjectHolder(i).m_IsSeen = True Then
                    Me.g_MatrixStack.Push()
                    Me.g_ObjectHolder(i).UpdateMatrices()
                    Me.g_MatrixStack.MultiplyMatrixLocal(Me.g_ObjectHolder(i).GetFinalMatrix())
                    device.Transform.World = Me.g_MatrixStack.Top
                    Me.g_MeshHolder(Me.g_ObjectHolder(i).GetMeshIdentity()).Render(device)
                    Me.g_MatrixStack.Pop()
                End If
            Next i

            For i = 0 To Me.g_NumberOfAreas - 1
                If Me.g_AreaHolder(i).IsSeen = True Then
                    Me.g_MatrixStack.Push()
                    device.Transform.World = Me.g_MatrixStack.Top
                    Me.g_AreaHolder(i).Render(device)
                    Me.g_MatrixStack.Pop()
                End If
            Next

            ''End the scene
            device.EndScene()
            device.Present()
        End Sub ''Render

Share this post


Link to post
Share on other sites