- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello. I'm developing a game using OpenGL, but my GLSL skinning vertex shader isn't compiling. I'm doing a mat4x3 * vec4 multiplication, but the GLSL compiler is insisting that this yields a vec4, while it actually should return a vec3. This was tested on an Intel® HD Graphics 3000 Sandy Bridge CPU-integrated GPU. The following vertex shader does not compile properly:
# version 120
uniform mat4x3 matrix;
void main(){
gl_Position = vec4(matrix * gl_Vertex, 1.0);
}
It generates this error:
ERROR: 0:4: 'constructor' : too many arguments
meaning that the multiplication results is a vec4. Forcing the result to a vec3 by writing
gl_Position = vec4(vec3(matrix * gl_Vertex).xyz, 1.0);
compiles but does not produce the correct results.
Edit: Forcing the result to a vec3 DOES produce the correct result. This proved to be a very non-intrusive workaround.
Note that the exact same shader compiles and works fine on an Intel® HD Graphics 2500 (Ivy Bridge) GPU.
Please fix this ASAP! This bug is keeping my engine from working on Sandy Bridge integrated GPUs! If it's possible to work around the issue, that'd help a lot too!
- Tags:
- Drivers
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
Thanks for sharing this information with us. I will forward it to the appropriate support group so they can take it in consideration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a similar problem with Intel HD Graphics 3000, driver version: 9.17.10.3347
mat3x4 M;
vec3 x;
then the multiplication : M*x is valid and the result should be of type vec4, however if I write: vec4 y = M*x then I have the message:
" '=' : cannot convert from '3-component vector of float' to '4-component vector of float'".
It means "mat3x4 * vec3" is considered having the vec3 type : mat3x4*vec3 = vec3 ?!
I do not have this error with Nvidia cards.
Thanks to fix this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am sorry you are having this problem.
Have you tried with the latest driver version?
Here you can get it:
https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProdId=3319&DwnldID=23764 https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProdId=3319&DwnldID=23764
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In GLSL, the type mat4x3
represents a matrix that is 4 columns wide (row-lengths of 4) and 3 rows tall (column-lengths of 3) http://www.opengl.org/wiki/Data_Type_(GLSL)# Matrices [source]. The products of a matrix and a vector in GLSL requires the vector's length be the same as the matrix's column-length/row-count https://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Operations# Operators [source].
What you're seeing — that a matrix with column-lengths of 3 requires the vector to be a vec3
— is the correct behavior for GLSL on every platform. It's much more common to use matrices of size mat4x4
(AKA mat4
) when transforming the gl_Vertex
to a gl_Position
. Correct solutions to your problem would be to:
- Strip off the
.w
component off ofgl_Vertex
as you've done, or - To initialize a 4th row of the matrix (as a
mat4
) to0,0,0,1
(from bottom-left to bottom-right).
Much more information about how GL/GLSL perform standard matrix transformation can be found in this useful post: http://www.songho.ca/opengl/gl_transform.html# modelview http://www.songho.ca/opengl/gl_transform.html# modelview
The best part about this is the two official Intel reps didn't bother to point out your mistake, they both blindly handed you apologies and courtesies claiming that they're sending the problem off to be fixed. TL;DR: Intel has some pretty shitty support reps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CapnSlipp,
Thank you for the information. This will be helpful for other users.
Kevin M
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page