> In general, this doesn't work very well. Trying to upload a full-screen
> texture every frame is going to be dead slow --- these embedded GPUs
> typically have really lousy texture upload speeds. (Go look at the grief
> people have doing 2D on the iPhone, for example.) There's a Qualcomm
> extension that *might* help, but it's totally undocumented and I haven't
> reverse-engineered from the Android source yet, and I don't know if it
> works.
That's bad. Is there anything else i can do? In Windows CE i draw in a
bitmap and draw that bitmap to screen. It works very well and fast.
I only want to use official apis.
thanks
guich
float vertices[] =
{
0.0f, 0.0f,
512.0f, 0.0f,
0.0f, 1024.0f,
512.0f, 1024.0f
};
float texture[] =
{
0.0f, 0.0f,
1.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f
};
int indices[] =
{
0, 1, 3,
0, 3, 2
};
UpdateView();
//Check if this section even gets run
__android_log_print(ANDROID_LOG_INFO, "SanAngeles", "We have
arrived.");
//onDraw
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glOrthof(0.0f, 320.0f, 430.0f, 0.0f, 1.0f, -1.0f);
//texture stuff
glGenTextures(1,&textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//Different possible texture parameters, e.g
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 512, 1024, 0,
GL_RGB ,GL_UNSIGNED_BYTE, (GLvoid *) colors);
glEnableClientState(GL_VERTEX_ARRAY);
//glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vertices);
//glTexCoordPointer(2, GL_FLOAT, 0, texture);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices);
glDisableClientState(GL_VERTEX_ARRAY);
//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
colors is an array that contains the bitmap colors.
On 18/12/09 11:35, guich wrote:
[...]
> That's bad. Is there anything else i can do? In Windows CE i draw in a
> bitmap and draw that bitmap to screen. It works very well and fast.
>
> I only want to use official apis.
You cannot do this with official APIs.
If you're a platform developer (that is, if you're building your app
with the platform SDK and planning on having your app included in the
firmware of a new phone), you can use Surface::lock() and
Surface::unlockAndPost(). But that's a story for another mailing list.
(If anyone who was actually developing the Android EGL implementation is
interested on making 2D stuff work, I would encourage them to go and
look at the EGL_KHR_locksurface extension, which is specifically
intended to allow this sort of thing:
http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_lock_surface.txt
It ought to be dead easy to implement, too. Unfortunately Android
doesn't support it right now. In general I find the Android EGL
implementation is pretty dubious --- there's a lot of omissions and
stuff it does wrong.)
- --
???? ?????????????? ????? http://www.cowlark.com ?????
?
? "Under communism, man exploits man. Under capitalism, it's just the
? opposite." --- John Kenneth Galbrith
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFLLWDyf9E0noFvlzgRAtcwAKCsCVhpJrQxkNggA8k9C3aZ98JKswCgyyPE
oAmRpDvIzGT1a+u+NdH4OYE=
=RtCU
-----END PGP SIGNATURE-----