Issue #21 update offscreen rendering to work correctly with graphics cards that do not support luminance.

Change-Id: Id04fc4cd643840ddcf39d617d4594def9f013917

Former-commit-id: 53fc5959effe94c2775627a3cd88a5c0287c22d3
This commit is contained in:
Ben Steffensmeier 2012-01-27 11:50:16 -06:00
parent bdf268a621
commit 554313dcc8
5 changed files with 8 additions and 28 deletions

View file

@ -10,7 +10,7 @@ void main(void)
{
vec2 xy = gl_FragCoord.xy;
vec4 radarVal = texture2D(radarData,gl_TexCoord[0].st);
vec4 curVal = texture2D(mosaicTexture, vec2((xy.x / width), (xy.y / height)));
vec4 curVal = texture2D(mosaicTexture, vec2((xy.x / float(width)), (xy.y / float(height))));
if ( radarVal.r > curVal.r ) {
gl_FragColor = vec4(radarVal.r,0.0,0.0,1.0);
} else {

View file

@ -199,7 +199,7 @@ public class GLGeometryPainter {
*/
private static void drawArrays(GL gl, int mode, int first, int count)
throws VizException {
if (first > -1 && count > 0 && (first + count < getMaxVertices(gl))) {
if (first > -1 && count > 0) {
gl.glDrawArrays(mode, first, count);
} else {
throw new VizException(
@ -220,12 +220,4 @@ public class GLGeometryPainter {
}
}
private static int getMaxVertices(GL gl) {
if (maxVertices < 0) {
IntBuffer ib = IntBuffer.allocate(1);
gl.glGetIntegerv(GL.GL_MAX_ELEMENTS_VERTICES, ib);
maxVertices = ib.get(0);
}
return maxVertices;
}
}

View file

@ -158,7 +158,7 @@ public abstract class AbstractGLColorMapDataFormat {
*/
protected Buffer handleBufferSizing(GLColorMapData data, Buffer buffer,
int[] dimensions) {
int sliceWidth = dimensions[0];
int sliceWidth = dimensions[0] * getValuesPerPixel();
int sliceHeight = dimensions[1];
int paddedSliceWidth = getAlignedWidth(sliceWidth);
@ -169,7 +169,7 @@ public abstract class AbstractGLColorMapDataFormat {
// Im not sure what shape this data is in, so just panic.
throw new IllegalStateException("Buffer is wrong size("
+ totalDataSize + ") for data dimensions(" + sliceWidth
+ "x" + sliceWidth + ")");
+ "x" + sliceHeight + ")");
}
Buffer newBuffer = getCopybackBuffer(data);

View file

@ -74,7 +74,8 @@ public class GLByteDataFormat extends AbstractGLColorMapDataFormat {
*/
@Override
public Buffer getCopybackBuffer(GLColorMapData data) {
int width = getAlignedWidth(data.getDimensionSize(0));
int width = getAlignedWidth(data.getDimensionSize(0)
* getValuesPerPixel());
int height = data.getDimensionSize(1);
return ByteBuffer.allocate(height * width);
}

View file

@ -121,7 +121,7 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
}, parameters);
} else {
image = cmapExt.initializeRaster(new GLOffscreenDataCallback(
buffer, dimensions), null);
buffer, dimensions), parameters);
}
if (!checkedLuminance) {
checkedLuminance = true;
@ -132,7 +132,7 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
// assume we don't support luminance
supportsLuminance = false;
// Reconstruct image
image = constructOffscreenImage(dataType, dimensions);
image = constructOffscreenImage(dataType, dimensions, parameters);
}
}
return image;
@ -178,19 +178,6 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
return GL.GL_RGB8;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.dataprep.GLByteDataFormat#
* getCopybackBuffer(java.awt.Rectangle)
*/
@Override
public Buffer getCopybackBuffer(GLColorMapData data) {
int width = getAlignedWidth(data.getDimensionSize(0)) * 3;
int height = data.getDimensionSize(1) * 3;
return ByteBuffer.allocate(height * width);
}
/*
* (non-Javadoc)
*