• Advertisement

tvsct456

Member
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

119 Neutral

About tvsct456

  • Rank
    Newbie
  1. Hello guys, Currently, I'm working on sth about irradiance environment map ( generates diffuse/specular map from a given cubemap ). As I need to calculate the diffuse and specular factors from the cubemap, I need to know how to get every pixel on each side of the cubemap. But I cant figure it out. How can I unwrap the cubemap and render it on the screen ( Like post process ) or there are other ways to achieve this?
  2. [quote name='larspensjo' timestamp='1346832529' post='4976736'] 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. [/quote] Thanks. What u said was very helpful to me.[img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] I guess that I should start over by using a global shader. Different shaders cooperation makes me really confusing.
  3. Hello its me again. Im wondering if there can be a global shader that works to everything, such as fog, ambient lighting or sth else.. Im a beginer of GLSL. I dont know how to let the fog shader work to every objects on the scene, because some of the objects are being rednered by different shaders. So does it possible to write a Global shader? Or I need to edit every shader? Thanks
  4. Problem of GLSL Multitexturing

    [quote name='Ashaman73' timestamp='1346735516' post='4976311'] 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 ? [/quote] [quote name='V-man' timestamp='1346812325' post='4976660'] [url="http://www.opengl.org/wiki/GLSL_:_common_mistakes#glGetUniformLocation"]http://www.opengl.or...UniformLocation[/url] and [url="http://www.opengl.org/wiki/GLSL_:_common_mistakes#Enable_Or_Not_To_Enable"]http://www.opengl.or...r_Not_To_Enable[/url] [/quote] I found where the problem was...I used GL_RGBA instead of GL_RGB in glTexImage2D and everyting shew up.. Thank you
  5. Hey guys[img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] Im working on a water effect demo these days, and there is a problem that the fragment shader cant load the normal texture for the water surface ( the reflection texture works fine) . Im sure that both the vertex shader and fragment shader are correct because they work fine in the ShaderMaker. So I guess the problem comes from my C++ codes, and here are the codes: _waterShader->Use(); glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); _ReflectionTex->Bind(); glUniform1i( glGetUniformLocation( _waterShader->GetHandler(),"reflectTex"),1); glActiveTexture(GL_TEXTURE2); glEnable(GL_TEXTURE_2D); _WaterNorTex->Bind(); glUniform1i( glGetUniformLocation( _waterShader->GetHandler(),"bumpTex"),2); // uniform values ... // draw a plane ... What's wrong with my codes? [img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img] sorry for my poor English Thanks!
  6. [quote name='Evil Steve' timestamp='1324570695' post='4896557'] [quote name='50CoL' timestamp='1324565463' post='4896532'] 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.... [/quote] 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? [/quote] 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.
  7. [img]http://public.gamedev.net/public/style_emoticons/default/blink.gif[/img]Sorry for replying so late guys. I did make a mistake on the code of "sky[5]", and it should be "GLuint &sky[5]"... 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.... [img]http://public.gamedev.net/public/style_emoticons/default/huh.gif[/img]confusing
  8. Hello guys, I got a problem with the method glGenTexture(). Here is the code: GLuint sky[5]; glGenTexture(5,&sky); When I putted these lines in a class's construction function, they didn't work. The values in the array sky[5] are all 0 after the code above being runed. But They supposed to be 0,1,2,3,4 as the indexes of textures right ?
  • Advertisement