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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:00:38+00:00 2026-05-27T04:00:38+00:00

how to setup opengl to use glTextParameteriv correct. The following code works in emulator

  • 0

how to setup opengl to use glTextParameteriv correct. The following code works in emulator but not on my htc desire with cyanogen mod 7. Maybe someone can try it with his own phone?

public class GLView extends GLSurfaceView implements GLSurfaceView.Renderer {

public GLView(Context context) {
    super(context);
    setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS);
    setRenderer(this);
}

int textureID;

@Override
public void onDrawFrame(GL10 gl) {
    gl.glMatrixMode(GL10.GL_MODELVIEW); 
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);        
    ((GL11Ext)gl).glDrawTexfOES(10, 10, 0, 100, 100);
}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    gl.glViewport(0, 0, width, height);
}

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    Bitmap bitmap;
    int[] textures;
    InputStream is;

    is = getResources().openRawResource(R.drawable.skater_idle_roll);

    try {
        BitmapFactory.Options sBitmapOptions  = new BitmapFactory.Options();
        // Set our bitmaps to 16-bit, 565 format.
        sBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
        bitmap = BitmapFactory.decodeStream(is, null, sBitmapOptions);
    } finally {
        try {
            is.close();
        } catch (IOException e) {
            // Ignore.
        }
    }

    //gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
    gl.glClearColor(0.5f, 0.5f, 0.5f, 1);
    gl.glShadeModel(GL10.GL_FLAT);

    gl.glDisable(GL10.GL_DEPTH_TEST);
    gl.glDisable(GL10.GL_DITHER);
    gl.glDisable(GL10.GL_LIGHTING);

    gl.glEnable(GL10.GL_TEXTURE_2D);
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    textures = new int[1];
    gl.glGenTextures(1, textures, 0);
    textureID = textures[0];

    int[] crop = new int[4];

    crop[0] = 0;
    crop[1] = bitmap.getHeight();
    crop[2] = bitmap.getWidth();
    crop[3] = -bitmap.getHeight();

    gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
    GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);        

    // here EXCEPTION is thrown
    ((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, crop, 0); 
}

}

DDMS Ausgabe:

04-19 20:24:23.225: ERROR/AndroidRuntime(2524): FATAL EXCEPTION: GLThread 10
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): android.opengl.GLException: invalid value
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): at android.opengl.GLErrorWrapper.checkError(GLErrorWrapper.java:62)
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): at android.opengl.GLErrorWrapper.glTexParameteriv(GLErrorWrapper.java:803)
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): at android.opengl.GLLogWrapper.glTexParameteriv(GLLogWrapper.java:2512)
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): at dk.opengltest.GLView.onSurfaceCreated(GLView.java:93)
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
04-19 20:24:23.225: ERROR/AndroidRuntime(2524): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

glDebugFlags are active. Replica Island which uses the same technik to draw works, so i think i am just missing something but i don’t know what…

  • 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-27T04:00:39+00:00Added an answer on May 27, 2026 at 4:00 am

    I know that my samsung phone handled textures differently than my Nexus one. I had to make sure that my texture was exact powers of 2 in order for it to work correctly.

    See what the resolution of your textures are and change them to either be 2,4,8,16,32,64,128,256…etc

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

Sidebar

Related Questions

What's the minimum boilerplate code required to setup an OpenGL view (with the necessary
Is it possible in opengl to setup blending to achieve additive color overlays? Red
Can you blend Java and native OpenGL calls. For instance having the setup happen
Setup Have you ever had the experience of going into a piece of code
Setup is following: Drupal project, one svn repo with trunk/qa/production-ready branches, vhosts for every
I'm wanted to convert some of my python code to C++ for speed but
I am trying to use GLSL with openGL 2.0. Can anyone give me a
I am looking into converting my OpenGL rendering code to take advantage of a
Anyone know how to create an OpenGL ES app that doesn't use the full
I'm trying to take my code to the next level. Following some best practices

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.