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 6543829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:23:34+00:00 2026-05-25T11:23:34+00:00

I am now able to load a texture to the project I have made

  • 0

I am now able to load a texture to the project I have made but it gave me results that I was not expecting. Instead of loading my 91 tiles and having them have crate textures, and having a picture of a puppy be at 10x and 10 y, everything is the puppy.

This is my draw code

    @Override
public void onDrawFrame(GL10 gl) {

    // TODO Auto-generated method stub
       gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
       gl.glLoadIdentity();         
       for(int i =0;i<91;i++)
      {
              myfloortiles[i].draw(gl);
      }
       gl.glLoadIdentity();  
       gl.glOrthof(0, width, height, 0, 0, 1);
       gl.glDisable(GL10.GL_DEPTH_TEST);
      // gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
       gl.glTranslatef(10, 10, 1);
       bitmap=BitmapFactory.decodeResource(context.getResources(), R.drawable.puppy);
       int textureID;
       int[] temp = new int[1]; 
       gl.glGenTextures(1, temp, 0); 
       textureID = temp[0]; 
       gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID); 
       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_NEAREST); // GL_LINEAR for quality. 
       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); 
       GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); 
       bitmap.recycle(); 


}

Of course I have to be doing something wrong. Is it that I have to make a 3d object and then render the texture to it? Or is there another way? Also how would I have an animation if i chose the 3d object with texture path? Would I swap in new images when I want it to draw a different image for the interface? Is my place the image in a specific location logic correct? Or is that also terribly incorrect also?

  • 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-05-25T11:23:34+00:00Added an answer on May 25, 2026 at 11:23 am

    Technically not a mistake, but a problem is generating texture names and creating a texture object in the drawing function. Texture creating is a one-time thing:

    • You generate a texture name, which is a handle by which you refer to the texture later (glGenTextures)
    • You bind that name (glBindTexture)
    • You upload the image (glTexImage and/or glTexSubImage)

    For drawing the actual textured meshes you

    • enable texturing (*glEnable(GL_TEXTURE_…)*)
    • bind the texture(s) (glBindTexture)
    • draw the mesh(es)

    In your code you’re going through the whole texture creation phase for every redraw. The last created texture is also the bound texture and thus will be subsequently applied to the following drawing calls. Which are about to happen in the next call of onDrawFrame


    On a side note: You clearly have not understood how the matrix stack works. You mixed calls of glOrtho, glLoadIdentity, glTranslate and so on without any sensible structure. You need to get the understanding of those straigt, too. I’d say even before you tackle texturing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project right now where I'd like to be able to pull
In ruby, I'm able to do File.dirname(/home/gumby/bigproject/now_with_bugs_fixed/32/FOO_BAR_2096.results) and get /home/gumby/bigproject/now_with_bugs_fixed/32 but now I'd like
Now that I know C++ I want to get into desktop application that have
I have been struggling with not being able to have the EntityManager be instantiated
I have tried for a few days now to figure this out but i
Let's say i have a method that get a GLuint texture as a parameter
Now according to the author's site i should be able to load videobox on
I've been struggling for some time now to be able to use the built-in
I am able to successfully call a function with ctypes in Python. I now
I create a file in JavaScript. Now I want to be able to make

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.