This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I local gles error: [gles_state_set_error_internal:62: GLES ctx: 0xe097c008, error code:0x500]

Error code on Android device:

--

gles_state_set_error_internal:62: GLES ctx: 0xe097c008, error code:0x500

gles_state_set_error_internal:63: GLES error info:<target> is not an accepted value

--

The device uses GPU model as adreno 510.

HELP!

Don' t know where to start to figure out this error.

Parents Reply Children
  • In OpenGL ES 2.0, the only values accepted as the first argument of glBindTexture are :

    • GL_TEXTURE_2D
    • GL_TEXTURE_CUBE_MAP

    Any other value will generate an GL_INVALID_ENUM (0x500) error.

    One way to load a texture is to :

    • Create a GLuint variable where you will store a texture reference
    • Load the texture data in a buffer
    • Call glGenTextures(1, &your_gluint_texture_reference)
    • Call glActiveTexture(GL_TEXTURE0) /* Or, as the manual says GL_TEXTUREi where i ranges from 0 to (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1) */
    • Call glBindTexture(GL_TEXTURE_2D, your_gluint_texture_reference)
    • Call glTexImage2D(GL_TEXTURE_2D, 0, color_format, width, height, 0, color_format, color_representation, &your_buffer_with_the_texture_data)
      Where color_format is either : GL_RGB, GL_RGBA;
      and color_representation is either : GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, or GL_UNSIGNED_SHORT_5_5_5_1
    • (Optional) Generate mimaps, set the desired behaviour when texture coordinates are outside [0,1] and set the color interpolation behaviour when the textures do not fit the area by calling :
      glGeneratePixmap(GL_TEXTURE_2D);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); /* Horizontal repetition behaviour */
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); /* Vertical repetition behaviour. You can use GL_CLAMP_TO_EDGE to have a stretch effect */
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); /* Color interpolation behaviour when the texture is bigger than the area. */
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); /* Color interpolation behaviour when the texture is smaller than the area */

    Then, once a program linked :

    • Define a sample2D uniform variable in your fragment shader that will determine the texture unit to use
    • Define a GLuint that will represent this uniform value ID :
    • Call your_texture_uniform_value_id = glGetUniformLocation(your_program_id, "your_uniform_variable_name");

    When using the program, you can then bind the uniform variable of your fragment shader to the current texture unit used by calling :

    glUniform1i(your_texture_uniform_value_id, 0); /* Or the number suffixed to GL_TEXTUREi in your previous glActiveTexture call */

    Since I'm still learning the thing, there might be unnecessary steps in this explanation. However, this is how I currently load textures in my OpenGL ES 2.0 program.

    Accurate informations on these different calls can be obtained from the official manual pages.

    Minor edit : glUniform1i(your_texture_uniform_value_id, GL_TEXTUREi) was invalid. I thought that GL_TEXTURE0 would be defined as 0x0, but it is not and its use as a sampler ID in a fragment shader leads to undefined behaviour.