[DirectX] Problem z utworzeniem okna
Ostatnio zmodyfikowano 2014-10-05 17:01
bobek784 Temat założony przez niniejszego użytkownika |
[DirectX] Problem z utworzeniem okna » 2014-10-05 17:01:20 Witam, mam problem przy debugowaniu programu. Chciałem utworzyć okienko DirectX do renderowania sceny 3d w panelu, który umieściłem w formularzu, wszystko debuguje się bez błędów, jednak samo okno nie wyświetla. Program się uruchamia, ale żadne okno się nie wyświetla na ekranie :( Ktoś podpowie, w czym tkwi problem? (c++/cli). #pragma once
namespace winforx { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace Microsoft::DirectX; using namespace Microsoft::DirectX::Direct3D; public ref class Form1 : public System::Windows::Forms::Form { public: Form1( void ) { InitializeComponent(); PresentParameters ^ presentParams = gcnew PresentParameters(); presentParams->Windowed = true; presentParams->SwapEffect = SwapEffect::Discard; device = gcnew Device( 0, DeviceType::Hardware, this->panel1, CreateFlags::SoftwareVertexProcessing, presentParams ); } protected: ~Form1() { if( components ) { delete components; } if( device ) { delete device; } } private: System::Windows::Forms::Panel ^ panel1; protected: private: System::Windows::Forms::Timer ^ timer1; private: System::ComponentModel::IContainer ^ components; private: Device ^ device; #pragma region Windows Form Designer generated code void InitializeComponent( void ) { this->components =( gcnew System::ComponentModel::Container() ); this->panel1 =( gcnew System::Windows::Forms::Panel() ); this->timer1 =( gcnew System::Windows::Forms::Timer( this->components ) ); this->SuspendLayout(); this->panel1->Location = System::Drawing::Point( 10, 10 ); this->panel1->Name = L"panel1"; this->panel1->Size = System::Drawing::Size( 500, 500 ); this->panel1->TabIndex = 0; this->timer1->Enabled = true; this->timer1->Interval = 10; this->timer1->Tick += gcnew System::EventHandler( this, & Form1::timer1_Tick ); this->AutoScaleDimensions = System::Drawing::SizeF( 6, 13 ); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size( 706, 533 ); this->Controls->Add( this->panel1 ); this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout( false ); } #pragma endregion private: System::Void timer1_Tick( System::Object ^ sender, System::EventArgs ^ e ) { device->Clear( ClearFlags::Target | ClearFlags::ZBuffer, System::Drawing::Color::Black, 1.0f, 0 ); device->BeginScene(); device->EndScene(); device->Present(); } }; }
|
|
« 1 » |