Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: va!n on July 03, 2015

Title: How to fix black holes in drawing?
Post by: va!n on July 03, 2015
While i studied carefully and in detail the RGB color channels of ColorCubes, i managed to generate each of the three CubeSide as a 256x256 RectImage. My next step was to draw each pixel transformed, so i get the effect of a ColorCube. However it seems there are two problems atm. My biggest problem is the right side face, where you will notice black holes inside the generated face.

Here is my code, drawing always a white pixel, so you can see the black holes...
Any idea whats wrong?

Code: [Select]
for (int y = 0; y < 127; y++)
{
for (int x = 0; x < 127; x++)
{
bufferColor[ 128+65+(x/2)-(y/2) + (y+x)*256] = RGB(255, 255, 255);
}
}

Attachement is a screenshot of my generated work...

Title: Re: How to fix black holes in drawing?
Post by: bitm0de on August 31, 2015
This is not the full code? What determines how these colors are plotted to pixels within the bitmap? Post your full code.
Title: Re: How to fix black holes in drawing?
Post by: CLASSmate on September 12, 2015
By posting your full code we will be able to see full picture.
You gave us just a piece of painting, or just let's say - piece of puzzle.
Even if YOU think it's not necessary - it is. It's not about your skills, it's about practical use of full code.
Then we eliminate other possibilities.
Title: Re: How to fix black holes in drawing?
Post by: va!n on September 23, 2015
Here is my code to draw a  cube like color box. I am not sure, if there is another or better way to generate/draw this colored cube. Most graphic programs are using a more rotated colorCube ^^ If you are interested, how i found out the math to draw this cube, i downloaded an original colorCube as PNG from google. Then i extracted each color channel and saved this as own image. So i managed to see how are the gradients and how to start coding my colorCube step by step.

Code: [Select]
long bufferColor[256 * 256];

// Clear Background

for (int i = 0; i < 256 * 256; i++)
{
bufferColor[i] = RGB(64, 64, 64);
}

// Draw ColorCube (routine by va!n)

for (int y = 0; y < 128; y++)
{
for (int x = 0; x < 128; x++)
{
bufferColor[(64 + x - (y / 2) + (y * 256))] = RGB(x * 2, 255, y * 2);
bufferColor[x + (y / 2) + ((y + 128) * 256)] = RGB(x * 2, 256 - (y * 2), 255);
bufferColor[128 + 64 + (x / 2) - (y / 2) + (y + x) * 256] = RGB(255, 256 - (x * 2), y * 2);
}
}