PDA

View Full Version : 4.53 vs 4.6?



Freakish
22nd December 2009, 02:09
I have been using 4.53 with DX10 to good effect.

4.6 apparently removed the "-direct3d" switch used when configuring the libraries on Windows.

I'm wondering if it's then impossible to continue to use Qt for my Windows programming?
Can anyone tell me what the "-direct3d" switch was doing internally behind the scenes, and if it's possible to now manually do this?

I now have fighting between my MainWindow (grey) and my DX10 screen (black) so it constantly flickers.

Any help on this issue would be appreciated.

Freakish
22nd December 2009, 20:52
So Qt just isn't any good for Windows programming, ARE YOU SERIOUS?

I'm sure everybody on GameDev will be happy to hear Qt and Nokia's serious neglect of Windows users.

Why does nobody know anything on this stuff, is Nokia just that useless at documentation?

wysota
23rd December 2009, 00:21
But what is wrong exactly? You don't know what this switch is for and yet you lack its presence? You don't need it for Windows programming, believe me. I don't know if it was removed in 4.6 or not, I'm not on Windows right now but even if it was, direct3d backend was always considered experimental and I doubt anyone ever used it in for production code.

Freakish
23rd December 2009, 01:12
But what is wrong exactly?

I'm fairly sure that was my question, what was the -direct3d switch doing? Can i manually prevent my paint event from being overridden? The pics above demonstrate the problem.
What don't you understand about my problem?

I can post a simple D3D9 or D3D10 code that demonstrates it but will that help, because it seems as if it's just not possible anymore.


You don't know what this switch is for and yet you lack its presence?

What switch? I have looked at the docs and cannot find anything that helps or changes the behavior. I was previously using things like:
setAttribute(Qt::WA_NoSystemBackground, true); for example, but this isn't helping in 4.6.



You don't need it for Windows programming, believe me. I don't know if it was removed in 4.6 or not, I'm not on Windows right now but even if it was, direct3d backend was always considered experimental and I doubt anyone ever used it in for production code.


Thanks for telling me what i do or don't need, but i actually do do Windows development for graphics visualization, am using Nvidia Nexus under MSVC for CUDA and DX10, and this experimental feature should of at least be explained.

Direct3D backend may of been experimental, but i don't want it anyway as it was dependent on D3D9 (something i have to learn myself), i want to be able to do what ever custom paint event i want and it seems Nokia have just forgotten about this.

I will be sure to spread the news on all gamedev forums, that Qt is not a choice for development, because from what i see it no longer is, and previously have suggested it as a good choice.

All I'd like to know is if this a deliberate design choice by Nokia to stop me from using D3D or other custom paint events on windows, or a shortsighted mistake to be rectified.

ChrisW67
23rd December 2009, 08:34
So Qt just isn't any good for Windows programming, ARE YOU SERIOUS?

You're the only person suggesting this, so why are you asking us if we are serious?

To summarise the problem: Code that used to produce a black fill in your window when using Qt 4.5.3 and the "-direct3d" flag, produces grey fill under 4.6 without the "-direct3d" flag? However, you don't know what the "-direct3d" flag did, so you have no idea whether it has any bearing at all, or whether your code was only ever working by accident under 4.5.3. I expect the "flickering" is your code filling in black, followed by an unexpected fill in gray. Overriding the painting of a QWidget is eminently possible but without a minimal example and outline of the desired effect it's going to be hard going for anyone else to solve this for you.

From the changes-4.6.0 file in the source distribution:
- The experimental Direct3D paint engine has been removed. The reason for this is that Nokia focuses on OpenGL for desktop hardware accelerated rendering. The QPaintEngine::Direct3D and Qt::WA_MSWindowsUseDirect3D still exist in the Qt 4.6 documentation, which is clearly an oversight that you should log a bug for. Nokia focus on OpenGL because it is cross-platform. Your comments, though, indicate that you don't need/use Direct3D to render anyway... this might just be one big red herring.

wysota
23rd December 2009, 08:54
I'm fairly sure that was my question, what was the -direct3d switch doing?
I'm fairly sure your question was:


So Qt just isn't any good for Windows programming, ARE YOU SERIOUS?
I wouldn't have responded otherwise.


Can i manually prevent my paint event from being overridden? The pics above demonstrate the problem.
Overriden by what? What does -direct3d has to do with it?

What don't you understand about my problem?
I don't understand your attitude. You didn't say anything about your problem (doesn't-work-like sentence is not a problem description), you asked whether -direct3d switch was removed from Qt 4.6 and if we were serious about Qt lacking support for Windows programming.


I can post a simple D3D9 or D3D10 code that demonstrates it but will that help, because it seems as if it's just not possible anymore.
Why not?



What switch?
"-direct3d"


I have looked at the docs and cannot find anything that helps or changes the behavior.
What behaviour?


I was previously using things like:
setAttribute(Qt::WA_NoSystemBackground, true); for example, but this isn't helping in 4.6.
Then don't use it like that, you have been using it incorrectly so now you are the only one to blame.



Thanks for telling me what i do or don't need, but i actually do do Windows development for graphics visualization, am using Nvidia Nexus under MSVC for CUDA and DX10,
I don't know what does it have to do with the subject.

and this experimental feature should of at least be explained.
It is explained, you just need to read the description and not assume something.


Direct3D backend may of been experimental, but i don't want it anyway as it was dependent on D3D9 (something i have to learn myself),
The functionality was disabled by default so it wasn't dependent on anything.


i want to be able to do what ever custom paint event i want and it seems Nokia have just forgotten about this.
You have to live by the rules, remember that.


I will be sure to spread the news on all gamedev forums, that Qt is not a choice for development, because from what i see it no longer is, and previously have suggested it as a good choice.
If you want to make a fool of yourself then go ahead.


All I'd like to know is if this a deliberate design choice by Nokia to stop me from using D3D or other custom paint events on windows, or a shortsighted mistake to be rectified.

It's a deliberate choice by you to expect an undocumented behaviour you are currently abusing a persistent, expected and proper one.

Freakish
24th December 2009, 00:00
I'm fairly sure your question was:

Why reply at all? Sorry but you obviously have no idea what my issues are, you seem to not even be using Windows, you can't tell from my posts how to help so why exactly must you reply with useless points and unrelated ego issues?

Do you use Direct3D and Qt? Are you aware of what the experimental support provided me, and how 4.6 has changed that..... NO? than why do you reply with answers that are just plainly arrogant? Do you use any other custom paintevents in 4.6?

Are you aware that my code fights due to Qt's double buffering causing flickering, can you ascertain from my screen shots that something is a miss?

Obviously my code from 4.53 does not work in 4.6, I'm trying to sustain if it's pointless to use Qt anymore? Is that to hard to ask on a forum, i would like to know if investing another year on Qt is worthwhile when it appear they just cut my legs off.

Are you qualified to answer, do you know what the "-direct3d" switch was doing to the libraries? I have spent months using Qt and learn C++ and write application, which no longer work, and i cannot even get an explanation as to why. Am i meant to find this wonderful of Nokia?

Below is a basic DX9 code that works fine in Qt4.53 and will not work on any version later.

If anyone who DOES know something about the issue could shed some light on it, it would be much appreciated, as i now have to look for alternative GUI frameworks, and i chose Qt because i thought it was excellent, and now not.


//"main.cpp"


#include "mainwindow.h"
#include "iD3D9.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
iD3D9 widget;
window.setCentralWidget(&widget);
widget.InitD3D();
window.show();
return a.exec();


//"iD3D9.h"

#include <QWidget>
class iD3D9 : public QWidget
{
Q_OBJECT

public:
iD3D9(QWidget *parent = 0, Qt::WFlags flags = 0);
~iD3D9();

void InitD3D();
bool PaintD3D();

private:
void paintEvent(QPaintEvent *paintE);

};



//"iD3D9.cpp"

"#include "iD3D9.h"
#include <d3d9.h>
//Globals//
LPDIRECT3D9 g_pD3D = NULL; // Used to create the D3DDevice
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; // Our rendering device

iD3D9::iD3D9(QWidget *parent, Qt::WFlags flags) //
: QWidget(parent, flags)
{
setFixedSize(200, 200);

setAttribute(Qt::WA_MSWindowsUseDirect3D, true);
setAttribute(Qt::WA_NoSystemBackground, true);
}

iD3D9::~iD3D9() //
{

}

void iD3D9::InitD3D()
{
g_pD3D = Direct3DCreate9( D3D_SDK_VERSION); //Standard
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, winId(), // DXREF Hardware Vertex GPU
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice );
};

void iD3D9::paintEvent(QPaintEvent *paintE) // We made our own paintEvent
{
PaintD3D();
}

bool iD3D9::PaintD3D()
{
if(g_pd3dDevice == 0)
return false;
g_pd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
if(SUCCEEDED(g_pd3dDevice->BeginScene()))
{
g_pd3dDevice->EndScene();
}
g_pd3dDevice->Present( 0, 0, 0, 0 );
return true;
}

ComaWhite
24th December 2009, 12:19
Well apparently I found your post on gamedev.

You do know that the Direct3D flag was using Direct3D to render all the widgets on to the application. Not to help allow Direct3D be used in place of OpenGL for game development or whatever. Just create the normal Direct3D calls and setups as you would use for the ugly win32.

So stop complaining and moaning that Nokia shun window developers for this or that because of a useless flag that didn't do anything other than rendering widgets and windows behind the scenes. It doesn't prevent you from using Direct3D in 4.6 if they completely removed all traces of that flag.

http://www.gamedev.net/community/forums/topic.asp?topic_id=557135 Is the topic he posted.

Have you bother disabling the paintEngine and returning 0? Have you bothered to handle LostDevices? Have you bothered using a QTimer to update the rendering?

So instead of complaining about Nokia this and that. how about you fix your broken code and then it will work.

Freakish
26th December 2009, 05:30
It doesn't prevent you from using Direct3D in 4.6 if they completely removed all traces of that flag.

Yes it does as already stated several times your reading abilities amaze me.


Have you bother disabling the paintEngine and returning 0? Have you bothered to handle LostDevices? Have you bothered using a QTimer to update the rendering?

Can you not even read the source code on the post above, you so obviously had the lack of talent to comment on before posting?

Obviously that's a yes to all three of the above suggestions, by an obvious user who has no Windows Qt experience, and obviously even less DX experience, then tell's users arrogantly to stop complaining on a forum designed exactly for that.

Anytime you want to back up your claims of the code working after 4.53, you can try and prove it, but like everyone else you will fail and look just as stupid as you do already.


So instead of complaining about Nokia this and that. how about you fix your broken code and then it will work.

My code works fine, and compiles in the above example just as i said it does, so it seems like you cannot understand my code, posts, problems or issues that D3D users are facing, perhaps try and read and help before posting arrogant observations that make me look less like a Noob than yourself.

And now you look stupid for commenting, FWIW, Nokia have replied and confirmed it simply will not work in 4.6, they will look at maybe reestablishing support in a future version.

So it now appears you and others have a large load of egg on your face. (Again?)

Please read before mouthing off with those female bitchy undertones again.... Mum.

PLEASE SHOW how my code is broken? What's that you can't? So surprised.

ComaWhite
26th December 2009, 19:46
Can you not even read the source code on the post above, you so obviously had the lack of talent to comment on before posting?


I did



Obviously that's a yes to all three of the above suggestions, by an obvious user who has no Windows Qt experience, and obviously even less DX experience, then tell's users arrogantly to stop complaining on a forum designed exactly for that.


Um let's see I have the Windows words under my username along side Linux and Mac? Okay now shut up kthx.



Anytime you want to back up your claims of the code working after 4.53, you can try and prove it, but like everyone else you will fail and look just as stupid as you do already.


Why don't you fix your poorly written code? You're the one bitching and moans about Nokia this and that for removing a stupid useless flag that has nothing that stops you from using Direct3D in Qt.




My code works fine, and compiles in the above example just as i said it does, so it seems like you cannot understand my code, posts, problems or issues that D3D users are facing, perhaps try and read and help before posting arrogant observations that make me look less like a Noob than yourself.


Well don't you think it's going to compile correctly? No all your post is basically bitching about Nokia over this and that when you're program is freaking buggy and broken (not doing what you want). II used to be a DirectX developer then gave up.



And now you look stupid for commenting, FWIW, Nokia have replied and confirmed it simply will not work in 4.6, they will look at maybe reestablishing support in a future version.


Like I already said fix your broken buggy code. paintEvent != paintEngine. I don't see no QTimer object being used. Haven't you even tried googling? You do realise that the paintEvent won't fire constantly without you moving the window, resize, show, hide, etc. You need to update the scene constantly and it will work like you want.



So it now appears you and others have a large load of egg on your face. (Again?)

Please read before mouthing off with those female bitchy undertones again.... Mum.

PLEASE SHOW how my code is broken? What's that you can't? So surprised.


Read my last blog instead of cherry picking at it. And read the last response in this post.

wysota
27th December 2009, 09:15
Sorry but you obviously have no idea what my issues are,
True, I don't. Probably because you didn't express them well enough.


you seem to not even be using Windows,
Oh, that's wrong. Look into my profile at the right side of every post of mine.


you can't tell from my posts how to help so why exactly must you reply with useless points and unrelated ego issues?
Because you are throwing false accusations so I'm stepping in to intervene.


Do you use Direct3D and Qt?
I don't but I know how Qt works internally. And there is nothing stopping you from using Qt 4.6 without the -direct3d switch. It seems people on gamedev think so as well.


Are you aware of what the experimental support provided me, and how 4.6 has changed that..... NO?
You didn't give any code so how could I? It's not my fault you can't ask a question in a clear and understandable manner.


than why do you reply with answers that are just plainly arrogant?
Look who's talking :)


Are you aware that my code fights due to Qt's double buffering causing flickering, can you ascertain from my screen shots that something is a miss?
Abusing a system with incorrect assumptions and wrong code doesn't make the system faulty.


I'm trying to sustain if it's pointless to use Qt anymore?
Pointless is a strong word. You're assuming Qt is good only for Direct3D and I can't agree with that.


Are you qualified to answer, do you know what the "-direct3d" switch was doing to the libraries?
Sure I do :) It provided an incomplete and experimental backend for a paint engine using Direct3D calls just like there are two mature engines in Qt that use OpenGL calls (one is using 1.x and the other is using 2.x).


Below is a basic DX9 code that works fine in Qt4.53 and will not work on any version later.
Of course it won't. But you can render to a buffer (DirectX can do that right?) and then render it on a widget. No need for the -direct3d switch. And using the attribute for not painting the background in an incorrect way is not required. Another possibility is to embed a directx control directly into your application just as you can embed any WinAPI control. No need for buffers then.


If anyone who DOES know something about the issue could shed some light on it, it would be much appreciated, as i now have to look for alternative GUI frameworks, and i chose Qt because i thought it was excellent, and now not.
Then learn Qt instead of spitting on it.


Yes it does as already stated several times your reading abilities amaze me.
No, it doesn't. It just prevents you from making Direct3D calls directly from a paint event.


Can you not even read the source code on the post above, you so obviously had the lack of talent to comment on before posting?
I suggest you stop being rude or we will end this conversation in somewhat quick and radical manner.


Obviously that's a yes to all three of the above suggestions, by an obvious user who has no Windows Qt experience,
Hmm hmm... where is that in your code? I can't see it really. Could you point it to me please?


then tell's users arrogantly to stop complaining on a forum designed exactly for that.
This forum was not designed for complaining. It was designed for helping, being helped, learning and teaching. It seems you don't want any of those - you are convinced that you are right and won't stop and start thinking whether there is even a remote chance that you are wrong.


Anytime you want to back up your claims of the code working after 4.53, you can try and prove it, but like everyone else you will fail and look just as stupid as you do already.
Please convert your code so that it draws to a pixel buffer then convert it to a pixmap and render inside paint event. All your problems will be solved at once. Or do the thing properly and don't use QWidget as the base class for your widget.


My code works fine, and compiles in the above example just as i said it does,
Which doesn't make it correct. This compiles and works too but it is incorrect:

QString x="xyz";
const char *str = x.toAscii().constData();
printf("%s\n", str);


so it seems like you cannot understand my code, posts, problems or issues that D3D users are facing,
What D3D users? So far you are the only one to complain. Please don't speak in the name of others unless you have something to back up your voice.


And now you look stupid for commenting, FWIW, Nokia have replied and confirmed it simply will not work in 4.6, they will look at maybe reestablishing support in a future version.
Not in its current form, that has been clear from the start and nobody denies that :) We only say your code is incorrect but can be corrected to work.


PLEASE SHOW how my code is broken? What's that you can't? So surprised.

It is broken. Qt makes its windows double buffered with the use of so called backingstore (that's actually just a painting surface in case of Qt). Whenever paintEvent() is invoked, the code placed there is supposed to draw on a surface of the backingstore. If it doesn't then the backingstore is filled with garbage or the background colour (depending on whether it is initialized or not). So your code will likely lead to flickering. Isn't it what you observe (I think it's something you have written in one of your posts above)? I already told you two ways of preventing that. And none of them require the -direct3d flag, which again backs up what I have been writing from the beginning.

To sum things up - "-direct3d" doesn't enable you to use Direct3D in your application and lack of this switch doesn't prevent you from using Direct3D in your app. It just makes Direct3D the default (well... almost) paint engine for Qt widgets. With incomplete functionality right now, to add to that.

Freakish
28th December 2009, 03:52
If not one of you are able to compile any working example of Direct3D under 4.6, (even though i gave simplified source to a working 4.53 version) and not have the issues described, why are you even trying to argue?

Thanks but as i mentioned, Trolltech did get back to me to confirm it will not work, the support has been removed.

All of the talk of Qtimers etc, are all things i went through with 4.53, So i don't need to do any of those suggestions, Yes i have read every post in existance to Qt and Direct3D, in fact i wrote in most of them. As for using a QWidget etc, i gave the most simplest example i could give, I don't even use DX9, i use DX11, i simplified to make it easier for others to check, obviously my code is hell more complicated than the example. Sheesh!

Thread can be closed, because nobody wants to use Qt under Windows anymore, especially not with arrogant rude Nokians in the beginners section anyway.

ChrisW67
28th December 2009, 08:43
Like Wysota I do Windows deployments and find Qt quite adequate: these do not involve Direct X because it is not portable. That does not automatically put me in a position to take time out my paying work (not for Nokia) to:
establish a Windows development environment on Vista or Win 7 (for DX10 or DX11 testing),
grab the 500+ MB Direct X SDK and whatever else is required to build your code fragment, and
build and debug as appropriate,
to scratch an itch that I don't personally have. I certainly do not have an in-depth understanding of Qt painting internals.

However, in an attempt to drag this thread back from a series of ad hominem attacks to a technical discussion all I can offer on the basis of your code and "it flickers" problem description is:

setAttribute(Qt::WA_MSWindowsUseDirect3D, true);
setAttribute(Qt::WA_NoSystemBackground, true);

Line 1 uses a documented obsolete flag (as a result of the D3D painter being removed) that, although it shouldn't be doing anything, may by accident still have some effect. Line 2, Qt::WA_NoSystemBackground at least sounds like Qt will never draw the background on windows set this way. Have you tried combining/replacing with Qt::WA_OpaquePaintEvent?

Further, there may be some inspiration in the Ogre 3D engine and attempts to wrap it in a Qt widget.

wysota
28th December 2009, 11:31
If not one of you are able to compile any working example of Direct3D under 4.6, (even though i gave simplified source to a working 4.53 version) and not have the issues described, why are you even trying to argue?
Because your statements are false and we're able to tell you the reasons.


Thanks but as i mentioned, Trolltech did get back to me to confirm it will not work, the support has been removed.
Read my last post again until you understand what is said there.


I don't even use DX9, i use DX11, i simplified to make it easier for others to check, obviously my code is hell more complicated than the example. Sheesh!
The code will not work out of the box and that's clear (and we don't have to run it to see it). Nobody is arguing about this. What we say is that you have been using some feature that has never been stable and your usecase was not exactly proper one (the backend was not created to mix Direct3D and QPainter instructions, it was created to provide hardware acceleration for rendering widgets) and we say that now you can make your code work with Qt by using a different (probably more correct) approach.


Thread can be closed, because nobody wants to use Qt under Windows anymore,
If you don't want to use Qt then don't use it. But don't speak in the name of others. Repeating the same false sentence over and over won't make it any less false than it was the first time.


especially not with arrogant rude Nokians in the beginners section anyway.
We may be arrogant, we may be rude but we're not Nokians :) Beginners section or not. We're trying to help you but you obviously don't want help, you just want to say you can't use Qt with Windows. I'm starting to think if it's not a kind of spamming action to make that sentence appear in search engines more frequently.