Ok, I have one more question. Is it possible to clear only one texture this way ?:
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glDrawBuffers(1, drawBuffers0);
glClear(GL_COLOR_BUFFER_BIT);...
Type: Posts; User: Triangle
Ok, I have one more question. Is it possible to clear only one texture this way ?:
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glDrawBuffers(1, drawBuffers0);
glClear(GL_COLOR_BUFFER_BIT);...
I want to use a single fbo and multiple texture attachments. I attach textures to different color attachments.
Then I use glDrawBuffers to switch rendering to different color attachments.
...
I need to use a texture(rgba) where each channel can store unsigned integer value from a range <0,7> I set a texture this way:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, screenWidth,...
During a gbuffer stage I save in textures a depth, normals, diffuse and specular colors, shininnes factors but also
normals from a normal maps (tangent space) and tangent vectors (I can calculate...
Ok, but I want to use my fragment shader with subroutines for a deferred rendernig. Then a render loop looks like this:
1. gbuffer stage
2 for each light:
(additive blending)
- shadow...
I wonder how to use a shader with subroutines and multiple render targets. I have a fragment shader which contains a few subroutines. (I posted only relevant pieces of the code).
#version 420...
I call glTexImage2D with a parameter level = 0. Then I call glGenerateMipmap(GL_TEXTURE_2D). What happens with GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL ? I assume that they are automatically...
I have an obj file which looks like this:
mtllib file1.mtl
#
# object f_00
#
v x y z
I made one more test. I changed an orthographic projection to
glm::ortho(-10.0f, 10.0f, 20.0f, 40.0f, 10.0f, 50.0f) Now it contains only the object and a small area of the ground plane, not the...
Thanks for tips. I tried a dynamic bias mentioned above but generally I got a bit worse effect than when using glPolygonOffset. Artifacts in the light were more visible. In the shadow some very...
I implemented a basic shadow mapping. I have a scene illuminated by one directional light.
I use an orthographic projection:
(glm::ortho(-70.0f, 70.0f, -50.0f, 90.0f, -50.0f, 100.0f));
...
Thanks for explanations. I agree that in general those lines of the code are not equivalent (for example light_view_matrix may contain some rotation)
But in this particular case the...
Ok, I compiled and ran that example. First of all I changed a little bit the fragment shader code. Now the example code is more similar to my code. This line:
vec4 position_ls =...
Ok, I removed all FramebufferTexture2D functions from the above initialization code and placed them in the render loop. Now the render loop looks like this:
-bind framebuffer
-set viewport
-cull...
Matrices are multiplied before sending to a shader because of efficiency. Vertex shader is executed for each vertex so if you do multiplication (ProjectionMatrix * ViewMatrix * ModelMatrix) in the...
I use a forward rendering and I try to implement a shadow mapping for a point light. I have one fbo and a cube map to store 6 depth textures. I'm not sure how to render a depth to textures when using...
A perspective matrix for shadows has zNear = 1.0 and zFar = 50.0 for above pictures. When I increase zFar (for example zFar = 70.0) I get following result (clamping to border(1, 0, 0, 0) s,t) :...
I implemented a simple shadow mapping. In a shader I use sampler2DShadow and textureProj when accessing a texture. Then I multiply a color(diffuse and specular) by a shadow value. A depth texture has...
So for a cube when I'm using glDrawArrays in a single rendering call (GL_TRIANGLES) I need duplicate positions, normals and tex coords ( 36 positions, 36 normals, 36 tex coords). For...
My English isn't perfect so maybe I try to explain what I mean by example and how I understand preparing data for shaders. Please correct me if I'm wrong and post more extensive explanation.
1. We...
I'm working on obj loader. I want to draw an object using glDrawElements (smooth shading). Here are my assumptions:
- the number of normals <= the number of vertices (I don't need to average...