Jump to content

  • Log In with Google      Sign In   
  • Create Account


50CoL

Member Since 21 Dec 2011
Offline Last Active Dec 28 2012 12:17 AM
-----

Posts I've Made

In Topic: Does it possible to write a "Global Shader"?

05 September 2012 - 07:47 PM

When you start a project from "scratch", especially first time, I recommend to begin with a global shader. You can control it from Uniforms to get different behavior. As soon as you find that the shader is getting complex (too many conditional statements on uniforms, too much functionality that isn't really related, or if you find that you need to specialize because it is too slow), then it is easy to make a new shader from the old one and only keep what is relevant to each of them.

That way, you will eventually get a library of shaders specialized for different situations.

The opposite can happen also. That you get shaders that use common functionality that is a copy. There are mechanisms for that, like uniform buffers and ways to "#include" common source code in shaders. It is a lot like usual SW design. The usual problems of how to making a good design that is flexible, easy to change, fault tolerant, etc.


Thanks. What u said was very helpful to me.Posted Image

I guess that I should start over by using a global shader. Different shaders cooperation makes me really confusing.

In Topic: Problem of GLSL Multitexturing

04 September 2012 - 09:13 PM

There is nothing much to say. You have many API calls hidden behind Use() and Bind() and we don't have the shader at hands.
Why do you think the normal map is not loading ? Maybe your lighting calculation is wrong ?

How about some error checking ?

Does
[source lang="cpp"]glGetUniformLocation( _waterShader->GetHandler(),"bumpTex")[/source]
actually resolve to a valid value ?

http://www.opengl.or...UniformLocation
and
http://www.opengl.or...r_Not_To_Enable


I found where the problem was...I used GL_RGBA instead of GL_RGB in glTexImage2D and everyting shew up..
Thank you

In Topic: Problem with glGenTexture(). Need Help :D

25 December 2011 - 09:41 PM


I am sure that I active all rendering context I need before calling any GL function.
It's strange that if i call this function out of a class, it works fine....

Are you sure you're not creating an instance of the class globally, which will be constructed before your main() function is entered? Have you tried putting a breakpoint on the glGenTexture() call and where you create your rendering context to verify this?


Thanks for ur help. I did create an instance of that class globally and that's why the function doesn't work. I add a init-function in the class then call it in the main() function, and every thing works fine.
Thank to all the guys above. :D

In Topic: Problem with glGenTexture(). Need Help :D

22 December 2011 - 08:51 AM

Posted ImageSorry for replying so late guys. I did make a mistake on the code of "sky[5]", and it should be "GLuint &sky[5]"... :P
I was in hurry while typing this post...
I am sure that I active all rendering context I need before calling any GL function.
It's strange that if i call this function out of a class, it works fine....
Posted Imageconfusing

PARTNERS