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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:10:21+00:00 2026-05-20T02:10:21+00:00

I am drawing a line in opengl es from the Android NDK. I have

  • 0

I am drawing a line in opengl es from the Android NDK. I have been developing on the VM’s and just recently tried my application on a phone. The application runs fine on the vm’s. A line is drawn. However, on a motorola droid, the application just crashes, and on a HTC incredible it just shows a black screen. I have verified that the number being passed to the function are correct. The application haults on the glDrawArray(GL_LINES, 0, 2) call. The whole function looks like this:

void drawLine(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat * color)
{
    GLfloat vVertices[] =
    {x1, y1,
    x2, y2};

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glColor4f(color[0],color[1],color[2],color[3]);
    glVertexPointer(2, GL_FLOAT, 0, vVertices);

    glDrawArrays(GL_LINES, 0, 2);
    __android_log_write(ANDROID_LOG_ERROR,"to mama","You drew arrays");

    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);
}

and the call to it looks like this:

drawLine(0.0f,0.0f,1.0f,0.0f,colorx);/*x is green*/

I can try drawelements next, but there is not reason draw arrays should not work (as far as i know).

  • 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-20T02:10:22+00:00Added an answer on May 20, 2026 at 2:10 am

    You’re enabling the color array (glEnableClientState(GL_COLOR_ARRAY)) without actually setting setting the glColorPointer().

    Either set the color pointer or don’t enable the color array.

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

Sidebar

Related Questions

I have integrated drawing a line in my application. I have not used OpenGl
I have a somewhat complex data model in my iPad application (an OpenGL drawing
I'm drawing a line using OpenGL on the iPhone. I used GLView and GLKView
I am drawing a cube and a line grid in 3D in OpenGL: glBegin(GL_QUADS);
I'm developing a line drawing game, similar to Flight Control, Harbor Master, and others
I have this line of code: System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon); A few lines later,
I am using OpenGL/GLUT to implement Bresenham's line drawing algorithm and having some issues
In the context of a Java/OpenGL application I am drawing a black wired only
I have a problem when rendering cubes in OpenGL.I am drawing two cubes, one
I'm working on a simple drawing application. My line is constructed using polygons and

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.