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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:20:22+00:00 2026-06-15T05:20:22+00:00

I’m creating a small tank-game (renderer is >1300 lines of code) and at present

  • 0

I’m creating a small tank-game (renderer is >1300 lines of code) and at present working on the weapons in the game. The work on weapons has become very annoying as I’m noticing unexpected stuff on the screen (flickering on the screen or complete black screen) whenever I set gl_PointSize.

How does this happen and how to remove this (OpenGL ES 2.0 vendor: Imagination Technologies, Device: Motorola Milestone, OS: Android 2.3.3). Could z-fighting be an issue?

Adjusting setLookAtM does not effect anything, the only way to remove strange effects is by removing gl_PointSize.


[UPDATE]

May be gl_PointSize is not the problem; there is a tank, a room, and a light in the game, and the moment a call to glDrawArrays is made for the weapons, the screen flickers or turns completely black for sometime (until I touch and rotate the tank) given that the weapon is well inside the frustum.


    Matrix.setLookAtM(GLES20Renderer._ViewMatrix, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0);
    Matrix.frustumM(GLES20Renderer._ProjectionMatrix, 0, -ratio, ratio, -1, 1, 0.75f, 10);

    float[] pointVFA = {
            3.0f,3.0f,3.0f,
            -3.0f,3.0f,3.0f,
            -3.0f,-3.0f,3.0f
    };

    ByteBuffer pointVBB = ByteBuffer.allocateDirect(pointVFA.length * 4);
    pointVBB.order(ByteOrder.nativeOrder());
    GLES20Renderer._pointVFBMissile = pointVBB.asFloatBuffer();
    GLES20Renderer._pointVFBMissile.put(pointVFA);
    GLES20Renderer._pointVFBMissile.position(0);

private static final String _vertexShaderCodeMissiles =
        "attribute vec4 aPosition;                                                      \n"
    +   "void main() {                                                                  \n"
    +   " gl_PointSize = 15.0;                                                          \n"
    +   " gl_Position = aPosition;                                                      \n"
    +   "}                                                                              \n";
private static final String _fragmentShaderCodeMissiles =
        "#ifdef GL_FRAGMENT_PRECISION_HIGH                                              \n"
    +   "precision highp float;                                                         \n"
    +   "#else                                                                          \n"
    +   "precision mediump float;                                                       \n"
    +   "#endif                                                                         \n"
    +   "void main() {                                                                  \n"
    +   " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);                                      \n"
    +   "}                                                                              \n";
  • 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-15T05:20:23+00:00Added an answer on June 15, 2026 at 5:20 am

    Having tried all the ways to remove the black empty/flickering screen, (after 2 weeks of agitation) the issue is finally solved and is a new lesson for me.

    It seems that in OpenGL ES 2.0 we cannot mix buffer objects (vbo or ibo) with nio buffers. Either the code should mostly use buffer objects or just nio.

    This is the erroneous code:

        ////////////////////////////////
        // program for missiles start //
        ////////////////////////////////
        GLES20.glUseProgram(GLES20Renderer._programMissiles);
        GLES20.glVertexAttribPointer(GLES20Renderer._aPositionLocationMissiles, 3, GLES20.GL_FLOAT, false, 12, GLES20Renderer._pointVFBMissile);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aPositionLocationMissiles);
        GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 3);
        ///////////////////////////////
        // program for missiles end  //
        ///////////////////////////////
    
        //////////////////////////////
        // program for player start //
        //////////////////////////////
        GLES20.glUseProgram(GLES20Renderer._programBody);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[0]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aPositionLocationBody, 3, GLES20.GL_FLOAT, false, 12, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aPositionLocationBody);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[1]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aColorLocationBody, 4, GLES20.GL_FLOAT, false, 16, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aColorLocationBody);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[2]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aNormalPositionBody, 3, GLES20.GL_FLOAT, false, 0, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aNormalPositionBody);
        GLES20.glUniform3f(GLES20Renderer._uLightPositionLocationBody, GLES20Renderer._LightPosInEyeSpace[0], GLES20Renderer._LightPosInEyeSpace[1], GLES20Renderer._LightPosInEyeSpace[2]);
        GLES20.glUniformMatrix4fv(GLES20Renderer._uMVPLocationBody, 1, false, GLES20Renderer._MVPMatrixBody, 0);
        GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[3]);
        GLES20.glDrawElements(GLES20.GL_TRIANGLES, 372, GLES20.GL_UNSIGNED_SHORT, 0);
    
        GLES20.glUseProgram(GLES20Renderer._programNozzle);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[0]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aPositionLocationNozzle, 3, GLES20.GL_FLOAT, false, 12, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aPositionLocationNozzle);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[1]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aColorLocationNozzle, 4, GLES20.GL_FLOAT, false, 16, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aColorLocationNozzle);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[2]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aNormalPositionNozzle, 3, GLES20.GL_FLOAT, false, 0, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aNormalPositionNozzle);
        GLES20.glUniform3f(GLES20Renderer._uLightPositionLocationNozzle, GLES20Renderer._LightPosInEyeSpace[0], GLES20Renderer._LightPosInEyeSpace[1], GLES20Renderer._LightPosInEyeSpace[2]);
        GLES20.glUniformMatrix4fv(GLES20Renderer._uMVPLocationNozzle, 1, false, GLES20Renderer._MVPMatrixNozzle, 0);
        GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[3]);
        GLES20.glDrawElements(GLES20.GL_TRIANGLES, 144, GLES20.GL_UNSIGNED_SHORT, 0);
        /////////////////////////////
        // program for player end  //
        /////////////////////////////
    

    and this is the correct code:

        ////////////////////////////////
        // program for missiles start //
        ////////////////////////////////
        GLES20.glUseProgram(GLES20Renderer._programMissile);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._missileBuffers[0]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aPositionLocationMissile, 3, GLES20.GL_FLOAT, false, 12, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aPositionLocationMissile);
        GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, GLES20Renderer._missileBuffers[1]);
        GLES20.glDrawElements(GLES20.GL_POINTS, 3, GLES20.GL_UNSIGNED_SHORT, 0);
        ///////////////////////////////
        // program for missiles end  //
        ///////////////////////////////
    
        //////////////////////////////
        // program for player start //
        //////////////////////////////
        GLES20.glUseProgram(GLES20Renderer._programBody);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[0]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aPositionLocationBody, 3, GLES20.GL_FLOAT, false, 12, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aPositionLocationBody);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[1]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aColorLocationBody, 4, GLES20.GL_FLOAT, false, 16, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aColorLocationBody);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[2]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aNormalPositionBody, 3, GLES20.GL_FLOAT, false, 0, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aNormalPositionBody);
        GLES20.glUniform3f(GLES20Renderer._uLightPositionLocationBody, GLES20Renderer._LightPosInEyeSpace[0], GLES20Renderer._LightPosInEyeSpace[1], GLES20Renderer._LightPosInEyeSpace[2]);
        GLES20.glUniformMatrix4fv(GLES20Renderer._uMVPLocationBody, 1, false, GLES20Renderer._MVPMatrixBody, 0);
        GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, GLES20Renderer._bodyBuffers[3]);
        GLES20.glDrawElements(GLES20.GL_TRIANGLES, 372, GLES20.GL_UNSIGNED_SHORT, 0);
    
        GLES20.glUseProgram(GLES20Renderer._programNozzle);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[0]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aPositionLocationNozzle, 3, GLES20.GL_FLOAT, false, 12, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aPositionLocationNozzle);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[1]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aColorLocationNozzle, 4, GLES20.GL_FLOAT, false, 16, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aColorLocationNozzle);
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[2]);
        GLES20.glVertexAttribPointer(GLES20Renderer._aNormalPositionNozzle, 3, GLES20.GL_FLOAT, false, 0, 0);
        GLES20.glEnableVertexAttribArray(GLES20Renderer._aNormalPositionNozzle);
        GLES20.glUniform3f(GLES20Renderer._uLightPositionLocationNozzle, GLES20Renderer._LightPosInEyeSpace[0], GLES20Renderer._LightPosInEyeSpace[1], GLES20Renderer._LightPosInEyeSpace[2]);
        GLES20.glUniformMatrix4fv(GLES20Renderer._uMVPLocationNozzle, 1, false, GLES20Renderer._MVPMatrixNozzle, 0);
        GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, GLES20Renderer._nozzleBuffers[3]);
        GLES20.glDrawElements(GLES20.GL_TRIANGLES, 144, GLES20.GL_UNSIGNED_SHORT, 0);
        /////////////////////////////
        // program for player end  //
        /////////////////////////////
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.