Jump to content
  • Advertisement
Sign in to follow this  
elektronjunge

OpenGL Color array

This topic is 3694 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 have data stored in an array colors. Is it possible to use this array to render different parts of a rectangle using th colors stored in the array. Thanks in in advance for helping this openGL noob.

Share this post


Link to post
Share on other sites
Advertisement
Im not sure what you mean exactly, what im assuming you mean is you want the colours specified from the array and not drawing the actual vertices.

If your array is similiar to this: float gl_Colour[] = {1.0f, 0.0f, 0.0f, 1.0f};

Just do the following:

glBegin(GL_QUADS)
glColor4fv(&gl_Colour);
glVertex3f(0.5f, 0.5f, 0.5f);
// etc....


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!