Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Shader code working in 6600 and not working in 8800 GTX

This topic is 3988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Iam trying to run the same shader code on 2 systems. 1) One with 6600 card and 97.55 Nvidia driver version. This has a 64 bit linux. 2) Second one has 8800 GTX with 97.55 Nvidia driver with 32 bit linux. The shader code behaves the way it has to behave in the first system and not in the second system. Iam having only vertex and fragment shaders. and the OpenGL version is 2.1 What could be the problem ?

Share this post

Link to post
Share on other sites
Showing the shader code would probably help.

However I have had similar problems and that was related to not clamping values.

Different cards can handle undefined or out of bound values differently.

Share this post

Link to post
Share on other sites
#version 110
uniform float zNear;
uniform float zFar;
varying vec4 position;

void main( ){

vec4 pos;
vec4 myposition;
vec4 c = vec4 (0.0 , 0.0, 0.0, 1.0);
vec4 camera = gl_ModelViewMatrixInverse * c;

vec4 point = vec4 (0.0 , 0.0 , -1.0 , 1.0);
vec4 point2 = gl_ModelViewMatrixInverse * point;

vec4 lookvector4 = point2 - camera;
vec3 lookvector = lookvector4.xyz;
vec4 center = lookvector4;

float far = zFar - 2.0;

far = 99.0;

vec3 dv = normalize( lookvector4).xyz;
vec3 tr = normalize( vec3( camera.x, camera.y, camera.z + 10.0) - point2.xyz );

vec3 r1v = normalize( cross (dv , tr ) );
vec3 r2v = normalize( cross (r1v, dv ) );

center = camera + far * normalize (lookvector4);

float radius = 100.0;
if( gl_Vertex.w == 101.0 ){
myposition.xyz = center.xyz + r1v * radius;
else if( gl_Vertex.w == 102.0 ){
myposition.xyz = center.xyz + r2v * radius;
else if( gl_Vertex.w == 103.0 ){
myposition.xyz = center.xyz - r1v * radius;
else if( gl_Vertex.w == 104.0 ){
myposition.xyz = center.xyz - r2v * radius;

myposition.w = 1.0;
position = myposition;
gl_Position = gl_ModelViewProjectionMatrix * myposition ;


The code just draws a Quad in front of the camera. This is just for ray tracing.

Share this post

Link to post
Share on other sites
I would say that the problem could be because you are not specifically placing any value in myposition.xyz.

Even if there is no possible way of getting through the if else block you have there without assigning a value, I have found this can be an issue. So when you declare myposition, just assign a value.

Hope that helps.

Share this post

Link to post
Share on other sites
Sign in to follow this  

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