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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:20:43+00:00 2026-05-15T22:20:43+00:00

The following is giving me triangles not squares, anyone know why?? //Defining as… addcube(2,-2,

  • 0

The following is giving me triangles not squares, anyone know why??

    //Defining as...
        addcube(2,-2, 1, -1, 10);
        addcube(float lx, float hx, float ly, float hy, floathz){
            final float array1[] = new float[] {
            //Front face
            lx, ly, hz,
            lx, hy, hz,
            hx, hy, hz,
            hx, ly, hz
    };
 }

    //Drawing as...
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;

I’ve attempted adding gl.glDisable(GL10.GL_CULL_FACE); but that just puts the remaining square in the foreground. I’ve included the draw methods…

public void onDrawFrame(GL10 gl) {
    onDrawFrameCounter++;
    gl.glEnable(GL10.GL_TEXTURE_2D);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    bindCameraTexture(gl);
    System.out.println(Global.bearing);
    float bear = Global.bearing;
    gl.glLoadIdentity();
    gl.glNormal3f(0,0,1);
    System.out.println("ARRAY!: " + GLCamTest.array.length);
    p = 0;
    gl.glRotatef(bear, 1, 0, 0);

    int e = 0;  
    for(int q=0; q < Global.cubes;q++){
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, e, 4);
    e = e+4;
    }
}

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

    float ratio = (float) width / height;
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glFrustumf(-ratio, ratio, -1, 1, 1, 20);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
}

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
    gl.glClearColor(0, 0, 0, 0);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glShadeModel(GL10.GL_SMOOTH);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    cubeBuff = makeFloatBuffer(GLCamTest.array);
    texBuff = makeFloatBuffer(camTexCoords);                
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, cubeBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texBuff);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}
  • 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-15T22:20:43+00:00Added an answer on May 15, 2026 at 10:20 pm

    Try using the points in ‘zigzag order’
    i.e.

    xl,yl
    xl,yh
    xh,yl  // this is hypotenuse of first triangle
    xh,yh  // this is endpoint of last triangle, so previous line is hypotenuse
    

    you are probably getting some kind of two-triangle broken shape.

    you see, the square is made from triangles, and they are drawn in order of the points!

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

Sidebar

Related Questions

The latex file is giving the following error: ! LaTeX Error: File `datetime.sty' not
I am new to c, and the following is giving me some grief: int
I'm not sure why the following is giving me a PatternSyntaxException : Pattern regex
The code below is giving the following error: An expression tree may not contain
Have the following select giving me the data I want, but I want to
Why is the following code giving an exception? function SetText(index, text) { try {
I am unable to uninstall an Assembly (log4net.dll) from GAC. It is giving following
Consider following 2 programs giving same error First calss: public class Testing { Testing
When i am trying to run my program it is giving the following error
I am running valgrind as follows:- /usr/local/bin/valgrind process_name After excecution its giving me following

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.