We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How do I even start researching on OpenGL Color Animation?

Hi there,

I'm sorry if this is a vague question, but I've just been assigned to create a color animation project with GLSL, and I've never really used it before. The criteria for the assignment is that the animation should depend on object coordinates, vary over time
and should use shaders and GLSL. Basically, we make an object and the colors change on its surface. In no way am I asking on what the code is like or anything, but do you have any suggestions on where to look to start researching on how to do it? Or theoretical steps to designing this program? I don't even really know much of where to start with this. :(

Thanks for your help!

4
Contributors
6
Replies
5 Days
Discussion Span
1 Year Ago
Last Updated
7
Views
Question
Answered
dark_sider_1
Light Poster
29 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I've never used GLSL but a simple search using Google came up with the 3 websites I use when using plain old OpenGL. Seems as good a place as any.

Lerner
Nearly a Posting Maven
2,408 posts since Jul 2005
Reputation Points: 739
Solved Threads: 406
Skill Endorsements: 9
BobS0327
Junior Poster
185 posts since Feb 2008
Reputation Points: 35
Solved Threads: 24
Skill Endorsements: 0

You also should take a look at Shader Designer. This is an IDE for GLSL, I've used it in the past when I played around with shaders, it's pretty nice and easy. I think it also provides base codes to start from.

mike_2000_17
21st Century Viking
Moderator
3,167 posts since Jul 2010
Reputation Points: 2,082
Solved Threads: 637
Skill Endorsements: 42

Awesome, thanks so much for the links and suggestions! What kind of design am I looking for? I first use a shader to create a texture, correct? And then I have it change colors based on a certain time? How would I deal with coordinates?

dark_sider_1
Light Poster
29 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I first use a shader to create a texture, correct?

No. Shaders are used to transform texture(s), at least, fragment shaders do that. Shaders are basically small programs that run on the GPU. A vertex shader is a small program that runs for each vertex (point in a 3D mesh) that you render, and its job is to apply whatever transformations are necessary to prepare it to be rendered on the screen (these transformations include projecting it into a point on the screen, and other things like computing its texture coordinates, applying a bump-map to it, or even animating the vertex). After vertices are projected to a place on the screen, the OpenGL pipeline generates a number of pixels on those surfaces that should appear on the screen. The fragment shader is a small program that takes each pixel (or fragment) and performs a final transformation of the values associated to the pixel, that can include applying lighting, blending the pixel color coming from different textures, and possibly generating colors too, even animating them, and I think that's what you are asked to do.

And then I have it change colors based on a certain time?

Yes, shaders have a number of inputs, some that are fixed by OpenGL, and some that you can customize. You can use Uniforms (see glUniform) which are like constant parameters, and Attibutes (see glVertexAttrib) which are per-vertex values. The inputs that are fixed by OpenGL include the coordinate of the pixel on the screen and its depth, the color value, the texture coordinates, the textures themselves, and some other things. The job of the fragment shader is to take all or any of that and produce a color value to be put on the screen, and you can produce that color value any way you like, including as a function of time, including a blend of textures, etc.

How would I deal with coordinates?

You get them as inputs to the shader program. OpenGL takes care of it for you, all you have to worry about is how to use the coordinates to affect the pixel color, if that's something you want to do.

mike_2000_17
21st Century Viking
Moderator
3,167 posts since Jul 2010
Reputation Points: 2,082
Solved Threads: 637
Skill Endorsements: 42

Great, thank you for all of your help, mike_2000_17! Let's hope I can get this project figured out...

dark_sider_1
Light Poster
29 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by mike_2000_17, Lerner and BobS0327

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0906 seconds using 2.74MB