Jump to content
  • Advertisement
Sign in to follow this  
fathom88

Question Regarding Meshes

This topic is 4839 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

I'm drawing a complex mesh. It requires tons of vertices. The mesh itself is constant (ie vertices don't change). However, the colors I draw with the mesh do change. I thought about using array vertex and array color state. I would update my color state array as needed and otherwise use the same vertex array. Is there a better way of doing this? I guess putting the vertex array into a VBO would help. What about mip mapping or nurbs? I've only glanced over these topics and I'm not sure if they'll help me. I want to get some feed back before investigating further. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
how are the colors distributed? is there one for the entire mesh or do different sections have different colors? there are several good approaches, but you need to be more in depth or list a simular effect before i can offer anything but shots in the dark.

Share this post


Link to post
Share on other sites
I need to basically draw a 2D grid (ie like graph paper or a chess board). Each box in the grid has its own color (they can all be different in extreme cases). Although some areas may have the same color, I cannot always depend on this. Hence, I assume each box is a unique color. Currently, I enable the vertex array pointer and the color array pointer. I define both arrays before hand. Then I draw using the glDrawElements with GL_QUADS. I update the color array as needed and point to it with glColorPointer. Thanks. Hope this clears it up. My app works, but I'm looking for a better way.

Share this post


Link to post
Share on other sites
Quote:
Original post by fathom88
I'm drawing a complex mesh. It requires tons of vertices. The mesh itself is constant (ie vertices don't change). However, the colors I draw with the mesh do change. I thought about using array vertex and array color state. I would update my color state array as needed and otherwise use the same vertex array. Is there a better way of doing this? I guess putting the vertex array into a VBO would help. What about mip mapping or nurbs? I've only glanced over these topics and I'm not sure if they'll help me. I want to get some feed back before investigating further. Thanks.
Mipmapping and NURBS won't help you with this.

Definitely go the VBO route. Use a dynamic VBO for the colors and just update when they need to change; use a static VBO for everything else. If it really does require huge amounts of vertices, you may be better off splitting those into a few different VBOs.

Share this post


Link to post
Share on other sites
Thanks. Here's a silly question regarding VBO's. I'd like to check if the video card supports VBO and set a flag. I think I can use glGetString (GL_EXTENSIONS) but what's the phrase that I should search for that indicates it supports VBO. Maybe glGetString is the wrong command. I'm not sure. Thanks again for the help.

Share this post


Link to post
Share on other sites
Quote:
Original post by fathom88
Thanks. Here's a silly question regarding VBO's. I'd like to check if the video card supports VBO and set a flag. I think I can use glGetString (GL_EXTENSIONS) but what's the phrase that I should search for that indicates it supports VBO. Maybe glGetString is the wrong command. I'm not sure. Thanks again for the help.
Yes, use that to search for any supported extension. The VBO extension name is GL_ARB_vertex_buffer_object. You should seriously consider using GLee or GLEW (links in the GL Forum FAQ) because it makes it so much easier to use extensions. Not that it's really "hard" to begin with, it's just tedious so using one of those is much nicer.

Here is the VBO spec, which has all you need to know (and examples at the bottom) to start using VBOs. If you have any more questions, search these forums (VBO posts seem to pop up every week or so) or post a question if you can't find the answer.

Good luck

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!