How do I set up a floating point plugin using libGDX?
Since OpenGL 2.0 does not support the following extensions:
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE); glClampColorARB(GL_CLAMP_READ_COLOR_ARB, GL_FALSE); glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, GL_FALSE);
I need to set up the floating point render targets so that my final texture is not clamped between 0 and 1. as needed, so that the texture output is unclosed because I am using libGDX for image processing.
try for a few days to get this to work:
frameBuffer1 = new FrameBuffer(usedFormat, w, h, true);
frameBuffer2 = new FrameBuffer(usedFormat, w, h, true);
frameBuffer1.begin();
gl20.glViewport(0, 0, frameBuffer1.getWidth(), frameBuffer1.getHeight());
gl20.glClearColor(0f, 0f, 0f, 0f);
gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
gl20.glActiveTexture(GL20.GL_TEXTURE0);
testTexture.bind(); //input image texture
gl20.glEnable(GL20.GL_TEXTURE_2D);
meshShader1.begin();
meshShader1.setUniformi("s_texture", 0);
mesh.render(meshShader1, GL20.GL_TRIANGLES);
meshShader1.end();
frameBuffer1.end();
frameBuffer2.begin();
gl20.glViewport(0, 0, frameBuffer2.getWidth(), frameBuffer2.getHeight());
gl20.glClearColor(0f, 0f, 0f, 0f);
gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
frameBuffer1.getColorBufferTexture().bind()
meshShader2.begin();
meshShader2.setUniformi("s_texture", 0);
mesh.render(meshShader2, GL20.GL_TRIANGLES);
meshShader2.end();
frameBuffer2.end();
I have 2 simple shader programs to check if a texture keeps unclosed values. The first subtracts 0.5 from the input texture image, and the second adds 0.5 to the output of the first frame buffer.
+3
source to share
No one has answered this question yet
Check out similar questions: