Jump to content
  • Advertisement
Sign in to follow this  
guvidu

VBO and lighting

This topic is 4055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there - im trying to render some cubes that are imported via 3ds model class - and im putting the cubes in a VBO - sorry for the long code ( i dont know how to put conde in the message).... When putting lighing in the scene - the scene becomes darker - but no visible light like :P - i think im doing something wrong with the normals - becouse when i change the code from DrawDinamicVBO -(this code: glNormalPointer(GL_FLOAT,0, (char*)NULL); ) to glNormalPointer(GL_FLOAT,0, model.normalvector); i can see the light render but with very many artefacts. I also move the objects in the scene during rendering (not translate - actual moving of the vertex) Thanks! ///////////FUNCTIONS TO CREATE AND RENDER VBO void GL_Game::CreateDYNAMIC_VBO(CModel &model) { for(int i = 0; i<MAX_VERTICES; i++) { g_DiceManager.actorManager.playerCoordinates = model.VertexVector; g_DiceManager.actorManager.DefaultPlayerCoordinates = model.VertexVector; } //Vertex glGenBuffersARB(1, &model.playerVBuffer); glBindBufferARB(GL_ARRAY_BUFFER_ARB, model.playerVBuffer); glBufferDataARB(GL_ARRAY_BUFFER_ARB, model.k*3*sizeof(float), g_DiceManager.actorManager.playerCoordinates, GL_STREAM_DRAW_ARB); //Texture glGenBuffersARB(1, &model.playerTBuffer); glBindBufferARB(GL_ARRAY_BUFFER_ARB, model.playerTBuffer); glBufferDataARB(GL_ARRAY_BUFFER_ARB, model.k*2*sizeof(float), model.TextureVector, GL_STATIC_DRAW_ARB); //Normal glGenBuffersARB(1, &model.playerNBuffer); glBindBufferARB(GL_ARRAY_BUFFER_ARB, model.playerNBuffer); glBufferDataARB(GL_ARRAY_BUFFER_ARB, model.k*3*sizeof(float), model.NormalsVector, GL_STREAM_DRAW_ARB); } void GL_Game::DrawDYNAMIC_VBO(CModel& model) { glBindTexture(GL_TEXTURE_2D, model.texID); glBindBufferARB(GL_ARRAY_BUFFER_ARB, model.playerVBuffer); glBufferDataARB(GL_ARRAY_BUFFER_ARB, model.k*3*sizeof(float), g_DiceManager.actorManager.playerCoordinates, GL_STREAM_DRAW_ARB); glVertexPointer(3,GL_FLOAT,0,(char*)NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, model.playerNBuffer); glNormalPointer(GL_FLOAT,0, (char*)NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, model.playerTBuffer); glTexCoordPointer(2, GL_FLOAT, 0, (char *) NULL ); glDrawArrays(RENDER_MODE,0, model.k); }

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!