d3alek / Texample2

Rendering Text in OpenGL ES 2 on Android
Other
83 stars 33 forks source link

Editable Text? #1

Open power7714 opened 11 years ago

power7714 commented 11 years ago

Hello, How would I display an editable text in a live wallpaper? I am using the Rajawali opengl framework. OpenGL ES 2.0 I want the user to be able to edit the text through the preferences and it show up in front of the model or below it. I want to also use a custom font from my assets. I coded a canvas to bitmap but when I try to call it in my renderer, it doesn't show up. I don't get any errors in my logcat just a black screen on my device. I still don't completely understand canvas to bitmap but I thought I'd ask you since you obviously know how to do it. I would greatly appreciate your help. I've been at this for months and can't seem to get it working. Thank you in advance.

d3alek commented 11 years ago

Hi!

Did you try to use my code, Texample2? If so, there a couple of reasons why you might be getting black screen. Make sure to include this in your onSurfaceCreated method in your renderer to enable blending and set the blending function appropriately (otherwise textures will not load correctly).

// enable texture + alpha blending
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

Tell me if this helps!

PhuongHoangMinh commented 7 years ago

why it doesn't display any text? onSurfaceCreated() already includes the above code. It seems that you multiply wrong mProjectionMatrix and mViewMatrix. You called the Matrix.FrustumM and Matrix.OrthoM for these matrices. However, mMViewMatrix should be set by Matrix.setLookAt.