Author Topic: How to fix black holes in drawing?  (Read 1696 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1398
  • Karma: 108
    • View Profile
    • http://www.secretly.de
How to fix black holes in drawing?
« 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...

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

Offline bitm0de

  • ZX 81
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: How to fix black holes in drawing?
« Reply #1 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.

Offline CLASSmate

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: How to fix black holes in drawing?
« Reply #2 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.

Offline va!n

  • Pentium
  • *****
  • Posts: 1398
  • Karma: 108
    • View Profile
    • http://www.secretly.de
Re: How to fix black holes in drawing?
« Reply #3 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);
}
}
- 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: