Vertex are stored where ?

View previous topic View next topic Go down

Vertex are stored where ?

Post  goldfrapp0x0309 on Sun Mar 15, 2009 9:33 pm

I need to modify the mesh's vertexes (coloring, order etc)... Does anyone know where they can be accessed ?


Thanks
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: Vertex are stored where ?

Post  sio2interactive on Sun Mar 15, 2009 11:22 pm

_SIO2object->buf = ( unsigned char * ) sio2MapBuffer( _SIO2object->vbo, GL_ARRAY_BUFFER );

// Mess around with the buffer here...

// When you're done...
_SIO2object->buf = ( unsigned char * ) sio2UnmapBuffer( GL_ARRAY_BUFFER );

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Thanks !

Post  goldfrapp0x0309 on Mon Mar 16, 2009 3:18 pm

Yippie !

So just to get to know vbo's: How are they used and implemented. (direct me to an article ?) Any docs or pointers to how SIO2 implements them.

sio2MapBuffer( _SIO2object->vbo, GL_ARRAY_BUFFER ); //This function requests the vertex buffer from the vbo (i presume)


I presume the engine stores more than just vertices in there (textures, normals etc )

Thanks
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: Vertex are stored where ?

Post  sio2interactive on Mon Mar 16, 2009 4:34 pm

Check the fileformat_specification.pdf in the /docs directory.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

VBOs

Post  goldfrapp0x0309 on Tue Mar 17, 2009 7:50 pm

Sorry for the slowness but how do i access the vertices...

This is what i tried, but i guess i should be referring to vbo offsets... ? (help)
Code:

inmesh->buf = ( unsigned char * ) sio2MapBuffer( inmesh->vbo, GL_ARRAY_BUFFER );
   unsigned char* ptr = inmesh->buf;
   while(*ptr =! NULL)
   {
            ptr++;
            ......
   }
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: Vertex are stored where ?

Post  sio2interactive on Tue Mar 17, 2009 8:12 pm

Take a look at sio2PhysicAddRigidBody:


Code:



         unsigned int n_vert = sio2ObjectGetNumVert( tmp );
            
         btVector3 vert;
      
         btConvexHullShape *_btConvexHullShape = new btConvexHullShape();

         while( i != n_vert )
         {
            memcpy( &v, &tmp->buf[ i * 12 ], 12 );
            
            vert.setValue( v[ 0 ],
                       v[ 1 ],
                       v[ 2 ] );
            
            _btConvexHullShape->addPoint( vert );
         
            ++i;
         }


_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Vertex are stored where ?

Post  goldfrapp0x0309 on Wed Mar 18, 2009 12:09 am

I can't make modification directly to object->buf.... How do i resend back the data to opengl ?
Thanks
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: Vertex are stored where ?

Post  sio2interactive on Wed Mar 18, 2009 1:55 am

Just unmap the buffer Wink that's all the modifications will be taken in consideration... that's how the softbody implementation and animation system works Wink

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Normals

Post  goldfrapp0x0309 on Tue Mar 31, 2009 1:14 am

Back again, this time for normals:

How about for normals, couldn't find them for suzanne example (i'm probably searching wrong place)?

How are they organized in the vbo buffer ?

Whats the role of struct vertex group (purely material/texture?)?

Thanks
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: Vertex are stored where ?

Post  sio2interactive on Tue Mar 31, 2009 2:57 am

Make sure that you export them: NO on the exporter...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

??

Post  goldfrapp0x0309 on Tue Mar 31, 2009 4:26 pm

Ok,

Normals in the buf, are they triangle or vertex normals ?

Thanks
avatar
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

View user profile

Back to top Go down

Re: Vertex are stored where ?

Post  sio2interactive on Tue Mar 31, 2009 5:28 pm

You mean face normals or vertex normals? Well they are the exact same type of normals that you set in blender (solid or smooth = face or vertex). Check tutorial08, part of the sphere is vertex normals and the others are face normals...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Vertex are stored where ?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum