Logo by mauxuam - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. September 21, 2019, 10:21:40 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 [2] 3 4 ... 6   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: next will be Mandelbulber 2.0 with Qt interface  (Read 9087 times)
0 Members and 1 Guest are viewing this topic.
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #15 on: March 16, 2014, 06:19:14 PM »

I tried Qt Creator (second option - I wrote by mistake "Qt Designer"). It is really good IDE but not as good as Eclipse. I tried to setup SVN in Qt Creator but without success.
Logged

Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #16 on: March 16, 2014, 09:12:04 PM »

I gave it a try with Qt 4.8.5 using MSVC++ Compiler version 18.

I did a "qmake -project test.pro", and then manually added the line "CONFIG += uitools" to the test.pro and loaded it into Qt Creator.

There were 133 errors, but most of them were variations of the following:

f:\mandelbulber2\mandelbulber2\src\files.h(17) : fatal error C1083: Cannot open include file: 'png.h': No such file or directory
..\mandelbulber2\src\fractparams.cpp(115) : error C2143: syntax error : missing ')' before '{'
f:\mandelbulber2\mandelbulber2\src\main.hpp(13) : error C2871: 'std' : a namespace with this name does not exist
..\mandelbulber2\src\primitives.cpp(92) : error C2065: 'M_PI' : undeclared identifier
..\mandelbulber2\src\system.cpp(10) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
..\mandelbulber2\src\parameters.cpp(174) : error C3861: 'snprintf': identifier not found
..\mandelbulber2\src\parameters.cpp(273) : error C2143: syntax error : missing ';' before '{'
f:\mandelbulber2\mandelbulber2\src\cimage.hpp(110) : warning C4305: 'return' : truncation from 'double' to 'float'
f:\mandelbulber2\mandelbulber2\src\interface.hpp(39) : error C2332: 'struct' : missing tag name

In particular, watch out for the compound literals (e.g.(sRGB){45761, 53633, 59498}). This is non-standard C++ and not supported by VC++.
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #17 on: March 16, 2014, 09:52:24 PM »

About those many errors, did you set include path properly in your compiler? It shows that there is missing png.h, unistd.h, etc... It can't even find symbol std (should be included from <iostream>).

In particular, watch out for the compound literals (e.g.(sRGB){45761, 53633, 59498}). This is non-standard C++ and not supported by VC++.

How it should be instead to be compatible with VC++? Every GNU compiler have no problem with this.
Logged

Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #18 on: March 16, 2014, 10:44:16 PM »

Quote
About those many errors, did you set include path properly in your compiler? It shows that there is missing png.h, unistd.h, etc... It can't even find symbol std (should be included from <iostream>).

In main.hpp there is a 'using namespace std;' before anything is included. Thus the symbol is undefined, and the compiler should complain.

"Unistd.h" is a Unix (Posix) thing (http://en.wikipedia.org/wiki/Unistd.h), and not found on the Windows platform. It is available on MingGW, but should be avoided for cross-platform code. The same goes for "Dirent.h". I'm sure there are good Qt equivalents for these.

I have different png.h's on my system - are you using the one from the Qt thirdparty lib?

Quote
How it should be instead to be compatible with VC++? Every GNU compiler have no problem with this.

Well, it is a GNU extension: http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Compound-Literals.html

One portable way would be to define a constructor for the sRGB struct, and pass the parameter as sRGB(r,g,b).
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #19 on: March 17, 2014, 05:30:33 PM »

Thanks for the explanation. However....

In main.hpp there is a 'using namespace std;' before anything is included. Thus the symbol is undefined, and the compiler should complain.

'using namespace std;' is after #include <iostream>, so I don't know why your compiler shows that std is undefined

About "unistd.h" and "dirent.h" I just forgot that they are Linux specific. I will use something from Qt lib instead.

About png.h I use original one (http://www.libpng.org/pub/png/libpng.html) which is included in Debian as standard dev package. I haven't tried from Qt lib. I don't know what is possible with Qt version of it. For me is very important to have possibility to save PNG line by line (separately, not as a one stream). I use this in tile rendering mode, where is not possible to store whole image in memory.

About sRGB I will add constructor with initialization list. This will solve the problem permanently. I will do the same for other structs.

Logged

Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #20 on: March 17, 2014, 06:57:30 PM »

I have done all changes which Syntopia mentioned as necessary to be compatible with VC++ and to be more platform independent. Please check if some more changes are needed. Actual source is in SVN
Logged

Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #21 on: March 17, 2014, 09:35:12 PM »

Thanks for the explanation. However....

'using namespace std;' is after #include <iostream>, so I don't know why your compiler shows that std is undefined

There are no includes in main.hpp. Are you sure you are not looking at main.cpp?

I have done all changes which Syntopia mentioned as necessary to be compatible with VC++ and to be more platform independent. Please check if some more changes are needed. Actual source is in SVN

I have added libpng and libjpeg from the Qt thirdparty folder to my path, which might work. However, it would be better to include thirdparty libs with the source to ensure the same version are used.

We are down to ~60 errors or so.

Still a few API calls, which are linux specific:
..\mandelbulber2\src\qt_interface.cpp(136) : error C3861: 'exp10': identifier not found
..\mandelbulber2\src\common_math.cpp(164) : error C2065: 'M_PI' : undeclared identifier
..\mandelbulber2\src\parameters.cpp(174) : error C3861: 'snprintf': identifier not found
..\mandelbulber2\src\system.cpp(94) : error C3861: 'clock': identifier not found

Also one compound literal:
..\mandelbulber2\src\parameters.cpp(273) : error C2059: syntax error : '{'

This one is actually a case of MSVC++ not following strict standard:
..\mandelbulber2\src\interface.cpp(145) : error C2146: syntax error : missing ')' before identifier 'or'
while 'or' according to the standard is a keyword alias for '||', VC++ doesn't allow this (unless running in strict mode). But an easy fix is just to use '||'.

And finally these two - which I couldn't easily tell what was wrong with:

f:\mandelbulber2\mandelbulber2\src\interface.hpp(39) : error C2332: 'struct' : missing tag name
..\mandelbulber2\src\main.cpp(34) : error C2332: 'struct' : missing tag name

..\mandelbulber2\src\system.cpp(31) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const QString' (or there is no acceptable conversion)
 
 
Logged
_revers_
Conqueror
*******
Posts: 138



« Reply #22 on: March 17, 2014, 10:43:04 PM »

It seems I'm not the only one using Eclipse for Qt development smiley It is not a perfect solution but I also prefer it over Qt Creator.
To make Eclipse Qt development a little bit easier I wrote a plug-in that you might want to take a look at: New Qt Form Wizard.

It generates templates (*.h, *.cpp and *.ui files) for Qt widgets. For example for QWidget:
header:
Code:
#ifndef _NEWFORM_H
#define _NEWFORM_H

#include "ui_NewForm.h"

class NewForm : public QWidget {
    Q_OBJECT
   
private:
    Ui::NewForm widget;   
   
public:
    NewForm();
    virtual ~NewForm();
};

#endif /* _NEWFORM_H */

source:
Code:
#include "NewForm.h"

NewForm::NewForm() {
    widget.setupUi(this);
}

NewForm::~NewForm() {
}

ui file:
Code:
<ui version="4.0">
 <class>NewForm</class>
 <widget class="QWidget" name="NewForm">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>NewForm</string>
  </property>
 </widget>
 <resources/>
 <connections/>
</ui>
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #23 on: March 17, 2014, 11:31:50 PM »

And finally these two - which I couldn't easily tell what was wrong with:

f:\mandelbulber2\mandelbulber2\src\interface.hpp(39) : error C2332: 'struct' : missing tag name
..\mandelbulber2\src\main.cpp(34) : error C2332: 'struct' : missing tag name

Turns out 'interface' is redefined by a macro in a Windows header - so this variable must be renamed.

Quote
..\mandelbulber2\src\system.cpp(31) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const QString' (or there is no acceptable conversion)

Should probably be something like '... = (QDir::currentPath() + QDir::separator()).toStdString();' - but I'd recommend to switch away from std::string and use QString exclusively.

Finally it seems you have added a moc file manually for 'qt_interface' and added it to SVN? This will not work as Qt creator creates moc-files in a temporary dir. The moc file ends up being included twice.
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #24 on: March 18, 2014, 07:08:55 PM »

1. Do you have "main.cpp" like here https://code.google.com/p/mandelbulber2/source/browse/trunk/mandelbulber2/src/main.cpp  ??

2. instead exp10 I will use pow(10.0, p)

3. M_PI problem has following solution:

Code:
#define _USE_MATH_DEFINES
#include <cmath>

4. snprintf is from stdio.h http://www.cplusplus.com/reference/cstdio/snprintf/ . It is not Linux specific. VC++ doesn't have functions which were implemented in C99. It is also part of C++11, so will be available also in VC++.
What I should use instead of it to keep compatibility? Is there any equivalent in VC++? I can use sprintf(), but it will be not as safe as snprintf()

5. clock() is from <ctime> (http://www.cplusplus.com/reference/ctime/clock/) If this is not present in VC++, what I should use instead?

6. 'interface' I have renamed to 'mainInterface'

7. will be like you wrote '... = (QDir::currentPath() + QDir::separator()).toStdString();'
I will still use std::string and other std::... containers because they are better described (even I have more books) and I also don't like Qt-style iterators (foreach) which use a lot of macros. Some macros make troubles when there is some mistake in the code. Then compiler shows error inside the Qt header file but not in my source code. It is sometimes difficult to solve problems in the code. In future I will use C++11 'foreach'-like construction (http://www.cplusplus.com/forum/general/106765/)

8. .moc file is necesary when I use QUiLoader. This is only way how slots can be defined and connected automatically with ui. This file was generated with moc. You should not use qmake for this application. Try to handle this as a standard c++ application in VC++ (don't use Qt Creator). Call moc to generate fresh .moc file and then launch c++ build.

Fresh changes are already committed to SVN repository.
Logged

Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #25 on: March 18, 2014, 09:20:17 PM »

Quote

Sure. But the error is still in 'main.hpp' (line 13): https://code.google.com/p/mandelbulber2/source/browse/trunk/mandelbulber2/src/main.hpp

Quote
3. M_PI problem has following solution:

Code:
#define _USE_MATH_DEFINES
#include <cmath>

works!

Quote
4. snprintf is from stdio.h http://www.cplusplus.com/reference/cstdio/snprintf/ . It is not Linux specific. VC++ doesn't have functions which were implemented in C99. It is also part of C++11, so will be available also in VC++.
What I should use instead of it to keep compatibility? Is there any equivalent in VC++? I can use sprintf(), but it will be not as safe as snprintf()

Qt has very nice string functions, e.g.:
QString str = QString("delta: %1").arg(d, 0, 'E', 3);
 // str == "delta: 1.234E+01"

Quote
5. clock() is from <ctime> (http://www.cplusplus.com/reference/ctime/clock/) If this is not present in VC++, what I should use instead?

clock() is available - the problem was that 'ctime' was not included. It works if I add a "#include <ctime>" at the top of system.cpp.

Quote
7. will be like you wrote '... = (QDir::currentPath() + QDir::separator()).toStdString();'
I will still use std::string and other std::... containers because they are better described (even I have more books) and I also don't like Qt-style iterators (foreach) which use a lot of macros. Some macros make troubles when there is some mistake in the code. Then compiler shows error inside the Qt header file but not in my source code. It is sometimes difficult to solve problems in the code. In future I will use C++11 'foreach'-like construction (http://www.cplusplus.com/forum/general/106765/)

Well, you decide. But I should mention that Qt containers supports both STL-iterators, Java-style iterations and foreach constructions, so you are free to choose. And wrt macros, I think you already sold your soul, once you started using the signal and slots in Qt :-)

Quote
8. .moc file is necesary when I use QUiLoader. This is only way how slots can be defined and connected automatically with ui. This file was generated with moc. You should not use qmake for this application. Try to handle this as a standard c++ application in VC++ (don't use Qt Creator). Call moc to generate fresh .moc file and then launch c++ build.

Fresh changes are already committed to SVN repository.

This sound somewhat strange to me. I think you should aim for being able to build your application with qmake, and I don't think it will require much effort. It seems to work for me, if I simply delete the line: '#include "qt_interface.moc.hpp"'

Now, the next problem is the dependence on 'libjpeg' and 'libpng'. Including the headers made the system compile, but linking fails, because the sourcefiles for the libraries needs to be compiled and linked in. I managed to add libpng (and zlib which it depends on) to the project, but I couldn't compile libjpeg easily. I would suggest to include the libpng library with the Mandelbulber source, but change to Qt builtin JPEG saving (which should be good enough unless you also need to stream tiles to JPEG).

Finally, there are some hardcoded paths, which should be adjusted:
QFile file("/home/krzysztof/workspace/mandelbulber3/qt/render_window.ui");
   
Update: attached a Windows screenshot!


* mb.png (115.26 KB, 1107x679 - viewed 340 times.)
« Last Edit: March 18, 2014, 09:29:01 PM by Syntopia » Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #26 on: March 18, 2014, 09:47:33 PM »

Quote

OK. My fault. I looked into wrong file smiley I will correct it

Quote
Qt has very nice string functions, e.g.:
QString str = QString("delta: %1").arg(d, 0, 'E', 3);
 // str == "delta: 1.234E+01"

I have to learn more about QString class. I see that it's much more flexible thar std::string

Quote
clock() is available - the problem was that 'ctime' was not included. It works if I add a "#include <ctime>" at the top of system.cpp.

Will be added

Quote
Well, you decide. But I should mention that Qt containers supports both STL-iterators, Java-style iterations and foreach constructions, so you are free to choose. And wrt macros, I think you already sold your soul, once you started using the signal and slots in Qt :-)

Again, I have to learn more about Qt. I didn't know that I can use stl iterators. That's why I used foreach. Maybe I will switch completely to Qt containers (my soul is chip <- evil).

Quote
Now, the next problem is the dependence on 'libjpeg' and 'libpng'. Including the headers made the system compile, but linking fails, because the sourcefiles for the libraries needs to be compiled and linked in. I managed to add libpng (and zlib which it depends on) to the project, but I couldn't compile libjpeg easily. I would suggest to include the libpng library with the Mandelbulber source, but change to Qt builtin JPEG saving (which should be good enough unless you also need to stream tiles to JPEG).
I will try to use JPEG from Qt. About libpng I shouldn't attach any binaries (libraries) to the source. They are system specific. Only way to attach it would be to include full source for libpng, but it will make more troubles. I'm Linux user, so I always have all needed libraries in the system. I have no idea how it looks like in MS VC++.

Quote
Finally, there are some hardcoded paths, which should be adjusted:
QFile file("/home/krzysztof/workspace/mandelbulber3/qt/render_window.ui");

I have just put this like now for testing. I will change it tomorrow.

By the way, do you want to have commit access to SVN repository?
Logged

flexiverse
Safarist
******
Posts: 99



« Reply #27 on: March 18, 2014, 10:21:48 PM »

I think you should use u++

Its clearly far superior to qt and all others.

Plus, less code, cross platform.

Check it out http://www.ultimatepp.org/index.html
Logged
quaz0r
Fractal Molossus
**
Posts: 652



« Reply #28 on: March 19, 2014, 02:28:00 AM »

personally im always annoyed at projects that include the full source of common libraries into their own source   police
Logged
quaz0r
Fractal Molossus
**
Posts: 652



« Reply #29 on: March 19, 2014, 06:42:27 AM »

I was curious if I would be the only one who would be interested in multiprecision functionality being added to mandelbulber?  I was looking around and found this mpreal C++ header that someone created to encapsulate MPFR which makes it very easy to add multiprecision to existing code by overloading operators and all the math functions like sin() sqrt() etc.  The main thing that would need to be done is to go through and find all the variables of type double that would need to be made type mpreal.  I was thinking the user could either toggle multiprecision mode manually and enter the precision manually, or perhaps the program could automagically switch to multiprecision mode and adjust the precision as needed based on when it encounters DE error like it does when you try to zoom beyond what the current precision can handle?  I know nobody has really bothered to mess with multiprecision for 3D fractals yet mainly I think because of current computing power being very limiting for such a thing, but I think it could be usable for no-frills stuff not using complicated hybrids or fancy effects.  If people are willing to wait a day or two for fancy volumetric lights and things to render, maybe some people would be interested enough to wait a day or two for a deep zoom to render?

Another thought I had was to implement an autofocus?  It would be particularly useful for animations.
« Last Edit: March 19, 2014, 10:56:28 AM by quaz0r » Logged
Pages: 1 [2] 3 4 ... 6   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
"Alien Interface" revisited Images Showcase (Rate My Fractal) David Makin 3 882 Last post January 26, 2007, 01:08:39 PM
by David Makin
Mandelbulber 0.80 Mandelbulber Buddhi 5 3689 Last post June 27, 2010, 05:30:54 PM
by knighty
(1) Hello, (2) Sad interface (3) my book and web site Meet & Greet Ventrella 6 1036 Last post October 08, 2012, 02:14:53 AM
by M Benesi
Chaotica 1.5 animation features and user interface improvements Chaotica lycium 0 838 Last post January 07, 2014, 05:45:26 AM
by lycium
Mandelbrot symbolics / combinatorics web interface Mandelbrot & Julia Set claude 4 553 Last post March 15, 2016, 09:35:06 PM
by claude

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.21 seconds with 29 queries. (Pretty URLs adds 0.01s, 2q)