On Aug 3, 10:06 pm, Robert Green <[email protected]> wrote:
> Have you tried different values of gl.glLineWidthx()?  0x1 is 1 in
> hex, which, given in fixed converted to float = 0.00001 = super,
> super, super tiny.  I'd start with 65536 (0xffff if you really like
> using hex to represent FP) and see how it does.
>
Yeah, I have since my last post. If I use a very wide line (, it does
show up on the emulator, as a wide (not 1 px) line. On the phone, it
still shows up as a 1px wide line. Go figure.

There is something else fishy on the emulator that hints at an issue
in the transformations - when I do make a huge line, it isn't in the
right place. Instead of having an X in the middle of the screen (among
other things), I have a vertical line that extends from somewhat below
the middle of the screen to the top of the screen.

Code is now:
  public void onDrawFrame(GL10 gl) {
    float fOrthoScale = 1;
    int lineWidth = 0x10000;
    _hgt2width = (float) MyApp._width / MyApp._height;
    gl.glClearColor(0,0,.2f, 1f);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glShadeModel(GL10.GL_FLAT);
    gl.glDisable(GL10.GL_DEPTH_TEST);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
//    gl.glViewport(0, 0, MyApp._width/2, MyApp._height/2);
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    GLU.gluOrtho2D(gl, -_hgt2width*fOrthoScale,
_hgt2width*fOrthoScale, -1*fOrthoScale, 1*fOrthoScale);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
//    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    gl.glEnable(GL10.GL_LINE_SMOOTH);
    gl.glDisableClientState(GL10.GL_COLOR_ARRAY);

    gl.glScalef(1, _hgt2width, 1);
//    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

    float lscale = .002f*MyApp._curScale;

    gl.glPushMatrix();
    gl.glColor4f(1f, 1f, 0f, 1f);
    gl.glTranslatef(.375f, .5f, 0f);
    gl.glRotatef(30, 0, 0, 1);
    gl.glScalef( lscale, lscale, 1f);
    gl.glVertexPointer(2, GL10.GL_FIXED, 0, _lineVertices);
    gl.glLineWidthx(lineWidth);
    drawArrays(gl);
    gl.glPopMatrix();

    gl.glPushMatrix();
    gl.glColor4f(1f, 1f, 1f, 1.0f);
    gl.glScalef( lscale*8, lscale*8, 1f);
    gl.glVertexPointer(2, GL10.GL_FIXED, 0, _lineVertices);
    gl.glLineWidthx(lineWidth);
    drawArrays(gl);
    gl.glPopMatrix();


  }
  void drawArrays(GL10 gl) {
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, 5); //small square
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 5, 5); //medium square
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 10, 5);//large square
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 15, 2);//x axis
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 17, 2);//y axis
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 19, 2);//X half
    gl.glDrawArrays(GL10.GL_LINE_STRIP, 21, 2);//X half
  }

  void makeLines() {
    int hlf = 0x08000;
    int one = 0x10000;
    int sml = one/8;
    int med = one*8;
    int big = 0x10000000;
    Log.d("===jrm", String.format("one:%x   big:%x", one, big));
    int vertices[] = {
       -sml     ,         sml,    //0 start square - scale 1/10
        sml     ,         sml,    //1
        sml     ,        -sml,    //2
       -sml     ,        -sml,    //3
       -sml     ,         sml,    //4

       -one     ,         one,    //5 start square - scale 1
        one     ,         one,    //6
        one     ,        -one,    //7
       -one     ,        -one,    //8
       -one     ,         one,    //9

       -med     ,         med,    //10 start square - scale 10
        med     ,         med,    //11
        med     ,        -med,    //12
       -med     ,        -med,    //13
       -med     ,         med,    //14

       -big     ,           0,    //15 start coord axes over huge area
        big     ,           0,    //16

          0     ,         big,    //17
          0     ,        -big,    //18

       -big     ,        -big,    //19 start X over huge dimensions
        big     ,         big,    //20

       -big     ,         big,    //21
        big     ,        -big,    //22
        med     ,         one     // BUT? Without this line, blows up
if openGL debug is enabled


    };
    this.numLines = vertices.length/2;

    ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);
    vbb.order(ByteOrder.nativeOrder());
    _lineVertices = vbb.asIntBuffer();
    _lineVertices.put(vertices);
    _lineVertices.position(0);
  }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to