Logo by AGUS - 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: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. December 02, 2025, 04:24:04 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]   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: is it possible?  (Read 2307 times)
0 Members and 1 Guest are viewing this topic.
madmuppet
Guest
« on: June 04, 2011, 10:31:02 PM »

would it be possible to program a mandelbox viewer using c and opengl? reason being I am learning c already and my video card is a generation too old to make use of opencl.

if so where to begin? .. I have some ideas but I'm sure theres lots of things I have'nt begun to think about yet so hints appreciated.

if not what language would be recommended? and why?

thanks in advance al.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #1 on: June 04, 2011, 10:54:40 PM »

Depends on what you want to do.

If you want to render fractals using the CPU, C is perfectly fine. OpenGL will not help you there at all, since everything is done on the CPU. This is the approach taken by Mandelbulb 3D, and Mandelbulber.

But if you want to render using the GPU, you can use the flexibility of OpenGL shaders and the GLSL language. Instead of using the traditional OpenGL pipeline, you render a single fullscreen quad using a custom pixel shader, which is invoked for each pixel. The most difficult part is getting the setup right - after that GLSL is very easy to work with - like C, but with support for matrices and vectors builtin. This is the approach taken by Boxplorer, Fragmentarium, fractal.io, and most other GPU renderers.

Both methods have their pros and cons. GPU will be faster (for reasonable graphic cards), but less flexible: some effects cannot be done on an individual pixel basis (e.g. the post-processed Depth-Of-Field used in Mandelbulber requires sorting), and I doubt you can find a GPU with GLSL support for double precision floats.

OpenCL would be more flexible that OpenGL and GLSL, but is much more complicated to setup.


Logged
zenzero-2001
Explorer
****
Posts: 42


« Reply #2 on: June 05, 2011, 12:21:58 AM »

If I'm not mistaken OpenCL doesn't only support the GPU on the graphics card but also multi-core CPUs. Perhaps, you could program in OpenCL for the CPU? I don't know too much about OpenCL, but I get the impression that the same code should work on a mult-core cpu and a gpu:

http://www.amd.com/us/products/technologies/stream-technology/opencl/pages/opencl-intro.aspx

Here is a really cool webiste with OpenCL code for GPU / Multi-CPU Mandelbrot (and other code geekery!) - should keep you busy!  grin

http://www.bealto.com/mp-mandelbrot.html

As Syntopia said, if you wish to use OpenGL for the graphics then you are better off using / learning GLSL rather than the traditional OpenGL pipleline, as I believe the latter is deprecated. GLSL skills would also be transferable to mobile devices, if you ever decided to develop for those.

OpenGL will only help with the graphics, whereas OpenCL should help with the fractal calculation (which I'm guessing is more likely to be the performance bottle neck).
Logged
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #3 on: June 05, 2011, 12:32:40 AM »


Intel has a web site with the details which features they support in their OpenCL SDK and which they don't.

http://software.intel.com/en-us/articles/opencl-sdk/

One of the major issues would be operating system support. They only support 64 bit Linux (and that support is Beta).

Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #4 on: June 05, 2011, 12:46:29 AM »

One of the major issues would be operating system support. They only support 64 bit Linux (and that support is Beta).

They also support windows: I've tested Intel's OpenCL SDK on my Windows machine some months ago, and it runs fine. And yes, the same code may be run on both GPU and CPU. I tested a Quaternion 4D Julia fractal implementation, and on my machine it was 7x faster on the GPU (Nvidia Geforce 9800GT  GPU @ 1.5 GHz, and Intel Core 2 Quad Q8200 @ 2.33GHz.).

OpenGL will only help with the graphics, whereas OpenCL should help with the fractal calculation (which I'm guessing is more likely to be the performance bottle neck).

Just to be clear: the approach with OpenGL/GLSL also does the entire fractal calculation on the GPU. There is no distinction between graphics and fractal calculation and there are no polygons involved. OpenCL will not be faster then OpenGL/GLSL (but will be more flexible, e.g. allowing for double precision calculation if hardware supports it).
Logged
zenzero-2001
Explorer
****
Posts: 42


« Reply #5 on: June 05, 2011, 01:11:36 AM »

Quote
Just to be clear: the approach with OpenGL/GLSL also does the entire fractal calculation on the GPU. There is no distinction between graphics and fractal calculation and there are no polygons involved. OpenCL will not be faster then OpenGL/GLSL (but will be more flexible, e.g. allowing for double precision calculation if hardware supports it).

Thanks for clarifying that, I didn't think about performing the actual calculation in GLSL.
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #6 on: June 05, 2011, 01:45:25 PM »

OpenCL would be more flexible that OpenGL and GLSL, but is much more complicated to setup.

Doesn't seem that difficult on a Mac through Xcode, though I haven't tried it yet, at the moment I'm sticking to simple shader 2 so things work on iOS too.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
eiffie
Guest
« Reply #7 on: June 07, 2011, 05:43:37 PM »

Check out "Boxplorer" on Google Code. (c and opengl) It was put together by some people at this forum. I have used the code as a sanity check for my own programming. There is also a Boxplorer2 with added features like DOF etc.
Logged
madmuppet
Guest
« Reply #8 on: June 08, 2011, 11:44:29 PM »

thanks for all the info .. looks like I got a ton of work ahead of me ..:p

anyone want to chime in what compilers they are using? I have been using emacs and gcc up till now .. I recently had a look at codeblocks and visual studio and they are an additional layer of complexity
Logged
marius
Fractal Lover
**
Posts: 206


« Reply #9 on: June 09, 2011, 03:22:46 AM »

thanks for all the info .. looks like I got a ton of work ahead of me ..:p

anyone want to chime in what compilers they are using? I have been using emacs and gcc up till now .. I recently had a look at codeblocks and visual studio and they are an additional layer of complexity

I made boxplorer2 buildable with g++ on linux, the free vc++ on windows and xcode on the mac using some very simple makefiles.
Thanks to SDL abstraction, mostly. See http://code.google.com/p/boxplorer2/source/browse/#svn%2Ftrunk

The particular c++ compiler really isn't that relevant; the cycle burning glsl code gets compiled by the graphics driver, on the fly.
Logged
madmuppet
Guest
« Reply #10 on: June 13, 2011, 11:18:12 PM »

thanks for all the help .. very much appreciated ..

al.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  


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.428 seconds with 25 queries. (Pretty URLs adds 0.017s, 2q)