Jump to content
  • Advertisement
test opty

OpenGL At the start of learning the terms of OpenGL

Recommended Posts

Hi,

Please read the Linking Vertex Attributes section of this page. I've read the term a vertex attribute many times in this page but I'm not sure what it means for real or what the author meant by that.
If possible please tell me the exact meaning the author meant by vertex attributes.

Share this post


Link to post
Share on other sites
Advertisement
1 hour ago, test opty said:

If possible please tell me the exact meaning the author meant by vertex attributes.

It's not the author meaning. It is OpenGL meaning.

This is old but hopefully will explain you what a vertex attribute is. If this is not clear after, don't hesitate to ask again.

Share this post


Link to post
Share on other sites
2 hours ago, test opty said:

Hi,

Please read the Linking Vertex Attributes section of this page. I've read the term a vertex attribute many times in this page but I'm not sure what it means for real or what the author meant by that.
If possible please tell me the exact meaning the author meant by vertex attributes.

Attributes basically is the data that describes that vertex, for example position of the vertex is a vec3 and it's an attribute of the vertex.  color of the vertex is an attribute of that vertex.  normal of the vertex for lighting is an attribute of the vertex.  tex coordinates are attributes of the vertex.

 

basically attributes are the components that describes the vertex.

Share this post


Link to post
Share on other sites

Thanks to both of you. 

I found that some specifications like colours and lighting are attributes of the vertex shader and we can have attributes only for the vertex shader. 

But to be more specifier, what are all the vertex attributes existing when the link finishes rendering the triangle, please?

Here is also the source code of that page for the rectangle. 

What are those attributes there, please copy and paste them here. 

Edited by test opty

Share this post


Link to post
Share on other sites
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);

This says attribute 0 (first value) takes 3 GL_FLOAT's per call.  They're not normalized (GL_FALSE) and the stride size is "3 * sizeof(float)", so 12 bytes (how far to move in the linked buffer).  The final parameter in this case is not used.  Honestly I prefer http://docs.gl website as it typically has example code at the bottom and links to tutorial sites for more information:  http://docs.gl/gl4/glVertexAttribPointer

Share this post


Link to post
Share on other sites
12 hours ago, test opty said:

what are all the vertex attributes existing when the link finishes rendering the triangle

Vertex attributes are generic. You can give whatever meaning to each of them. Common ones are the vertex itself, its normal, its color, its texture coordinates, its tangent and or binormal. Often there can also have a weight, a transformation matrix (or quaternion or set of vectors). You can also think of adding materials...

Before shaders, OpenGL already had vertex attributes (as shown in the link from my previous post). These were the common vertex ,normal, texture coordinate(s), color(s).

So vertex attributes are all what you give the vertex shader to eat that go along with a vertex.

Share this post


Link to post
Share on other sites
On 12/19/2017 at 11:34 AM, _Silence_ said:

So vertex attributes are all what you give the vertex shader to eat that go along with a vertex.

Thank you. What about my program. Do you too agree that the "only" attributes that program has are the vertexes, that is, these floating point numbers:

        -0.5f, -0.5f, 0.0f,   // Vertex/Position 1
         0.5f, -0.5f, 0.0f,  // Vertex/Position 2
         0.0f,  0.5f, 0.0f  // Vertex/Position 3

?

Edited by test opty

Share this post


Link to post
Share on other sites

Yes.  I provided you with other tutorials to learn from along with a good docs site.  You're looking at the most basic of OpenGL programs and obsessing over the most trivial function for it.  Write more programs using it, best way to learn honestly.  Break things and figure out how to fix them, great experience.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!