PDA

View Full Version : What commands shall we use for a vecter array multiplies a matrix?

04-02-2015, 04:46 AM
I have an array of 2lines and 3 columns, and a matrix of 3x3, which were read into gpu mem in way of VAO.
which command shall I use in vertex shader to get their product?
#version 330
in vec3 VertexPosition;
in vec3 VertexColor;
out vec3 Color;

void main()
{
Color =VertexColor;
//gl_Position = vec4(VertexPosition,1);
gl_Position = vec4(dot(VertexPosition,VertexColor),1);
}
I use dot command, but nothing happened, except no color rendering.

Alfonse Reinheart
04-02-2015, 08:17 AM
I don't see any matrix in that code. Also, I'm not sure what you mean by "an array of 2lines and 3 columns." In any case, if you want to multiply a vector with a matrix, you just use *.

04-02-2015, 05:56 PM
I don't see any matrix in that code. Also, I'm not sure what you mean by "an array of 2lines and 3 columns." In any case, if you want to multiply a vector with a matrix, you just use *.
You are not good the answer,1, the dot product will result a value, but the shader requres a vec. 2. if use vex*mat format, can glsl accepts this formula? 3, if the mat includes triangles function, how shll we lead an argument in glsl?

Well, in math, we have an array c,
( x1,y1,z1, x2,y2,z2)
we have a 3x3 matrix A
| a11 a12 a13 |
| a21 a22 a23 |
| a31 a32 a33 |
if we think this c is also a matrix, we can get their product by two matrix multiplied,
c.A = D;

if a?? is a function of cos wt, tan nwt... how shall we transmit the arguements n, w, t at glsl? or in a word, how shall we calculate the complex mat in GPU part?

Dark Photon
04-03-2015, 06:55 PM
You are not good the answer

This doesn't mean what you think it does. Alfonse is trying to help you, and your response (though you might not realize it) verges on being rude.

1, the dot product will result a value, but the shader requres a vec.

You determine what your shaders require. You wrote it to require 2 vectors, so it does. That is not a fundamental requirement of shaders in general.

2. if use vex*mat format, can glsl accepts this formula?

Yes. For instance:

* Uniform (GLSL) (https://www.opengl.org/wiki/Uniform_%28GLSL%29) (OpenGL wiki)
* GLSL Tutorial (http://www.lighthouse3d.com/opengl/glsl/index.php/index.php?minimal) (Lighthouse3D)

Search for "uniform mat4".

3, if the mat includes triangles function, how shll we lead an argument in glsl?

What's a triangles function?

Well, in math, we have an array c,
( x1,y1,z1, x2,y2,z2)
we have a 3x3 matrix A
| a11 a12 a13 |
| a21 a22 a23 |
| a31 a32 a33 |
if we think this c is also a matrix, we can get their product by two matrix multiplied,
c.A = D;

if a?? is a function of cos wt, tan nwt... how shall we transmit the arguements n, w, t at glsl?

However you want. As individual floats, as a vector, a matrix, some other form, or not at all!

You could just compute A on the CPU and pass it to the GPU shader as a "mat3". This is most common. Often times you don't care how the matrix was computed on the CPU. You just need it on the GPU to have it to transform vectors.

or in a word, how shall we calculate the complex mat in GPU part?
First, do you need to compute the matrix components on the GPU? If not, don't. Compute A once on the CPU, and then just pass the matrix to the GPU, for it to use across many vertices.

04-03-2015, 11:32 PM
You are not good the answer This doesn't mean what you think it does. Alfonse is trying to help you, and your response (though you might not realize it) verges on being rude.
.

Eh, what does it mean in English according to the English speaking thinking? well, how to comment a guy in humor, who answered the question, but hit not the point?
I shall use that next if you would put down and avoid making such critical point miatake.

as soon as you don't understand what we said, pls ask, then we can explain further more in order to sync idea.
if readers don't point out, who know where is mistake?

Alfonse Reinheart
04-03-2015, 11:54 PM
Eh, what does it mean in English according to the English speaking thinking?

It doesn't mean anything; according to English grammar rules, it's gibberish. Informally, we can guess that you didn't think the reply was helpful. But that's about all.

well, how to comment a guy in humor, who answered the question, but hit not the point?

If there's a language barrier, it's usually a good idea to not attempt humor. If you don't translate it well, it only creates confusion.

as soon as you don't understand what we said, pls ask, then we can explain further more in order to sync idea.

Here's the problem.

It takes you maybe 3 minutes to compose your question. At some point, we read it, and because it was not clear, we have to take time to ask, "I don't understand what you meant by X." Then you read that and provide clarification. Followed by us asking for more clarification. This continues until it becomes clear what you're actually asking about.

That's a waste of everyone's time, yours and ours alike. Instead, you should try to make your initial post as clear as possible, providing all relevant information and a firm understanding of what you're talking about.

That will require taking more time in writing your posts.

04-03-2015, 11:56 PM
Yes. For instance:That's enough, so simple, why many people can not reply like this? instead of many longer words.

What's a triangles function?
trigonometric function. that's really my mistake, means sin, cos...
as if this were impossible

You could just compute A on the CPU and pass it to the GPU shader as a "mat3". This is most common. Often times you don't care how the matrix was computed on the CPU. You just need it on the GPU to have it to transform vectors.

I can do this on the cpu, but I try to implement it on the gpu for its high speed float calculation. ofcuase, if there would be too many vertices, the efficiency will be low. I get ride of it at present.

04-04-2015, 12:25 AM
It doesn't mean anything; according to English grammar rules, it's gibberish. Informally, we can guess that you didn't think the reply was helpful. But that's about all.

according to grammar? you maybe kidding. You are not good the answer Does it very ambiguous? or differnt meaning to cause rude concept?
enlarge it infinitely?

If there's a language barrier, it's usually a good idea to not attempt humor. If you don't translate it well, it only creates confusion.
Language is an odd thing, once man repeats a good word for three times, you may feeel upset down.
at this forum, we dont know each other, we have no basic interest conflict, why do we speak a rude word?
barrier can be conquered, but if someone wish to mock, or to make a practice joke, that will be another matter.

04-04-2015, 12:43 AM
It takes you maybe 3 minutes to compose your question. At some point, we read it, and because it was not clear, we have to take time to ask, "I don't understand what you meant by X." Then you read that and provide clarification. Followed by us asking for more clarification. This continues until it becomes clear what you're actually asking about.
That's a waste of everyone's time, yours and ours alike. Instead, you should try to make your initial post as clear as possible, providing all relevant information and a firm understanding of what you're talking about.
That will require taking more time in writing your posts.
That's really ridiculous. I couldn't imagine from where you take up this words.
english maybe your mother tongue, I can also find grammar matter in your words. fo cause, sometimes theyare typo, other times you may get use to it without notice that.

I remember said to a guy once, this is free forum, if you would be an enthusiast, you could help other by your capability.
none enforces you to reply this or that. if we don't think you are right, we can argue until we reach a solution.

Where is time-waste? are you sure you understand every words in the forum which is spoken out by english speaking guys?

Alfonse Reinheart
04-04-2015, 09:29 AM
according to grammar? you maybe kidding. You are not good the answer Does it very ambiguous?

Yes, it is ambiguous. You could mean, "Your answer is not good." Or you could mean "I don't think you are a good answerer."

The difference between these two should be obvious.

That's really ridiculous. I couldn't imagine from where you take up this words.
english maybe your mother tongue, I can also find grammar matter in your words. fo cause, sometimes theyare typo, other times you may get use to it without notice that.

Everyone makes mistakes. Making an error in spelling or grammar happens every now and then. But that's not you. For you, it's far harder to find a sentence that's correct than to find one that's incorrect.

Most of your statements are difficult to understand, either due to poor word choice, poor grammar, or just not providing sufficient information to understand what you're talking about. That makes deciphering your posts take longer.

I remember said to a guy once, this is free forum, if you would be an enthusiast, you could help other by your capability.
none enforces you to reply this or that. if we don't think you are right, we can argue until we reach a solution.

Where is time-waste?

The "time-waste" would be the "we can argue until we reach a solution" part. You know, what we're doing right now. That's not productive.

Here's an example of a good question from a non-native English speaker (https://www.opengl.org/discussion_boards/showthread.php/185946-AZDO-Did-not-understand-why-map-unsychronized-can-be-bad). He provides enough information to know what he's talking about in his initial post. He clearly took the time to make sure that his English was reasonably correct. And he attempted to understand the problem on his own before asking us about it, with a handy link to the subject of discussion.

There was no need to have a back-and-forth discussion to discover what he's talking about. Nobody had to ask him for additional information. He asked a good, solid question, and therefore, he could get a good, solid answer (I hope) without people having to spend time asking him to clarify what he's talking about.

That's a productive use of time.

By comparison, here is one of your threads (https://www.opengl.org/discussion_boards/showthread.php/185815-Where-is-shading-statement). It takes 8 posts and a full day of time before it has become clear what you're even asking for. If you'd just asked the question better to begin with, all of that could have been avoided.

Therefore, it was not a productive use of time.

04-04-2015, 08:04 PM
Yes, it is ambiguous. You could mean, "Your answer is not good." Or you could mean "I don't think you are a good answerer."

The difference between these two should be obvious..

Does that make much difference? Linguists couldn't help laughing at hearing of that.

Everyone makes mistakes. Making an error in spelling or grammar happens every now and then. But that's not you. For you, it's far harder to find a sentence that's correct than to find one that's incorrect.

Im glad to hear that, Well, list out. I can show you a ratio in way of statistics. Could you estimate this number?

Most of your statements are difficult to understand, either due to poor word choice, poor grammar, or just not providing sufficient information to understand what you're talking about. That makes deciphering your posts take longer.

Where is time-waste?
The "time-waste" would be the "we can argue until we reach a solution" part. You know, what we're doing right now. That's not productive.
it is surprise where you come from or for what you come here?

By comparison, here is one of your threads. It takes 8 posts and a full day of time before it has become clear what you're even asking for. If you'd just asked the question better to begin with, all of that could have been avoided.
you look like upset, as I have pointed out your defects or pitfall once. I don';t like to offend anyone, though.

Sure, over 800 viewers may explain something. wht are they interested in, what do they want to know could be reflected from such number.

yu maybe an enthusiast, but your words expressing ability can not be appreciated.
you seem not know how to express or describe a solution simply, nag at that beyond topic. partly, it's your limited narrow knowledge. just like some guy, who can only copy or recite book.

Would you like to learn from obfuscator or Photom? who can explain issues just in several lines sentences or several words.

Therefore, it was not a productive use of time.
Have you eaten?
Yes.

This is a productive use of time!!!!!

Alfonse Reinheart
04-04-2015, 09:27 PM
Does that make much difference? Linguists couldn't help laughing at hearing of that.

Are you saying that you can't tell the difference between a comment about what was said and a comment about the person saying it? That in your mind, there's no difference between "That wasn't helpful" and "You're not helpful"?

And that you believe that "linguists" also don't recognize this difference?

it is surprise where you come from or for what you come here?

It's not a surprise; we get people like this here quite a lot. People who refuse to learn and keep taking up people's time with simple matters that they can't be bothered to look up, despite the existence of lots of resources for them.

I'm not surprised by such people anymore; what I am is disappointed.

Sure, over 800 viewers may explain something. wht are they interested in, what do they want to know could be reflected from such number.

Or it's a reflection of the possibility that this forum doesn't distinguish between views by the same person. This is perhaps why it is called "views", rather than "viewers".

yu maybe an enthusiast, but your words expressing ability can not be appreciated.
you seem not know how to express or describe a solution simply

The ability to describe a solution, simply or not, is completely useless in the face of someone who lacks the ability to describe the problem adequately. If you can't explain the problem, nobody can help you find a solution.

Also, it should be noted that you said this earlier: "That's enough, so simple, why many people can not reply like this? instead of many longer words." Even though I told you exactly that in my very first reply: "In any case, if you want to multiply a vector with a matrix, you just use *."

Would you like to learn from obfuscator or Photom? who can explain issues just in several lines sentences or several words.

... I don't know what those are. Neither Google nor Wikipedia was particularly enlightening on either subject.

04-05-2015, 03:27 AM
The ability to describe a solution, simply or not, is completely useless in the face of someone who lacks the ability to describe the problem adequately. If you can't explain the problem, nobody can help you find a solution.

Sure, but you is you, don't represnt anybody. not nobody, sophisticates can do the trick. I often meet such men who are very skillful and can judge what you are thinking by merely a few words. But they are very modest, don't like someone who is pride and prejudice but less skill.

Also, it should be noted that you said this earlier: "That's enough, so simple, why many people can not reply like this? instead of many longer words." Even though I told you exactly that in my very first reply: "In any case, if you want to multiply a vector with a matrix, you just use *."

So itis, that seems to impress on you very much. you can remember solidly your any decent doing, but forget fastly fails, brag glorious triumph, cover weakness sliently.
However, that is not bad answer. I remmeber said once thanks at the time. How about thank once again at present?

... I don't know what those are. Neither Google nor Wikipedia was particularly enlightening on either subject
well, needn't google nor wiki, I shed light on it. they are close to us, one of them maybe a moderator, I guess at present.
Sometimes, even a small calculator can do the trick without gooogle. Of cause, this doesn't strike me as odd. you always prefer complex words to simple one. prefer off topic talking to solid work, prefer gibe to solution.

Alfonse Reinheart
04-05-2015, 06:17 AM
Sure, but you is you, don't represnt anybody. not nobody,

That would be true only if nobody else had commented on your seeming inability to describe problems reasonably. And yet, several people have. So yes, I do appear to "represnt" somebody.

If many people see your posting as a problem, perhaps that's a clue that it is one.

well, needn't google nor wiki, I shed light on it. they are close to us, one of them maybe a moderator, I guess at present.

:doh: Then you meant Photon.

See, this right here is your problem. You failed to even copy&paste a name correctly. Which created confusion, since I didn't know you were talking about people on this forum.

"obfuscator" is actually a word (one who "obfuscates (http://dictionary.reference.com/browse/obfuscate)", "to make obscure or unclear"). And since we were talking about things being "confusing" and "unclear", I thought you were referring to the word itself, not a forum user who just happens to use that as his name (generally speaking, I pay attention to what is said, not who's saying it).

If you had copy/pasted "Dark Photon" correctly, I'd have known that you were talking about people on this forum.

04-05-2015, 06:49 AM
Are you saying that you can't tell the difference between a comment about what was said and a comment about the person saying it? That in your mind, there's no difference between "That wasn't helpful" and "You're not helpful"?

Im afraid I will not use "you" instead of "that". If I would have done like that, that would have been rude.

And that you believe that "linguists" also don't recognize this difference?

I remember there is an absurd proverb, a lie was repeated by three times, it will become true.

It's not a surprise; we get people like this here quite a lot. People who refuse to learn and keep taking up people's time with simple matters that they can't be bothered to look up, despite the existence of lots of resources for them.

I'm not surprised by such people anymore; what I am is disappointed.

What Im surprise at is I meet one like this here quite a few, despite is not the first, nor the last one, Im sure, who
especially like talking about daily routines rather than positive topic. or list out some docs which they might not understand yet what they said or out of date.
or show off its so called Englsih grammar. as if he may be a native engl speaker.
They may waste reader time without consciousness. just a sigh.

Alfonse Reinheart
04-05-2015, 08:48 AM
If you truly believe that your writing represents good English, that your posts have been effective communication, then there's no help that can be provided to you. You can lead a horse to water, but you can't make him drink.

Im afraid I will not use "you" instead of "that". If I would have done like that, that would have been rude.

I see. Accusing a person of being unhelpful is far less rude of accusing a post of being unhelpful. I would make a reference to Bizarro world (https://en.wikipedia.org/wiki/Bizarro_World), but I'm guessing the cultural reference wouldn't translate.

04-05-2015, 08:22 PM
If you truly believe that your writing represents good English, that your posts have been effective communication, then there's no help that can be provided to you.

I havn't yet beeb aware of so far what is good English(you may remark, if you will). Just sense here a smell of powder. As if it diminishes gradually, though.
In fact, there are many tools for effective communication, When I go shopping, or at markets, I saw dealers bargain with each other by body language. rather interesting deal, too. stretch out fingers, three? no. two, nod head. then shock hands. a great deal of business have been done.
English? Chinese? Russian? or French, italian....?

You can lead a horse to water, but you can't make him drink.

I see on film, a herd of horses were drived to a river, they drink without a command of grazier. I conclude that the horse you metioned must be an iron horse that can only drink gasoline rather than water.

I see. Accusing a person of being unhelpful is far less rude of accusing a post of being unhelpful. I would make a reference to Bizarro world (https://en.wikipedia.org/wiki/Bizarro_World), but I'm guessing the cultural reference wouldn't translate.

A spot light can light as more larger area as you imagine, but the intensity will be weaken along distance in way of square inverse ratio.
I see few absurd movies. I believe any culture could be translated. but not any custom could be copied or imitated. a copycat can never understand the connotation. Would you intend to be a copycat?

04-05-2015, 09:09 PM
That would be true only if nobody else had commented on your seeming inability to describe problems reasonably. And yet, several people have. So yes, I do appear to "represnt" somebody.

If many people see your posting as a problem, perhaps that's a clue that it is one.

Not only a clue, but a large mirror, you can hang highly over you head with an enlarger, turn up to 20db.
of cause , you can, you are an E body to warn.

So it is. you can certainly be one, your limited smart brain can recognize all the way the inability, inacceptable description, only you yourself in the world can find one, two, three in zero.Is it zero space or zero state?

since I didn't know you were talking about people on this forum.

"obfuscator" is actually a word (one who "obfuscates (http://dictionary.reference.com/browse/obfuscate)", "to make obscure or unclear"). And since we were talking about things being "confusing" and "unclear", I thought you were referring to the word itself,

You know what? know to find a letter with a magnifier. but find no what you want.

that sounds like you are born in Englsish, often carry a dictionary with you. and can look for any time, anywhere.
what is show off, what is naive, what is trap, what is pride? then arrogant, humble?
What is what? who is who?

04-06-2015, 06:35 PM
If you truly believe that your writing represents good English, that your posts have been effective communication, then there's no help that can be provided to you. You can lead a horse to water, but you can't make him drink.
.
As if you basically make sense of all statements of hard understanding.and put down response and not depart from original intention.

Selient you are at last. Are you mocking by your fellow for endevor of finding E straws arduously. Been beem, beer?

I wonder why you don't take a tenth time on the people you met often, you said here, for correct their incorrect sentences rather than focus 9 tenth on the meaningfulless dispute? This is beyond me.

I take a hatime to argue for you are one a little more cultured than hose red neck who can merely be rude here.
I don't offend anyone.