Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7863943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:38:24+00:00 2026-06-02T23:38:24+00:00

I’m using this font.png but in game it doesn’t look clear.How can i draw

  • 0

enter image description here

I’m using this font.png but in game it doesn’t look clear.How can i draw a clear text in my game?Rendering text to a texture like in Draw text in OpenGL ES is more logical then my solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:38:26+00:00Added an answer on June 2, 2026 at 11:38 pm

    have you enabled blending for your OpenGL context?

    try this code in OnSurfaceCreated():

    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    gl.glEnable(GL10.GL_BLEND);
    

    edit:
    this code works with your texture:
    just rename your texture to “text.png” and put it in res/raw/

    //////////////////////////////
    // TextureTestActivity.java
    
    package com.TextureTest.TextureTest;
    import android.app.Activity;
    import android.os.Bundle;
    import android.content.Context;
    import android.opengl.GLSurfaceView;
    
    public class TextureTestActivity extends Activity {
        private GLSurfaceView mGLView;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            mGLView = new TextureTestSurfaceView(this);
            setContentView(mGLView);
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            mGLView.onPause();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            mGLView.onResume();
        }
    }
    
    class TextureTestSurfaceView extends GLSurfaceView {
        public TextureTestSurfaceView(Context context) {
            super(context);
            setEGLConfigChooser(false);
            setRenderer(new TextureTestRenderer(context));
        }
    }
    
    //////////////////////////////
    // TextureTestRenderer.java
    package com.TextureTest.TextureTest;
    import java.io.InputStream;
    import java.nio.ByteBuffer;
    import java.nio.ByteOrder;
    import java.nio.FloatBuffer;
    import javax.microedition.khronos.egl.EGLConfig;
    import javax.microedition.khronos.opengles.GL10;
    import android.content.Context;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.opengl.GLES10;
    import android.opengl.GLSurfaceView;
    import android.opengl.GLU;
    import android.opengl.GLUtils;
    public class TextureTestRenderer implements GLSurfaceView.Renderer {
        Context context;
        int textureID;
    
        float vertices[] = {
                -1.0f,  1.0f, 0.0f,
                -1.0f, -1.0f, 0.0f,
                 1.0f,  1.0f, 0.0f,
                 1.0f, -1.0f, 0.0f
                 };
    
        float texcoords[] = {
                0.0f, 0.0f,
                0.0f, 1.0f,
                1.0f, 0.0f,
                1.0f, 1.0f,
                };
    
        FloatBuffer texCoordBuffer;
        FloatBuffer vertexBuffer;
    
        TextureTestRenderer(Context context) {
            this.context = context;
        }
    
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            // set gl options
            gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
    
            gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
            gl.glEnable(GL10.GL_BLEND);
    
            // create texture
            int textures[] = new int[1];
            gl.glGenTextures(1, textures, 0);
            textureID = textures[0];
    
            gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
            gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
            gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
            gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
            gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
    
            InputStream is = context.getResources().openRawResource(R.raw.text);
            Bitmap textBitmap = BitmapFactory.decodeStream(is);
    
            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, textBitmap, 0);
            textBitmap.recycle();
    
            // create vertex and texcoord buffers
            ByteBuffer vbb = ByteBuffer.allocateDirect(4 * 3 * 4);
            vbb.order(ByteOrder.nativeOrder());
            vertexBuffer = vbb.asFloatBuffer();
    
            ByteBuffer tbb = ByteBuffer.allocateDirect(4 * 2 * 4);
            tbb.order(ByteOrder.nativeOrder());
            texCoordBuffer = tbb.asFloatBuffer();
    
            for (int v = 0; v < 4; v++)
                for(int c = 0; c < 3; c++)
                    vertexBuffer.put(vertices[v * 3 + c]);
    
            for (int v = 0; v < 4; v++)
                for(int c = 0; c < 2; c++)
                    texCoordBuffer.put(texcoords[v * 2 + c]);
    
            vertexBuffer.position(0);
            texCoordBuffer.position(0);
    
            // set up view matrices
            gl.glMatrixMode(GL10.GL_MODELVIEW);
            gl.glLoadIdentity();
    
            GLU.gluLookAt(gl, 0.0f, 0.0f, 5.0f,
                              0.0f, 0.0f, 0.0f,
                              0.0f, 1.0f, 0.0f);
        }
    
        public void onDrawFrame(GL10 gl) {
            gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    
            gl.glEnable(GL10.GL_TEXTURE_2D);
            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
            gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    
            gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
            gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
            gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texCoordBuffer);
    
            gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
        }
    
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            GLES10.glViewport(0, 0, width, height);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.