Author Topic: Cpct?  (Read 6242 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12111
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #30 on: November 19, 2019, 12:53:53 pm »
Yeah, but Primitives don't really have proper texture coordinates. That's the point of ExtendedPrimitives. I suggest to port that too to have something that helps to limit the possible problem sources.

Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile
Re: Cpct?
« Reply #31 on: November 20, 2019, 01:33:54 am »
OK, done. Same thing: single-colored textures work, images don't (and the images aren't null, either).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12111
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #32 on: November 20, 2019, 10:31:07 am »
Then either your loading/conversion of the texture is wrong or your texture coordinates are. I tend to the former, because that's more likely to get broken in porting then some simple floats that should behave the same in both languages.

Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile
Re: Cpct?
« Reply #33 on: November 20, 2019, 07:37:24 pm »
Loading an image is a simple call to Image.FromFile(filename). Which leaves us the texture coordinates. Would that be in Object3D?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12111
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #34 on: November 21, 2019, 11:19:31 am »
Loading an image is a simple call to Image.FromFile(filename). Which leaves us the texture coordinates. Would that be in Object3D?
Are you sure? Loading is one thing, but you have to make an int[]-array out of the loaded image. I would rather think that this step is wrong.

Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile
Re: Cpct?
« Reply #35 on: November 21, 2019, 07:26:03 pm »
I applied my ReverseBytes to the texels and still got black. Actually, at first I got fully-transparent, then I switched the bitwise OR for a bitwise AND for alpha as follows and I was back to black.

Code: [Select]
private static System.UInt32 ReverseBytes(System.UInt32 value) {
    value = (value & 255);//MAKE OPAQUE IT's AN OR IN SoftGLRenderer. WHY?
    return (value & 0x000000FFU) << 24 | (value & 0x0000FF00U) << 8 | (value & 0x00FF0000U) >> 8 | (value & 0xFF000000U) >> 24;
}
    }

Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile
Re: Cpct?
« Reply #36 on: November 22, 2019, 08:30:37 am »
You're a good man, Egon. You were right, the texels[] were black. I'm forced to use the following rather slow nested loop, but voilá, it works.

I think that I'm going to tackle a skeletal structure for it before I try my hand at a hardware renderer, but the eventual C# hardware renderer will benefit from direct access to OpenGL.

Code: [Select]
    int i = 0;
    for (int y = 0; y < image.Height; y++)
for (int x = 0; x < image.Width; x++)
     texels[i++] = (uint) image.GetPixel(x, y).ToArgb();


Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile
Re: Cpct?
« Reply #37 on: September 29, 2020, 10:51:16 pm »
Skybox.render() is making my forest pink (not calling SkyBox.render, naturally, sees my forest green although the sky looks appropriately blue--and it doesn't escape me that blue+green=pink), for some reason. Have you any direction you might give me?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12111
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #38 on: October 01, 2020, 07:09:08 am »
Do you have a screen shot?

Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12111
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #40 on: October 01, 2020, 10:13:01 pm »
What the hell...is that actually using the software or the hardware renderer?

Offline AGP

  • quad
  • ******
  • Posts: 1652
    • View Profile
Re: Cpct?
« Reply #41 on: October 02, 2020, 12:54:29 pm »
I only ported the software. I haven't decided which way to go with hardware yet.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12111
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #42 on: October 04, 2020, 09:45:38 pm »
I'm not sure what I'm seeing there then. If somehow looks as if you are rendering parts that should be hidden by the alpha channel. Like as if the texel sampled to deal with alpha doesn't match the one of the actual color value. But I don't see how that could happen nor do I understand what this has to do with the skybox. Inwould create a simpler test scene and try to narrow it down to what actually triggers this behaviour. In this complex scene, it's a little hard to tell.