Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Ambient color in DGDK.NET

Author
Message
thierry st malo
19
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 12th Mar 2007 15:04
With DGDK.NET, when I call oDB2D.ColorAmbientLight with three integers (\"long\" as they used to be known) each having a value of 255, I get a color of 0 and an exception. How come?
Thanks,
Thierry
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 12th Mar 2007 16:02
I'm not quite sure, let me check out the function to make sure there isn't any problems.

Paul.


322 is the time that the world will change.... forever!
thierry st malo
19
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 13th Mar 2007 10:52
I've somewhat misled you, Paul; sorry about that. The real problem seems to be in oDB2D.RGBC.
Thierry
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 13th Mar 2007 15:45
I'm not quite sure what's going on here.. I assume the function works with other uses such as assigning object colours or drawing lines in 2D with specific colour values? Are you able to show a couple of screen shots with a sample to illustrate what the problem is? Thanks

Paul.


322 is the time that the world will change.... forever!
thierry st malo
19
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 13th Mar 2007 18:39
There seems to be a problem with both oDB2D.RGBC and oDB2D.ColorAmbientLight. I have amended my code as follows:



LightA is a string that holds "70 255 255 255".
So, reaching the sub's end, R, G and B hold 255 each (I've checked and re-checked). Then oDBLight.ColorAmbientLight throws an exception. If I say "Couleur = oDB2D.RGBC(R, G, B)", oDB2D.RGBC throws an exception.

At this point, I'm lost. With VB Express, "Integer" is 32 bits.
ex.Message is "Arithmetic operation resulted in an overflow."
Couleur.ToArgb() is -1.

What I'm trying to do is to implement this simple dialog box in a 3D application. And worse is to come: I intend to create a directional light as well!

Thierry

Attachments

Login to view attachments
cypher0
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location:
Posted: 14th Mar 2007 01:34
Just using the integer directly is easier, but I've never had a problem with the RGB function. Try turning Option Strict on, and turn Treat all Warnings as Errors to on too, this sometimes highlights invalid cast problems.

Colour = &HRRGGBB&

OR

Colour = &H10000& * RED + &H100& * GREEN + BLUE
thierry st malo
19
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 14th Mar 2007 16:17
Thanks to cypher0 I have a workaround; but I maintain that there is a problem somewhere between oDB2D.RGBC and oDBLight.ColorAmbientLight. For instance, oDB2D.RGBC(0,128,192) is OK, but oDB2D.RGBC(255,255,255) throws an exception.
Thierry

Login to post a reply

Server time is: 2024-11-19 12:38:21
Your offset time is: 2024-11-19 12:38:21