×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    217

    how to draw a cube on viewfinder by opengl es ?

    hi all

    does this possible ?

    from camera example , i want to draw a cube on viewfinder , how to do ?

    plz help.

    thanks.

  2. #2
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    217

    Re: how to draw a cube on viewfinder by opengl es ?

    I try this code snip :

    static const GLbyte vertices1[8*2] = { 0,100, 100,0, 0,-100,
    -100,0, 0,50, 45,20, -45,20 };
    static const GLbyte vertices2[7*4] = { 0,0,255,255, 0,255,0,255,
    255,0,0,255, 255,255,255,255, 255,0,255,255, 255,255,0,255,
    0,255,255,255 };
    static const GLushort indices[9] = { 0,3,1, 1,3,2, 4,6,5 };
    glEnableClientState( GL_VERTEX_ARRAY );
    glColor4ub( 255, 0, 0, 255 ); //glColor4ub undeclared, how to do ?
    glVertexPointer( 2, GL_BYTE, 0, vertices1 );
    /* skip vertex 0, draw five triangles */
    glDrawArrays( GL_TRIANGLE_STRIP, 1, 7 );
    glVertexPointer( 2, GL_BYTE, 0, vertices2 );
    /* draw three triangles, using the first seven vertices */
    glDrawElements( GL_TRIANGLES, 9, GL_UNSIGNED_SHORT, indices );

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,675

    Re: how to draw a cube on viewfinder by opengl es ?

    glColor4ub is present in gl.h, so re-check if you get some other error messages too.

  4. #4
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    217

    Re: how to draw a cube on viewfinder by opengl es ?

    also try this code,

    bitmap has content, but not thing happen.

    how to draw ?

    thanks.

    /* Enable back face culling, texturing, and normalization. */
    glEnable( GL_TEXTURE_2D );
    /***an appropriate texture matrix has to be initialized*/
    glMatrixMode( GL_TEXTURE );
    glLoadIdentity();
    glScalef( 1.f / 128.f, 1.f / 128.f, 1.f );
    glTranslatef( 128.f, 128.f, 0.f );
    glMatrixMode( GL_MODELVIEW );
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );
    // select our current texture[/COLOR]

    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, aRect.Width(), aRect.Height(),
    0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)iBitmap->DataAddress() );
    /**************Texture environment parameters are set using glTexEnvf().*/
    glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,/*GL_REPLACE */GL_DECAL);
    // if wrap is true, the texture wraps over at the edges (repeat)
    // ... false, the texture ends at the edges (clamp)
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,EFalse ? GL_REPEAT : GL_CLAMP_TO_EDGE );
    Last edited by nokia_lin; 2009-06-11 at 04:52.

Similar Threads

  1. about opengl es
    By freesui1984 in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2008-07-24, 03:03
  2. Draw two faces of a Polygon in OpenGL ES!!
    By abolfoooud in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2008-05-13, 21:51
  3. Draw full screen viewfinder with OpenGL ES, but tearing
    By fishman8 in forum Symbian Media (Closed)
    Replies: 18
    Last Post: 2008-02-01, 13:38
  4. Possible OpenGL ES implementation bug
    By greatape in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-10-28, 18:02
  5. running OpenGL ES in N93
    By derBertl in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-10-10, 14:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×