Hi There!
After spending the better half of this day getting my HTC Magic to
work in developer mode, I've now found that some of my frist openGL
coding attempts that appeared to work fine in the emulator doesn't
work as expected on the device. I've narrowed this down to glColorf(r,
g, b, a) not working as expected on the device itself. The provided
OpenGL samples do work though.
So for example, after modifying Cube.java from the samples to the
below code I find that I get the expected grey square on the emulator
but a blank white screen (background fill colour) on the device.
class Cube
{
public Cube()
{
int one = 0x10000;
int vertices[] = {
-one, -one,
-one, one,
one, -one,
one, one,
};
// Buffers to be passed to gl*Pointer() functions
// must be direct, i.e., they must be placed on the
// native heap where the garbage collector cannot
// move them.
//
// Buffers with multi-byte datatypes (e.g., short, int, float)
// must have their byte order set to native order
ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);
vbb.order(ByteOrder.nativeOrder());
mVertexBuffer = vbb.asIntBuffer();
mVertexBuffer.put(vertices);
mVertexBuffer.position(0);
}
public void draw(GL10 gl)
{
gl.glFrontFace(GL10.GL_CW);
gl.glVertexPointer(2, gl.GL_FIXED, 0, mVertexBuffer);
gl.glColor4f(0.5f, 0.5f, 0.5f, 0.5f);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
}
private IntBuffer mVertexBuffer;
}
I'm using the latest 1.5 SDK, and my device is the HTC Magic running
firmware version 1.5.
Can anyone explain to me why when switching from colour buffers and
using glDrawElements to glColorf and glDrawArrays, stops shapes from
being coloured in?
Cheers,
Nilz.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---