Advertisement Jump to content
Sign in to follow this  
elektronjunge

OpenGL Color array

This topic is 3856 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!