if I uncomment the 1st line in the vertex shader to change Normal to gl_Normal, the screen gets black.
I check for open gl errors, the info log and validates the programm object but no errors messages.
What can interfere in this way with the shader ? I’ve testet this shader with 3dlabs ogl2example and there were no problems. So I guess it’s a problem in my framework. But i have no idea where. With fixed pipeline shading i had no problems.
How do you pass the Normals to the GL? With glNormal3f() or with vertex arrays. I had a similar problem using vertex arrays. Try to define your own attribute:
Originally posted by Corrail: How do you pass the Normals to the GL? With glNormal3f() or with vertex arrays. I had a similar problem using vertex arrays. Try to define your own attribute:
Why are there also problems when i don’t use the Vertex Normal but a constant value for the varying ? If the vertex normals are invalid, it shouldn’t be a problem if i don’t use them. I tried both, vertex arrays and glNormal3f, no difference, still the same problem.
A can test it with own attribute but i doubt this will change something…
Originally posted by PanzerSchreck: I’m sure that your problem lies somewhere else, cause I’ve used normals in glSlang and never had any problems.
yeah, that’s also my suspicion, but I am out of ideas where to look for the problem.
The question is: what can interfere with glslang shaders in a way, that they are compiled and linked without problems, no OpenGL errors with glUseProgramObjectARB or validation but the rendering-result is only rubbish.
//build and bind
glCompileShaderARB(_fragment_shader_ID);
glCompileShaderARB(_vertex_shader_ID);
glLinkProgramARB(_program_ID);
glUseProgramObjectARB(_program_ID);
anything forgotten ?
I had in glEnable(GL_LIGHTING) in my render setup. If I remove this, the screen get black, else there are the described problems. Shouldn’t the shading with glslang be independent from GL_LIGHTING ?
Installing catalyst 4.1 has nothing changed.(Well I can’t reproduce the mesh distortion right now, but still incorrect rendering).
Now I have made a simple test and found something interesting:
The first frame is rendered correct. All following frames are rendered incorrect. I tried to destroy and create, attach, recompile and link the shader in every frame drawing, but still incorrect renderings.
What can be the cause that the first frame is rendered correct, all following not ?
Fixed pipeline rendering is correct, every frame.
btw: I’m using dotnet (Windows Forms) with managed c++. Can this make problems ?
Hello, i had compiled your shader and this is the result: http://www.typhoonlabs.com/~ffelagund/slang.jpg
As you can see the sphere are right, your problem will be, with a 99% of posibilites, in the normals of the mesh. Your sphere aren’t distorted (geometrically), only have colors bases on wrong normals.
[This message has been edited by Ffelagund (edited 01-20-2004).]
Originally posted by Humus:
[b]Just did a quick check of your code, and found these things:
[quote]
OpenGLApp(HDC hwnd);
HDC hwnd?? Are you’re confusing the HWND and HDC types?
void OpenGLApp::draw() {
if(!wglMakeCurrent(_hDC,_hRC)) // Try To Activate The Rendering Context
{
throw “error”;
}
Why are you calling wglMakeCurrent() every frame?[/b][/QUOTE]
ahhhh thanks Humus, that were the right questions
The hwnd is only wrong variable name. I used HDC types (see Form1:Form1_Load).
BUT: the wglMakeCurrent caused the problem. If i remove it, everything works fine.
The test was some quick hack based on copy-paste-remove from my framework. There it could be possible to have several opengl windows, therefore i had there a wglMakeCurrent before start rendering.
So is this a bug or a feature that several calls to wglMakeCurrent (with same HDC/HGLRC) destroy gslang functionality ?
But then you would also have problems with pbuffers. Anybody used glslang with pbuffers ?
I have. A week ago, no reply till now. But I think too, this is a driver issue.
Anyone tried combination pbuffer and glslang yet ?
Another shortcoming of the current (catalyst 4.1) glslang implementation: Loops are not supported. Also with constant ending condition they are not implemented
Has anyone infos when to expect ATI drivers with a mature (non-beta) glslang implementation?
Anyone tried combination pbuffer and glslang yet ?
Yes, I have implemented some post-scene effects using pbuffers and had no problems with that.
Another shortcoming of the current (catalyst 4.1) glslang implementation: Loops are not supported. Also with constant ending condition they are not implemented
I think that’s more of a hardware problem. On current hardware, you need to inline loops. But as the Radeon only supports 96 instructions in FPs, unrolling a loop would most likely make your shader too big. (But maybe I’m totally wrong with that )
I think PanzerSchreck is right the HW problem of loops. But even for loops with pre-defined loop-counts are not supported:
for (int i = 0; i < 5; i++)
//do something
And, yes. ATI supports only 96 instructions for fragment programs but I’ve heard something about that ATI’s Radeon 9500+ are able to run “infine” instruction programs using floating point buffers. But till now there’s no support for that.
No, the F-Buffer is kind of an accumulation-buffer for shaders. If your shader is longer than the max. instruction count, then it is written into that buffer and than (at least I think so) executed in several passes. And AFAIK it’s all done in software and no hardware feature. And since the R350-path has been enabled for R300 in one of the older Catalyst-drivers, the F-Buffer should be usable on all Radeons since 9500 and up. Don’t know though when and how ATI will expose it in OpenGL or DX.
But it’s nothing you can’t do yourself. It’s just a feature that makes life a bit easier.