Rendering process idea

This is a discussion on Rendering process idea within the C++ Programming forums, part of the General Programming Boards category; I have an unsigned int array which contains the image data. I wonder if it seem unusual to use an ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121

    Rendering process idea

    I have an unsigned int array which contains the image data. I wonder if it seem unusual to use an Fibonacci heap Data structure to handle what collection of pixels were written to the array. Also, I thought about using the heap to map out the collection of pixel to be overwrite with the background data that it had previously written over.

    Any suggestions ?
    Last edited by Darkinyuasha1; 05-01-2010 at 03:39 PM.

  2. #2
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    I wonder if it seem unusual to use an Fibonacci heap Data structure to handle what pixels what collection of pixels were written to the array.
    My one word answer is yes. Unless you have to find a particular pixel quickly.
    But more often than not you'll want to perform operations on all the pixels, so an array works just as well.

    Also, I thought about using the heap to map out the collection of pixel to be overwrite with the background data that it had previously written over.
    You what?
    Consider this post signed

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    Well I wanted the heap to use the array.. so that it could track the individual elements that were changed.. and would need to be overwritten later on... lol without going through the array element by element...

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    @Darkinyuasha1: I think if you try and read this thread pretending to be someone who is not you, you'll notice you never bothered to really explain what you are doing, and too much is left to inference. Why/how are elements in the array changing over time? I could guess, but I'm not going to bother.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    Quote Originally Posted by MK27 View Post
    @Darkinyuasha1: I think if you try and read this thread pretending to be someone who is not you, you'll notice you never bothered to really explain what you are doing, and too much is left to inference. Why/how are elements in the array changing over time? I could guess, but I'm not going to bother.
    I initially build a class to rendering data from an array of pixels. There are three layered arrays, which are the same as the blank buffer. Each layer will be specific for certain drawings... like layer 0 for the back ground, layer 1 sprites, layer 2 particle effects. I made a function to draw on one of the specific layers. When you update the class, the data on the layers are drawn onto the buffer, then the buffer is copy to direct video memory. I made a loop to run through the arrays in parallel. I thought if i could use a fast data structure to get the specific written pixel to write to the buffer would of been better .

  6. #6
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,295
    data structures that provide O(log(n)) access are only faster than data structures that provide O(n) when n is not too small. If n is less than about 8, then it will most likely only be slower.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    Well for N I'm worry with pixel array data that is most likely going to be over 250 by 250 . I know for Binomial heap is exactly like binary heap for Big O insertion. The merging property, of combining two binomial trees into one heap. Thus, I could write all the elements from a single heap correct?

  8. #8
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,295
    I don't think anyone, myself included, understands what you are thinking of.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  9. #9
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    Alright, so what data structure would work for rendering a written set of pixels on an array?

  10. #10
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,236
    Keep it simple. Maintain a bounding box of all the pixels in each layer which have been drawn on. Tracking it to the single pixel is going to be far too slow. Just the mere existence of such a data structure means that the raster and the data structure will compete with each other to be in cache.

    Accessing pixels sequentially is BLAZINGLY fast.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  11. #11
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    Thanks, I did go over board with the idea lol. I'll incorporate the bounding box into my render. I just thought it would be slow if the render constantly scroll through an array. In example, An array of 500 x 500 elements.

  12. #12
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,236
    Quote Originally Posted by Darkinyuasha1 View Post
    Thanks, I did go over board with the idea lol. I'll incorporate the bounding box into my render. I just thought it would be slow if the render constantly scroll through an array. In example, An array of 500 x 500 elements.
    It's definitely worthwhile to limit your access to pixels as much as possible, but a complicated technique that keeps a large data structure in memory will probably have the opposite effect that you intend. The processor is really quite fast, unless you screw up the caches, which is likely to happen as your code gets more and more complicated.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. Killing A Process
    By tommyb05 in forum C Programming
    Replies: 8
    Last Post: 06-01-2009, 06:41 AM
  3. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  4. Help needed in creating a process
    By sac_garg in forum C Programming
    Replies: 3
    Last Post: 10-01-2006, 01:40 AM
  5. binary tree of processes
    By gregulator in forum C Programming
    Replies: 1
    Last Post: 02-27-2005, 11:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21