2011/4/28 a a <harvey.a...@gmail.com>:
> Nothing can see with following code which come from
> http://stackoverflow.com/questions/1339136/draw-text-in-opengl-es-android
(at 16th floor)
>
>    public void drawTag() {
>        Bitmap bg = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444);
>        bg.eraseColor(0);
>
>        Canvas canvas = new Canvas(bg);
>
>        Drawable drawable =
> mRootLayer.getContext().getResources().getDrawable(R.drawable.default_background);
>        drawable.setBounds(0,0,256,256);
>        drawable.draw(canvas);
>
>     // Draw the text
>        Paint textPaint = new Paint();
>        textPaint.setTextSize(32);
>        textPaint.setAntiAlias(true);
>        textPaint.setARGB(0xff, 0x00, 0x00, 0x00);
>        // draw the text centered
>        canvas.drawText("Hello World", 16,112, textPaint);
>
>        int[] textures = new int[1];
>        GL11 gl = mGL;
>        //Generate one texture pointer...
>        gl.glGenTextures(1, textures, 0);
>        //...and bind it to our array
>        gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
>
>        //Create Nearest Filtered Texture
>        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
> GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
>        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
> GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
>
>        //Different possible texture parameters, e.g. GL10.GL_CLAMP_TO_EDGE
>        gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
> GL10.GL_REPEAT);
>        gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
> GL10.GL_REPEAT);
>
>        //Use the Android GLUtils to specify a two-dimensional texture
> image from our bitmap
>        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bg, 0);
>
>        //Clean up
>        bg.recycle();
> }
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to