Strange behavior of glVertexAttrib3f on one machine
I have a very weird problem with my simple OpenGL application not working
on my girlfriend's machine. At first I thought of all kinds of problems
with my code, but I could finally break it down to this code not working
(not working means: the triangle is drawn correctly, but black, that is,
without the correct color):
http://pastebin.com/YbEca49E
As far as I could figure it out, the problem only occurs because of the
following: on her machine, posAttrib = 1, colAttrib = 0, while on mine it
is the other way round. I tried using
layout(location = 0) in vec3 position;
layout(location = 1) in vec3 color;
and then it works fine! Although once I exchange these numbers (I have yet
to test it with other values and #version 330 core\n, but her laptop is
offline at the moment), it stops working again...
I even found the following unanswered question here on SO, which seems
very closely related.
Did anyone of you encounter a similar behavior, or knows how to fix the
whole situation without having to use layout(location = x)? Since I think
in a larger project, setting every location by hand could be tedious or
unwanted (correct me if I'm wrong there and this is actually the preferred
way to do it!).
Yet to test: other values than 0 or 1, and the #version stuff, since on my
machine I can't even use layout(location = x) without #version 330 core
(which is again strange, because it apparently does something on her
machine which makes it work).
I'm a newbie at OpenGL and thus totally confused here! :-)
No comments:
Post a Comment