Jump to content
  • Advertisement
Sign in to follow this  
MaimaVanPersie

OpenGL How to draw player? (Need guidance)

This topic is 486 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 everyone, I am new here. I am trying to make a game in C++ and OpenGL, I have drawn a background and now I want to draw a player object (just a triangle or small quad for now) in front of the background.

 

This is how I drew my background:

 

GLfloat BackGround[] =
{
// Positions         // Texture Coords 
1.0f,  1.0f, 0.0f,  0.0f, 0.0f, // Top Left     
1.0f, -1.0f, 0.0f,  0.0f, 1.0f, // Bottom Left   
-1.0f, -1.0f, 0.0f,  1.0f, 1.0f, // Bottom Right 
-1.0f,  1.0f, 0.0f,  1.0f, 0.0f  // Top Right 
};

But now how do I go about drawing a player? Do I generate a new VBO and EBO and memory location in my shaders for the player? 

 

Thanks. 

 

Share this post


Link to post
Share on other sites
Advertisement

Yes you need to create an own VBO/VAO for each kind of mesh you want to render (until you batch several meshes together) but you dont need a new shader location because each mesh will be processed with the same shader when you do not switch them between

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!