Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Problem with a sphere

  1. #1
    Member
    Join Date
    May 2005
    Location
    Italy
    Posts
    36

    Problem with a sphere

    Hi to all!
    I've made a sphere to import in my Symbian app, but I've this problem: if I made a sphere with less than 20 slices and 20 stacks is all ok, but if I make it with more slices and stacks it's wrong drawed! I've tryed to made it with milkshape 3d and 3d studio max but it's the same thing, is a problem of the API of what?
    Thanks for your support!

  2. #2
    Junior Member
    Join Date
    Jun 2005
    Posts
    8
    Hi Giacomo,

    No, there's nothing in the API that restricts you from drawing 800 TRIangles, or 400 QUADs, and OpenGL ES can't render quads. It must be somewhere else.

    - 43rp

  3. #3
    Member
    Join Date
    May 2005
    Location
    Italy
    Posts
    36
    Hi!
    Very strange...I've tryed to make a lot of sphere with milkshape and 3d studio but there's the same error! why under 20 segments the sphere is corretly drawed? I export the model in the same way!

  4. #4
    Junior Member
    Join Date
    Jun 2005
    Posts
    8
    Hi, I'm telling you, man, there's no such restriction in the spec. The reason might be that you are using bytes as indices, and when you're generating the indices to your vertices, you run out of unsigned_byte range after 15*15 or so. Change it to GL_SHORT.

  5. #5
    Member
    Join Date
    May 2005
    Location
    Italy
    Posts
    36
    I've changed in GL_SHORT but now my model is not drawed!

  6. #6
    Junior Member
    Join Date
    Jun 2005
    Posts
    8
    ok, did you remember to change the C++ datatype also?

  7. #7
    Member
    Join Date
    May 2005
    Location
    Italy
    Posts
    36
    Yes:
    glDrawElements(GL_TRIANGLES,612*3,GL_SHORT,obj1_in dices);

  8. #8
    Junior Member
    Join Date
    Jun 2005
    Posts
    8
    yep, I know. Did you change the type of obj1_indices? I mean, you must change them to GLshort.

  9. #9
    Member
    Join Date
    May 2005
    Location
    Italy
    Posts
    36
    Yes I've also changed the type:
    static const GLshort obj1_indices[] = {
    0, 1, 2,
    3, 4, 5, and so on...

    and for draw:

    Code :
    void CTexture::DrawObj1(TInt aFrame,TInt dirx,TInt diry,TInt dirz)
    {
     
    	glLoadIdentity();
    	glTranslatef(dirx,diry,dirz);
    	glRotatex( aFrame << 16,1<<16,0,0);
    	glRotatex( aFrame << 16,0,0,1<<16);
    	glScalex( 26 << 11, 26 << 11, 26 << 11);
     
    	glEnable(GL_TEXTURE_2D);
    	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);  
        glBindTexture(  GL_TEXTURE_2D, iNokTexObjects[5] );
    	glVertexPointer(   3, GL_FLOAT, 0, obj1_vertices);
        glTexCoordPointer( 2, GL_FLOAT	, 0, obj1_uv);
    	glNormalPointer(   GL_BYTE, 0, obj1_normal);
        glDrawElements(GL_TRIANGLES,612*3,GL_SHORT,obj1_indices);
    	glDisable(GL_TEXTURE_2D);
    	counter+=612;
    }

  10. #10
    Junior Member
    Join Date
    Jun 2005
    Posts
    8
    Does the program you use to convert the Milkshape / 3DS format to C arrays do a cast on the data?

Page 1 of 2 12 LastLast

Similar Threads

  1. OpenGL es sphere tutorial
    By grebwed in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 05-09-2012, 10:55 PM
  2. How to make textures mapping to sphere..
    By shellee in forum OpenGL ES general technical discussions
    Replies: 8
    Last Post: 10-27-2004, 07:38 PM

Posting Permissions

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