The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Bizarre OpenGL GLSL bug

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Bizarre OpenGL GLSL bug Posted: May 29, 2010 12:39 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Bizarre OpenGL GLSL bug
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

I recently replaced my broken Nvidia 9800GS card with an ATI Radeon 5850 - i love it. So I decided it was time to do some opengl programming again and I ran in to the most peculiar bug. The following code dynamically creates a mat4 array for rotating around the Z axis:

mat4(cos(angle), -sin(angle), 0.0, 0.0, sin(angle), cos(angle), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);

I italicized the first and throw columns so that you can visually parse it. It's column-order always in GLSL code. The problem was - when using the transformation, I was getting the z-coordinates of my vertices completely squashed and thus the rendering was completely broken.

I started to investigate and to my surprise found that my rotation matrix rotateZ[2][2] == 0.0; this makes no sense, it's clearly initialized as 1.0! .. the first four entries were correct though, so I changed my initialization code to the following:

mat4(vec4(cos(angle), -sin(angle), 0.0, 0.0), vec4(sin(angle), cos(angle), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));

This actually worked, everything ran as it should. This clearly demonstrates there is a bug in the opengl drivers glsl compiler of some sort, where it's ignoring the 16 float variant of the mat4() constructor. I'm running the latest drivers and my opengl version comes back as 4.0.9836. I have no idea how you're meant to proceed when you encounter this sort of bug except to rewrite the code.. but that doesn't make me feel very comfortable.

Read: Bizarre OpenGL GLSL bug

Topic: Smalltalk Daily 05/28/10: VW UI Building (1) Previous Topic   Next Topic Topic: JetBrains WebStorm and PhpStorm Go Public

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use