All Projects → giladreich → Qtdirect3d

giladreich / Qtdirect3d

Licence: mit
QDirect3DWidget implementation similar to the built-in QOpenGLWidget

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Qtdirect3d

Directxtex
DirectXTex texture processing library
Stars: ✭ 1,039 (+1631.67%)
Mutual labels:  directx, direct3d, directx-12
Luna-Engine
Luna Engine is DirectX 11 based engine that i am trying to make.
Stars: ✭ 35 (-41.67%)
Mutual labels:  directx, imgui
DoGUI
Hello DoGUI: (not yet completed) Bloat-free Graphical User interface for C++ with minimal dependencies and a sleek default design
Stars: ✭ 19 (-68.33%)
Mutual labels:  directx, imgui
Diligentcore
Core functionality of Diligent Engine
Stars: ✭ 263 (+338.33%)
Mutual labels:  direct3d, directx-12
stereo
Perform stereo matching algorithm using Direct 3D (level 9.3) on a mobile device without CUDA support.
Stars: ✭ 13 (-78.33%)
Mutual labels:  directx, direct3d
DXSample
Sample Program for DirectX 12 + Swift
Stars: ✭ 57 (-5%)
Mutual labels:  directx, directx-12
Fx Gltf
A C++14/C++17 header-only library for simple, efficient, and robust serialization/deserialization of glTF 2.0
Stars: ✭ 257 (+328.33%)
Mutual labels:  directx, directx-12
D3d12memoryallocator
Easy to integrate memory allocation library for Direct3D 12
Stars: ✭ 234 (+290%)
Mutual labels:  directx, directx-12
Zep
Zep - An embeddable editor, with optional support for using vim keystrokes.
Stars: ✭ 477 (+695%)
Mutual labels:  direct3d, imgui
Renderdoc
RenderDoc is a stand-alone graphics debugging tool.
Stars: ✭ 5,969 (+9848.33%)
Mutual labels:  directx, direct3d
CrossWindow-Demos
🥪 Examples of how to use CrossWindow for things like rendering graphics, listening to events, etc.
Stars: ✭ 48 (-20%)
Mutual labels:  directx, directx-12
Directxtk12
The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
Stars: ✭ 765 (+1175%)
Mutual labels:  directx, directx-12
Dxbc2Dxil
DEPRECATED. DXBC to DXIL (HLSL Bytecode to LLVM IR) using internal APIs.
Stars: ✭ 21 (-65%)
Mutual labels:  directx, direct3d
bgfx-python
Python 3.7+ wrapper for the BGFX library. 🐍
Stars: ✭ 99 (+65%)
Mutual labels:  directx, imgui
ConvectionKernels
Fast, high-quality texture compression library for many formats
Stars: ✭ 40 (-33.33%)
Mutual labels:  directx, directx-12
MoravaEngine
2D/3D graphics engine written in C++ language. It currently supports the following graphics APIs: OpenGL 3.3+, Vulkan 1.2, DirectX 11. Its current purpose is to experiment with various CG concepts and techniques.
Stars: ✭ 129 (+115%)
Mutual labels:  directx, imgui
Goesp
Cross-platform streamproof ESP hack for Counter-Strike: Global Offensive, written in modern C++. Rendering and GUI powered by Dear ImGui.
Stars: ✭ 210 (+250%)
Mutual labels:  directx, imgui
Mage
🧙 MAGE
Stars: ✭ 220 (+266.67%)
Mutual labels:  directx, direct3d
Directxmesh
DirectXMesh geometry processing library
Stars: ✭ 447 (+645%)
Mutual labels:  directx, directx-12
Winapi
A simple, direct, ultra-thin CLR library for high-performance Win32 Native Interop
Stars: ✭ 636 (+960%)
Mutual labels:  directx, winapi


Qt Direct3D / DirectX Widgets

This project contains Direct3D widgets that can be used within the Qt Framework for DirectX 9, 10, 11 and 12.

There are also Direct3D widgets included that support Dear ImGui.

Contents

Getting Started

Clone the repository:

git clone --recursive https://github.com/giladreich/QtDirect3D.git

The main directories are source and examples:

Directory Description
source Qt custom widgets that you can copy to your projects depending on the Direct3D version you use. Note that under each Direct3D version, there is also the same widget with ImGui integration.
examples Showing how to integrate and interact with the widget.

Building Examples

Using the Widget

In your Qt Widgets Application project, do the following steps:

  • Copy the widget into your project and add it as an existing item.
  • Open MainWindow.ui with QtDesigner and promote the centeralWidget to the widget you copied.
  • Rename centeralWidget to view.
  • Compile to let Qt's uic & moc compiler to do their magic and have proper IntelliSense.

At this point you should have a basic setup to get started and interact with the widget.

Open MainWindow.h file and create the following Qt slots:

public slots:
    void init(bool success);
    void tick();
    void render();
    void renderUI();
Slot Remarks
bool init(bool success) Additional initialization step. success will be true if the widget successfully initialized.
void tick() Update the scene, e.g. change vertices positions.
void render() Present the scene.
void renderUI() Present and manage ImGui windows.

Open MainWindow.cpp and connect the Widget's signals to the previously created slots:

connect(ui->view, &QDirect3DXXWidget::deviceInitialized, this, &MainWindow::init);
connect(ui->view, &QDirect3DXXWidget::ticked, this, &MainWindow::tick);
connect(ui->view, &QDirect3DXXWidget::rendered, this, &MainWindow::render);
connect(ui->view, &QDirect3DXXWidget::renderedUI, this, &MainWindow::renderUI);

As a final step, add the following code to the end of the MainWindow::init function:

QTimer::singleShot(500, this, [&] { ui->view->run(); });

A short delay of 500 milliseconds before the frames are executed ensures that all Qt's internal signals and slots have finished processing.

Handling Close Event

It is necessary to override the closeEvent in order to properly release any used resources:

void MainWindow::closeEvent(QCloseEvent * event)
{
	event->ignore();

	ui->view->release();
	m_bWindowClosing = true;
	QTime dieTime = QTime::currentTime().addMSecs(500);
	while (QTime::currentTime() < dieTime)
		QCoreApplication::processEvents(QEventLoop::AllEvents, 100);

	event->accept();
}

Calling the function event->ignore() at the beginning will postpone the closeEvent allowing for calling the widget's function release. Lastly, giving the application a short delay of 500 milliseconds before accepting the closeEvent.

Preview

Using the widget with imgui and creating a basic scene:

Basic Scene

Game Engine editor using the widget (YouTube playlist):

FX Editor Flag Editor

Motivation

I've been working with both MFC GUI applications as well as Qt in various projects.

Whilst rewriting some of the MFC applications to use Qt, I noticed that Qt only provides QOpenGLWidget, but no QDirect3DWidget. I therefore began to research different ways to accomplish this.

I realized Qt's internal rendering engine needed to be disabled in order to render into the widget's surface without the internal engine's interference. Once this was achieved, it was thrilling to use the power of Qt, whilst also using Direct3D as the graphics API.

Contributing

Pull-Requests are greatly appreciated should you like to contribute to the project.

Same goes for opening issues; if you have any suggestions, feedback or you found any bugs, please do not hesitate to open an issue.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the license for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].