Jump to content
  • Advertisement
Sign in to follow this  
neebee

OpenGL GLSL problem (ati vs. nvidia)

This topic is 3340 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

I've got a problem with ati cards, I have a simple shader that binds a 2d texture to a primitive. works good with nvidia cards but on ati, draws a non textured quad (colored by last glColor4f state). ati supports opengl 2.0 and the info logs are: The GLSL vertex shader will run in hardware. The GLSL fragment shader will run in hardware. Link successful. what do you say?

Share this post


Link to post
Share on other sites
Advertisement
Post your shader code (in [source][/source] tags).

NVidia's GLSL compiler is piggy-backed on top of their CG compiler, and is notorious for accepting shaders that the GLSL standard (and the ATI compiler) considers invalid.

Share this post


Link to post
Share on other sites
the code is:



attribute vec2 vertex;
attribute vec2 texcoord;

varying vec2 coords;

void main() {

coords = texcoord;
gl_Position = gl_ModelViewProjectionMatrix * vec4(vertex, 0.0, 1.0);
}

////// fs

uniform sampler2D gui_tex;
uniform float alpha;
varying vec2 coords;

void main() {
vec4 texel = texture2D(gui_tex, coords.xy);
if (texel.a > alpha) texel.a = alpha;
gl_FragColor = texel.rgba;
}





btw if the problem is in code how come ati's logs are

The GLSL vertex shader will run in hardware.
The GLSL fragment shader will run in hardware.
Link successful.

?

Share this post


Link to post
Share on other sites
Quote:
Original post by neebee
the code is:

*** Source Snippet Removed ***

btw if the problem is in code how come ati's logs are

The GLSL vertex shader will run in hardware.
The GLSL fragment shader will run in hardware.
Link successful.

?
Ja, your code looks fine. However:
Quote:
but on ati, draws a non textured quad (colored by last glColor4f state)
This sets off warning bells. Your shader doesn't use the value of the gl_Color inputs, so this would indicate that the fragment shader isn't being run at all (i.e. you are falling back to fixed-function).

Share this post


Link to post
Share on other sites
ok.. I got what u mean..

so why is this happening? and how come the value of my program object is 0x80000001?

I mean if the problem is in the value of program object, vertex shader shouldn't work too, aren't I right?

Share this post


Link to post
Share on other sites
Quote:
and how come the value of my program object is 0x80000001?
I would assume that NVidias driver numbers shaders starting at 0x80000000
Quote:
I mean if the problem is in the value of program object, vertex shader shouldn't work too, aren't I right?
Make sure your program is actually being bound at all - your vertex shader doesn't do anything the fixed function pipeline wouldn't.

Share this post


Link to post
Share on other sites
you're right. my vertex shader isn't woking too..

so, I use glUseProgram(program) and I made sure program's value is changed as 0x80000001 after glLinkProgram call.. is it possible glUseProgram fails although program linked succesfully? btw glGetError returns 0 after glUseProgram call.

Share this post


Link to post
Share on other sites
glIsProgram returns GL_TRUE
GL_VALIDATE_STATUS returns GL_TRUE
GL_LINK_STATUS returns GL_TRUE

this is annoying.

[Edited by - neebee on October 24, 2009 6:46:43 PM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!