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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:51:18+00:00 2026-05-28T16:51:18+00:00

UPDATE2: Tried rendering just a quad. UPDATE: The FULL code is here. Somebody can

  • 0

UPDATE2: Tried rendering just a quad. FAIL!

UPDATE: The FULL code is here. Somebody can please confirm any problem with my code? http://dl.dropbox.com/u/8489109/HelloAndroid.7z

I’ve been trying to draw a circle with Opengl ES 1.0. I’ve used a lot of SDL and OpenGL on the Windows platform and been using mostly glBegin and glEnd because of the low polygon count that my games used.

Pasted down is my code that is called when the object is created.

    float ini[]=new float[360*3];
    ByteBuffer temp=ByteBuffer.allocateDirect(ini.length*4);
    temp.order(ByteOrder.nativeOrder());
    vertex=temp.asFloatBuffer();
    int i;
    float D2R=(float) (3.14159265/180);
    for (i=0;i<360;i++){
        float XX=(float)(Math.sin(i*D2R)*size);
        float YY=(float)(Math.cos(i*D2R)*size);
        ini[i*2]=XX;
        ini[i*2+1]=YY;
        ini[i*2+2]=0;
    }
    vertex.put(ini);
    Log.d("GAME","SPAWNED NEW OBJECT");
    length=ini.length;
    //vertex=ByteBuffer.allocateDirect(temp.length*4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    //vertex.put(temp);
    vertex.position(0);

Now here is the draw code

Log.d("OBJECT","DUH WRITE");
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glPushMatrix();
gl.glTranslatef((float)x,(float)y,0);
gl.glVertexPointer(3, GL10.GL_FLOAT,0, vertex);
gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, length);
gl.glPopMatrix();
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

It draws a circle (when it actually decides to run), and adds some wierd lines.
An example here:
enter image description here

It’s the fault of?

gl.glMatrixMode(gl.GL_PROJECTION);
gl.glLoadIdentity();
gl.glViewport(0, 0, arg1, arg2);
gl.glOrthof(0,(float)arg1,(float)arg2,0,-1,1);
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glLoadIdentity();
  • 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-28T16:51:19+00:00Added an answer on May 28, 2026 at 4:51 pm

    This doesn’t make sense:

    float ini[]=new float[360*3];
    /* ... */
    for (i=0;i<360;i++){
        float XX=(float)(Math.sin(i*D2R)*size);
        float YY=(float)(Math.cos(i*D2R)*size);
        ini[i*2]=XX;
        ini[i*2+1]=YY;
        ini[i*2+2]=0;
    }
    

    You allocate a multiple of 3 elements, but multiply with a stride of 2. Either do

    float ini[]=new float[360*2];
    /* ... */
    for (i=0;i<360;i++){
        float XX=(float)(Math.sin(i*D2R)*size);
        float YY=(float)(Math.cos(i*D2R)*size);
        ini[i*2]=XX;
        ini[i*2+1]=YY;
    }
    /* ... */
    gl.glVertexPointer(2, GL10.GL_FLOAT,0, vertex);
    

    or

    float ini[]=new float[360*3];
    /* ... */
    for (i=0;i<360;i++){
        float XX=(float)(Math.sin(i*D2R)*size);
        float YY=(float)(Math.cos(i*D2R)*size);
        ini[i*3]=XX;
        ini[i*3+1]=YY;
        ini[i*3+2]=0;
    /*        ^         */
    /*        ^         */
    }
    /* ... */
    gl.glVertexPointer(3, GL10.GL_FLOAT,0, vertex);
    

    Also you’re using glDrawArrays wrong. You don’t use the length of the array in bytes, but the count of vertices to draw – 360 in your case.

    gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 360);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: I tried implementing the method specified by Peter and am getting incorrect shadowing.
UPDATE I tried using the internal wordpress rewrite. What I have to do is
One update: I tried using the SummaryRow on the datagrid for its basic functionalities
I tried to update some part of a matrix, I got the following error
Our proxy went down and I tried to update dependencies with Maven while it
I downloaded a pre-release version of the iPhone SDK and tried to update one
Hey, I've tried to update jQuery to its latest version on a system I'm
UPDATE As I've tried to get MEF working throughout my application, I'm coming across
UPDATE 3: I created a Visual Studio 2008 test project and tried to create
Has anyone tried out working with the Delete and update command of SPDataSource used

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.