OpenGL Ambient Lighting

by Patrick » Sat, 07 Feb 2009 02:17:25 GMT

Sponsored Links
 I'm getting some strange results when enabling ambient lights in
openGL. After some experiments, I determined that for some reason, the
ambient light color is multiplied by 0.2f. That is, setting an ambient
light of color ( 5.0f, 0.0f, 0.0f, 1.0f ) is needed to get a pure red
ambient, not the expected ( 1.0f, 0.0f, 0.0f, 1.0f ), which yields a
dark red ambient.

I even tried setting the ambient light model :

        float full[] = { 1.0f, 1.0f, 1.0f, 1.0f };
        gl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT, full, 0);

But that makes no difference.

Note that the diffuse component does not suffer from this 0.2f factor,
only the ambient.

Notice that all the default values in openGL for ambient-related stuff
is 0.2f, so I don't think this is a coincidence. Is there another
openGL function I should be calling to set a global factor ?




Other Threads

1. Re-using the Android Call Log / Contacts and sms capabilities.

Hello developers/community.

I am making an internet telephony application based on a proprietary
protocol which connects to a web server for call setup.

As with other telephony applications this app also has three basic
requirements: The need for a call log, a contact book and the ability to
send/receive messages.

One option is for me to develop all these three capabilities from the
scratch. Another possibility is to leverage upon the built-in capabilities
of android and tie them up to my application using content resolvers and

Let me explain my requirements below, and I welcome your comments regarding
their technical feasibility:

*A)) Call Log: *

I would like to maintain the call log of my application with the android
call log. This will make sure that the user has one view of all the calls
that were made (cellular or internet). Is there a way to read/write/delete
from the call log application from android? I believe this can be done using
content resolvers.

customer in my case) , then I wish to provide the user with an Intent
Chooser. If the user selects by application, then the call will be made from
my application and not a cellular call. How do I achieve this behavior ?

If I listen to the ACTION_CALL intent, will my application be available in
the intent chooser ? Or will android try to initiate a cellular call by

*B)) Contact Book:*
The customers can save the internet user's address in the contact book.
There is an entry of a CUSTOM_PROTOCOL in the contact book of android. That
is where the address of the user can be stored who is using my application.
We already have choices of Yahoo, Gtalk and Skype in the contact book.
Similarly, we can also have a custom protocol entry over there. But this is
only half the issue.

When the user selects the address of the custom protocol from the contact
book, I wish to display a pop-up listing my application (maybe I can listen
to the intent which is emitted). Now, if the user selects my application
from the pop-up, I will make a call over the internet instead of the
cellular world (my broadcast receiver will gain control).

Again, I am not sure whether the above is possible and android will display
the intent chooser from the contact book if my custom protocol field is

*C)) SMS capabilities:*

When the user composes a SMS and tries to send it, I wish to intercept the
outgoing SMS and provide the user a choice - to send the SMS using my
application,or from android's native capabilities (GSM-SMS). I believe it is
possible to listen to outgoing messages by registering a content observer on
the SMS content resolver URI.

However, I would like to know whether an INTENT is fired when the user tries
to send a message ? It would make life much easier.

Secondly, I want to re-use the android SMS storage for the messages received
from my custom protocol over the internet. I wish to write to the android
sms database (using its content resolver) for this.

Thanks in advance

With Regards



2. Getting current radio state in my application


How do I check the current radio state in my application? I'm
interested in the RadioState defined in CommandsInterface.

My application checks for the current radio state: The state would be
RADIO_OFF when Airplane mode is active, and NV_READY when radio us up.

Is there any other way to get the status of the fields that I'm
looking for?


3. spinner

4. Which type of token should i get if i want to get Google contacts?

5. Help Wanted!

6. How to get click position in TextView?

7. My presentation analyzing Android bootup time