forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

pspgl - VBO problems

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Kojima



Joined: 26 Jun 2006
Posts: 275

PostPosted: Wed Jul 26, 2006 4:05 am    Post subject: pspgl - VBO problems Reply with quote

I'm trying to write a vbo visualizer for raptor, but for some reason it crashes everytime I try to upload the texcoord's. The initial vertex buffer send works fine, so I'm not sure what could be causing it.

Here's the code. it crashes right after I log "Sending uv data". No error screen, just a blank screen for 20 seconds followed by an automatic power-down.

Code:

class VL_VertexBufferObject : public Visualizer
{
public:
   virtual Visualizer * RequestNew()
   {
      return (Visualizer *) new VL_VertexBufferObject;
   }
   virtual void CreateResources()
   {
      Logger->Log("Creating VBO resources.\n");
      glGenBuffersARB( 1, &_vbuf );
      glGenBuffersARB( 1, &_tbuf );
      glGenBuffersARB( 1, &_uvbuf );
      Logger->Log("Created.\n");
   }
   
   virtual void SyncData()
   {
      Logger->Log("Syncing data.\n");
      glBindBufferARB( GL_ARRAY_BUFFER_ARB, _vbuf );   
      Logger->Log("Sending data.\n");
      glBufferDataARB( GL_ARRAY_BUFFER_ARB, _vertc*3*sizeof(float), (void *)_verts, GL_STATIC_DRAW_ARB );
      Logger->Log("Sent.\n");   
      _mat->_texs.start();
      int stage = 0;
      while( _mat->_texs.next() == true )
      {
         if( stage == 0 )
         {
            Texture *tex = _mat->_texs.get();
            Logger->Log("Binding uvbuf\n");
            glBindBufferARB( GL_ARRAY_BUFFER_ARB,_uvbuf );   
            Logger->Log("Bound.\n");
            Logger->Log("Sending uv data.\n");
            glBufferDataARB( GL_ARRAY_BUFFER_ARB, _vertc*3*sizeof(float),(void *)_coords[tex->_coordset]->_uv, GL_STATIC_DRAW_ARB );
            Logger->Log("Sent.\n");
         }
         stage++;
      }      
      Logger->Log("Synced.\n");
   }
   
   virtual void Bind()
   {
      Logger->Log("Binding VBO\n");
      glEnableClientState( GL_VERTEX_ARRAY );   
      glEnableClientState(GL_TEXTURE_COORD_ARRAY);
                  
      glBindBufferARB( GL_ARRAY_BUFFER_ARB, _vbuf );
      glVertexPointer( 3,GL_FLOAT,0,(char *)NULL);
      glBindBufferARB( GL_ARRAY_BUFFER_ARB, _vbuf );
      glTexCoordPointer( 3,GL_FLOAT,0,(char *)NULL);
      Logger->Log("Bound.\n");
   }
   
   virtual void Unbind()
   {
      Logger->Log("Unbinding.\n");
      glDisableClientState( GL_VERTEX_ARRAY );   
      glDisableClientState(GL_TEXTURE_COORD_ARRAY);
      Logger->Log("Unbound.\n");   
   }
   virtual void Render()
   {
      Logger->Log("Rendering VBO \n");
      glDrawElements(GL_TRIANGLES,_tric*3,GL_UNSIGNED_INT,_tris);
      Logger->Log("Rendered.\n");
   }
   GLuint _vbuf;
   GLuint _tbuf;
   GLuint _uvbuf;
};



Here's the logger output.

Code:

System Logger
Loaded texture.back1.bmp
Loaded jpg star1.jpg
Loading b3d ship1.b3d
Tag=BB3D
BB3DTex File:HopperUV.tif
Loaded texture.HopperUV.tif
Loaded.
Loadb3d returned valid entity.
Loaded texture.fnt1.bmp
Entities:2
Got Entity.
Creating VBO resources.
Created.
Syncing data.
Sending data.
Sent.
Binding uvbuf
Bound.
Sending uv data.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group