Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

alb

Member Since 28 Jun 2012
Offline Last Active Jul 06 2012 10:33 AM
-----

Posts I've Made

In Topic: invalid framebuffer operation with FBO

05 July 2012 - 08:18 AM

I believe it more looks syntax call error than frame buffer problem. Your code:


gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, frameBufferID[0]);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glPushAttrib(GL.GL_VIEWPORT_BIT); // <--- You saved viewport bits
gl.glViewport(0, 0, floorWidth, floorHeight);

gl.glBegin(GL.GL_QUADS);

gl.glTexCoord2f(0.0f, 0.0f);
gl.glVertex3d(-1, -1, 0);
gl.glTexCoord2f(0.0f, 1.0f);
gl.glVertex3d(-1, 1, 0);
gl.glTexCoord2f(1.0f, 1.0f);
gl.glVertex3d(1, 1, 0);
gl.glTexCoord2f(1.0f, 0.0f);
gl.glVertex3d(1, -1, 0);

gl.glEnd();


gl.glPopAttrib(); // <-- You restored previous attribute values (viewport bits)
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

gl.glPopAttrib(); // <-- What it does restore???
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

Best wishes, FXACE.



No the last two rows are a copy&paste error:

gl.glPopAttrib(); // <-- You restored previous attribute values (viewport bits)
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

In Topic: Efficient drawing of 2d gridlines with shaders

05 July 2012 - 02:00 AM

I would like to implement the approach of the virtual texturing.

I'm following the instructions of this thesis http://www.graphics....ring_low_03.pdf
I need what the author calls "Needbuffer" (pag 14).

I'm more or less at this point: http://www.youtube.com/watch?feature=player_embedded&v=ONYt4hbitFE
and using the information about the level of detail I would like to load a texture composed with different level of details like in this video: http://www.youtube.com/watch?feature=player_embedded&v=YCZl16JMF08

In Topic: Efficient drawing of 2d gridlines with shaders

04 July 2012 - 08:05 AM

Ok now I going to describe my situation:

In the screenshot there is my running program.

In this case I take what is rendered and I put all of it on a 2dtexture that I rendered on the left of the screen.

But I would like to put in the 2dtexture only the quad (that is the output of the shader); as you can see the output is a grid that represents a level of details based on the distance of the camera.
I would like to put that information on a texture in order to retrieve the level of details.

This is the fragmentShader:

[source lang="java"]#version 150out vec4 fragColor;varying vec4 clipPos;void main(){ vec2 tx=gl_TexCoord[0].xy;//vec2 tx = clipPos.xy / clipPos.w * 0.5 + vec2(0.5); // get the length of the texture derivatives float lambda_s = length(dFdx(tx)); float lambda_t = length(dFdy(tx)); // compute the sample level, based on the maximum derivative, and the interpolation factor between ceiled and floored level float level_s; float interp_s = modf(-log2(max(lambda_s, lambda_t)), level_s); // get the new texture coordinate by scaling the texture coordinate by the floored and ceiled level vec2 tx_down = tx * pow(2, level_s); vec2 tx_up = tx * pow(2, level_s + 1); // compute the color procedural vec2 highlight_down = clamp(cos(tx_down * 0.2) - 0.95, 0,1) * 10; vec2 highlight_up = clamp(cos(tx_up * 0.2) - 0.95, 0,1) * 10; // this might be faster, but it doesn't fade nicely... //float highlight_down = step(0.9, fract(tx_down * 0.04)) * 0.8; //float highlight_up = step(0.9, fract(tx_up * 0.04)) * 0.8; // lerp between the intensities fragColor = vec4(1 - clamp(mix( max(highlight_down.x, highlight_down.y), max(highlight_up.x, highlight_up.y), interp_s), 0,1));}[/source]

In Topic: Efficient drawing of 2d gridlines with shaders

28 June 2012 - 10:40 AM

I mean
Ok I have the output of the shader in the quad.

But how can I use the information contained in that output?

For example I would like to use that information in order to retrieve the level of details of each pixel.
I would like to have a buffer and each element represents the level of detail of the corrensponding pixel.

Is it clear?

In Topic: Efficient drawing of 2d gridlines with shaders

28 June 2012 - 09:59 AM

I have a question:
If I want to use the information contained in the output of the shader, how can I do that?

For example how can I convert the output of the shader in a texture?

I tried using glFramebufferTexture2DEXT, glBindFramebufferEXT, etc.. but in this case I have a texture with all the scene renderized, not just the output of the shader of the quad.

PARTNERS