About using shaders

Hello.
I’m very new on OGSL. I got the Brick-Shader-example compiled and executed.

Now, ther are two questions that will sound very stupid for most of you.

First: How can I delete a shader, I’ve tried it by using glDeleteObjectARB(myShader); But this doesn’t work. I guess this is because the shader is still attached to the rendering context. What should I do to detach it from the RC?
glDetachObjectARB needs two arguments. Does it work if I’ll take an handle to the RC as first argument?

Second: How can I draw several objects, some with shading and the remaining without? How do I get a shader invalid so that the OpenGL commands (glColor …) in my C+±code take effect?

THX for help.

When you call glDeleteObjectARB the shader object is just marked to deletion. This is because it would cause problems if the object is in use at the moment you delete it.
The objects will be deleted if it is not in use any more and if the shader object is not attached to any program object.

To “unbind” your shader (so that it has no effect anymore), use

glUseProgramObjectARB (0);

Jan.

THX, both of you.

It’s so damn simple.

Hi -

I have recently started working with shaders. I have downloaded the ogl2brick shader from the 3dlabs webpage. I am trying to run the program in visual studio (with VC++) compiler. I have copied all the necessary files like header files and lib files to the corresponding folders. I was able to compile but getting a run time error like …

unresolved external symbol _glewGetExtension

I have rechecked that I have copied gew.h and glew32s (LIB file) to proper folders. Why I am getting such erros ?

-Chandu

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.