• Welcome to Dark Bit Factory & Gravity.
 

How to fix black holes in drawing?

Started by va!n, July 03, 2015

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

va!n

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?


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...

- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

bitm0de

This is not the full code? What determines how these colors are plotted to pixels within the bitmap? Post your full code.

CLASSmate

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.

va!n

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.


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);
}
}

- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: