Logo by reallybigname - 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. April 25, 2024, 12:35:22 AM


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: .net based fractal rendering/ray tracing  (Read 3889 times)
0 Members and 1 Guest are viewing this topic.
JColyer
Guest
« on: November 21, 2009, 02:23:12 AM »

Anybody out there using .net to write their rendering software?  I'm a C#/.Net programmer by trade, but only sever side and web based stuff.  When it comes to windows GUI programming - well - I've got no clue.  I read a lot about the coding behind ray tracers, but with my lack of windows GUI knowledge I'm totally hosed.

James
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #1 on: November 21, 2009, 02:52:03 AM »

Lack of Windows GUI programming knowledge is the main reason I use Ultra Fractal - plus the fact that I'm sick of all the issues relating to software development under Windows in C/C++ etc.
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Snakehand
Guest
« Reply #2 on: December 10, 2009, 03:05:34 PM »

Lack of Windows GUI programming knowledge is the main reason I use Ultra Fractal - plus the fact that I'm sick of all the issues relating to software development under Windows in C/C++ etc.

One solution which I use, is SDL - it is originally inteded for games, but can be used as a simple cross platform UI.

For illustration I  have attached a "shell" that I use for my GPU fractal renderer. The following snippet is all the GUI code that is needed for simple key driven interaction.

Code:
#include "SDL.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "Bulber.h"


void UpdateScreen( SDL_Surface *screen, Bulber* bulb)
{
    unsigned char *raw_pixels;
    SDL_LockSurface(screen);

    raw_pixels = (unsigned char*)screen->pixels;

    bulb->Blit( raw_pixels, screen->pitch );

    SDL_UnlockSurface(screen);
    SDL_UpdateRect(screen,0,0,0,0);
}


int main()
{
    SDL_Surface *screen;

    /* Initialize SDL's video system and check for errors */
    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
               printf("Unable to initialize SDL: %s\n",
                      SDL_GetError());
               return 1;
    };

    /* Make sure SDL_Quit gets called when the
     * program exits! */
    atexit(SDL_Quit);

    /* Attempt to set a 640x480 24bpp video mode */
    screen = SDL_SetVideoMode(800,600,24,SDL_SWSURFACE );//  | SDL_RESIZABLE);
    if (screen == NULL) {
        printf("Unable to set video mode: %s\n",
               SDL_GetError());
        return 1;
    };

    /* If we got this far, everything worked */
 
    int x,y;
    Bulber bulb(800,600);
    float cx = 0.0f;
    float cy = 0.0f;
    float cz = -4.0f;
    float zoom = 1.0f;

    bulb.Calc( cx, cy, cz, zoom );
    UpdateScreen(screen, &bulb);

    SDL_EnableKeyRepeat(300,100);

    SDL_Event event;
    bool run = true;
    for(;run;) {
        SDL_WaitEvent(&event);
        switch (event.type) {
        case SDL_KEYDOWN:
            switch(event.key.keysym.sym){
            case SDLK_a:
                cz -= 0.01 / zoom;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_z:
                cz += 0.01 / zoom;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_LEFT:
                cx -= 0.04f /zoom;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_RIGHT:
                cx += 0.04f /zoom;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_UP:
                cy -= 0.1f /zoom;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_DOWN:
                cy += 0.1f /zoom;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_PAGEUP:
                zoom = zoom / 1.1f;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            case SDLK_PAGEDOWN:
                zoom = zoom * 1.1f;
                bulb.Calc( cx, cy, cz, zoom );
                UpdateScreen(screen, &bulb);
                break;
            default:
                break;
            }
            break;

        case SDL_QUIT:
            run = false;
            break;
        }
    }

    return 0;
}

« Last Edit: December 10, 2009, 03:07:06 PM by Snakehand, Reason: wording » Logged
twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« Reply #3 on: December 10, 2009, 03:50:37 PM »

I use SDL too - a great library, and it works fine under Visual C++ 2008. No GUI knowledge is really needed.

If anyone wants to know the best tutorial for setting up SDL with Visual C++, there's a good one if I can find it.....
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Cuda-based flame fractal generator Introduction to Fractals and Related Links Rychveldir 7 9714 Last post March 05, 2012, 05:15:43 PM
by matty686
A Little Fractal-Based Philosophical Poem Philosophy Pterofractal 1 4398 Last post December 03, 2013, 07:12:58 AM
by jehovajah
Which fractal is this based on? Help & Support looper 7 988 Last post February 03, 2015, 04:43:07 PM
by TheRedshiftRider
Simple square based fractal. 3D Fractal Generation zomg 4 2988 Last post January 19, 2015, 05:52:18 PM
by Logos
Tips on speeding up Scratch-based fractal programs? Programming greentexas 3 15942 Last post August 06, 2017, 08:25:16 PM
by tsl

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.143 seconds with 26 queries. (Pretty URLs adds 0.011s, 2q)