Color problem in .NET
Hi,
I want to create simple coloured vertices.
The problem is that DirectX expects an BGR-Integer-Value (correct me if this isnt right). None of the functions in VB .NET returns such an integer (neither Color.ToARGB nor RGB()), which means that all colors are presented in a wrong way.
Does anybody know how I can pass a color stored in a color object, so that it is readable for DX?
Or can you describe a function which creates an integer from 3 Byte-Values (Red, Green and Blue)?
Thank you!
hm, that wuld be nice; but it definitely does not work.
Filling the backbuffer with green is no problem
d3dDev.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, Color.Green, 1.0F, 0.0F)
But this
Dim v As CustomVertex.PositionColored() = CType(vb.Lock(0, 0), CustomVertex.PositionColored())
v(cnt).Color = Color.Green.ToArgb
produces a very dark green. I now realized that all colors are presented too dark. What could be the mistake? I don''t use lighting or materials...
Filling the backbuffer with green is no problem
d3dDev.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, Color.Green, 1.0F, 0.0F)
But this
Dim v As CustomVertex.PositionColored() = CType(vb.Lock(0, 0), CustomVertex.PositionColored())
v(cnt).Color = Color.Green.ToArgb
produces a very dark green. I now realized that all colors are presented too dark. What could be the mistake? I don''t use lighting or materials...
That is indeed bizarre, however all of the Microsoft .NET examples utilize Color.ToArgb() so I believe it does work.
Perhaps something else is causing the darkness?
Perhaps something else is causing the darkness?
Color.Green is not 0x00FF00. It's a color Microsoft created, so to speak.
Why not just 0x00FF00 instead? Most (All?) Direct3D C# methods give you the option for Drawing.Color or int. If you want to use the color class that much:
Color.FromArgb(0, 255, 0).ToArgb();
** EDIT **
What about lighting (Ambient light, etc.)
[edited by - Nullmind on May 7, 2004 1:22:19 PM]
Why not just 0x00FF00 instead? Most (All?) Direct3D C# methods give you the option for Drawing.Color or int. If you want to use the color class that much:
Color.FromArgb(0, 255, 0).ToArgb();
** EDIT **
What about lighting (Ambient light, etc.)
[edited by - Nullmind on May 7, 2004 1:22:19 PM]
I have the solution. Before rendering the coloured vertices, I have to call d3dDevice.SetTexture (0, Nothing)
But why does DX consider textures when rendering vertices without texture coordinates???
But why does DX consider textures when rendering vertices without texture coordinates???
quote:Original post by Christoph
I have the solution. Before rendering the coloured vertices, I have to call d3dDevice.SetTexture (0, Nothing)
But why does DX consider textures when rendering vertices without texture coordinates???
It considers textures because it was configured to do so. If you look at the Texture Stage States the default is to modulate the colour by the texture. If you want the colour to come solely from the diffuse colour, then configure it to do so.
Stay Casual,
Ken
Drunken Hyena
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement