NV_path_rendering fixes to make it usable
This commit is contained in:
parent
40694134ab
commit
6650201a6d
|
@ -43,6 +43,7 @@ import static org.lwjgl.opengl.EXTAbgr.*;
|
||||||
import static org.lwjgl.opengl.EXTBgra.*;
|
import static org.lwjgl.opengl.EXTBgra.*;
|
||||||
import static org.lwjgl.opengl.EXTDirectStateAccess.*;
|
import static org.lwjgl.opengl.EXTDirectStateAccess.*;
|
||||||
import static org.lwjgl.opengl.GL11.*;
|
import static org.lwjgl.opengl.GL11.*;
|
||||||
|
import static org.lwjgl.opengl.GL13.*;
|
||||||
import static org.lwjgl.opengl.GL15.*;
|
import static org.lwjgl.opengl.GL15.*;
|
||||||
import static org.lwjgl.opengl.NVPathRendering.*;
|
import static org.lwjgl.opengl.NVPathRendering.*;
|
||||||
|
|
||||||
|
@ -294,37 +295,36 @@ class GLChecks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int calculatePathColorGenCoeffsCount(int genMode, int colorFormat) {
|
static int calculatePathColorGenModeElements(int genMode) {
|
||||||
final int coeffsPerComponent = calculatePathGenCoeffsPerComponent(genMode);
|
|
||||||
|
|
||||||
switch ( colorFormat ) {
|
|
||||||
case GL_RGB:
|
|
||||||
return 3 * coeffsPerComponent;
|
|
||||||
case GL_RGBA:
|
|
||||||
return 4 * coeffsPerComponent;
|
|
||||||
default:
|
|
||||||
return coeffsPerComponent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int calculatePathTextGenCoeffsPerComponent(FloatBuffer coeffs, int genMode) {
|
|
||||||
if ( genMode == GL_NONE )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return coeffs.remaining() / calculatePathGenCoeffsPerComponent(genMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int calculatePathGenCoeffsPerComponent(int genMode) {
|
|
||||||
switch ( genMode ) {
|
switch ( genMode ) {
|
||||||
case GL_NONE:
|
case GL_NONE:
|
||||||
return 0;
|
return 0;
|
||||||
|
case GL_CONSTANT:
|
||||||
|
return 1;
|
||||||
case GL_OBJECT_LINEAR:
|
case GL_OBJECT_LINEAR:
|
||||||
case GL_PATH_OBJECT_BOUNDING_BOX_NV:
|
case GL_PATH_OBJECT_BOUNDING_BOX_NV:
|
||||||
return 3;
|
return 3;
|
||||||
case GL_EYE_LINEAR:
|
case GL_EYE_LINEAR:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unsupported gen mode: " + genMode);
|
throw new IllegalArgumentException(String.format("Unsupported genMode specified: 0x%X", genMode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int calculatePathColorGenFormatComponents(int colorFormat) {
|
||||||
|
switch ( colorFormat ) {
|
||||||
|
case GL_LUMINANCE:
|
||||||
|
case GL_INTENSITY:
|
||||||
|
case GL_ALPHA:
|
||||||
|
return 1;
|
||||||
|
case GL_LUMINANCE_ALPHA:
|
||||||
|
return 2;
|
||||||
|
case GL_RGB:
|
||||||
|
return 3;
|
||||||
|
case GL_RGBA:
|
||||||
|
return 4;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException(String.format("Unsupported colorFormat specified: 0x%X", colorFormat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ package org.lwjgl.opengl;
|
||||||
import org.lwjgl.util.generator.*;
|
import org.lwjgl.util.generator.*;
|
||||||
import org.lwjgl.util.generator.opengl.*;
|
import org.lwjgl.util.generator.opengl.*;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
@ -281,23 +282,43 @@ public interface NV_path_rendering {
|
||||||
|
|
||||||
void glPathCommandsNV(@GLuint int path,
|
void glPathCommandsNV(@GLuint int path,
|
||||||
@AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands,
|
@AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands,
|
||||||
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
|
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
|
||||||
@Const @GLvoid ByteBuffer coords);
|
@Const
|
||||||
|
@GLbyte
|
||||||
|
@GLubyte
|
||||||
|
@GLshort
|
||||||
|
@GLushort
|
||||||
|
@GLfloat Buffer coords);
|
||||||
|
|
||||||
void glPathCoordsNV(@GLuint int path,
|
void glPathCoordsNV(@GLuint int path,
|
||||||
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
|
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
|
||||||
@Const @GLvoid ByteBuffer coords);
|
@Const
|
||||||
|
@GLbyte
|
||||||
|
@GLubyte
|
||||||
|
@GLshort
|
||||||
|
@GLushort
|
||||||
|
@GLfloat Buffer coords);
|
||||||
|
|
||||||
void glPathSubCommandsNV(@GLuint int path,
|
void glPathSubCommandsNV(@GLuint int path,
|
||||||
@GLsizei int commandStart, @GLsizei int commandsToDelete,
|
@GLsizei int commandStart, @GLsizei int commandsToDelete,
|
||||||
@AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands,
|
@AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands,
|
||||||
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
|
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
|
||||||
@Const @GLvoid ByteBuffer coords);
|
@Const
|
||||||
|
@GLbyte
|
||||||
|
@GLubyte
|
||||||
|
@GLshort
|
||||||
|
@GLushort
|
||||||
|
@GLfloat Buffer coords);
|
||||||
|
|
||||||
void glPathSubCoordsNV(@GLuint int path,
|
void glPathSubCoordsNV(@GLuint int path,
|
||||||
@GLsizei int coordStart,
|
@GLsizei int coordStart,
|
||||||
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
|
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
|
||||||
@Const @GLvoid ByteBuffer coords);
|
@Const
|
||||||
|
@GLbyte
|
||||||
|
@GLubyte
|
||||||
|
@GLshort
|
||||||
|
@GLushort
|
||||||
|
@GLfloat Buffer coords);
|
||||||
|
|
||||||
void glPathStringNV(@GLuint int path, @GLenum int format,
|
void glPathStringNV(@GLuint int path, @GLenum int format,
|
||||||
@AutoSize("pathString") @GLsizei int length, @Const @GLvoid ByteBuffer pathString);
|
@AutoSize("pathString") @GLsizei int length, @Const @GLvoid ByteBuffer pathString);
|
||||||
|
@ -371,19 +392,21 @@ public interface NV_path_rendering {
|
||||||
void glStencilStrokePathNV(@GLuint int path,
|
void glStencilStrokePathNV(@GLuint int path,
|
||||||
int reference, @GLuint int mask);
|
int reference, @GLuint int mask);
|
||||||
|
|
||||||
void glStencilFillPathInstancedNV(@AutoSize(value="paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
|
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
||||||
|
void glStencilFillPathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
|
||||||
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
||||||
@GLuint int pathBase,
|
@GLuint int pathBase,
|
||||||
@GLenum int fillMode, @GLuint int mask,
|
@GLenum int fillMode, @GLuint int mask,
|
||||||
@GLenum int transformType,
|
@GLenum int transformType,
|
||||||
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
||||||
|
|
||||||
void glStencilStrokePathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
|
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
||||||
|
void glStencilStrokePathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
|
||||||
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
||||||
@GLuint int pathBase,
|
@GLuint int pathBase,
|
||||||
int reference, @GLuint int mask,
|
int reference, @GLuint int mask,
|
||||||
@GLenum int transformType,
|
@GLenum int transformType,
|
||||||
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
||||||
|
|
||||||
// PATH COVERING
|
// PATH COVERING
|
||||||
|
|
||||||
|
@ -391,11 +414,11 @@ public interface NV_path_rendering {
|
||||||
|
|
||||||
void glPathColorGenNV(@GLenum int color,
|
void glPathColorGenNV(@GLenum int color,
|
||||||
@GLenum int genMode,
|
@GLenum int genMode,
|
||||||
@GLenum int colorFormat, @Check(value = "GLChecks.calculatePathColorGenCoeffsCount(genMode, colorFormat)", canBeNull = true) @Const FloatBuffer coeffs);
|
@GLenum int colorFormat, @Check(value = "GLChecks.calculatePathColorGenModeElements(genMode) * GLChecks.calculatePathColorGenFormatComponents(colorFormat)", canBeNull = true) @Const FloatBuffer coeffs);
|
||||||
|
|
||||||
void glPathTexGenNV(@GLenum int texCoordSet,
|
void glPathTexGenNV(@GLenum int texCoordSet,
|
||||||
@GLenum int genMode,
|
@GLenum int genMode,
|
||||||
@AutoSize(value="coeffs", expression="GLChecks.calculatePathTextGenCoeffsPerComponent(coeffs, genMode)", useExpression = true, canBeNull = true) int components, @Check(canBeNull = true) @Const FloatBuffer coeffs);
|
int components, @Check(value = "GLChecks.calculatePathColorGenModeElements(genMode) * components", canBeNull = true) @Const FloatBuffer coeffs);
|
||||||
|
|
||||||
void glPathFogGenNV(@GLenum int genMode);
|
void glPathFogGenNV(@GLenum int genMode);
|
||||||
|
|
||||||
|
@ -403,19 +426,21 @@ public interface NV_path_rendering {
|
||||||
|
|
||||||
void glCoverStrokePathNV(@GLuint int name, @GLenum int coverMode);
|
void glCoverStrokePathNV(@GLuint int name, @GLenum int coverMode);
|
||||||
|
|
||||||
void glCoverFillPathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
|
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
||||||
|
void glCoverFillPathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
|
||||||
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
||||||
@GLuint int pathBase,
|
@GLuint int pathBase,
|
||||||
@GLenum int coverMode,
|
@GLenum int coverMode,
|
||||||
@GLenum int transformType,
|
@GLenum int transformType,
|
||||||
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
||||||
|
|
||||||
void glCoverStrokePathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
|
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
||||||
|
void glCoverStrokePathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
|
||||||
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
||||||
@GLuint int pathBase,
|
@GLuint int pathBase,
|
||||||
@GLenum int coverMode,
|
@GLenum int coverMode,
|
||||||
@GLenum int transformType,
|
@GLenum int transformType,
|
||||||
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
|
||||||
|
|
||||||
// PATH QUERIES
|
// PATH QUERIES
|
||||||
|
|
||||||
|
@ -440,18 +465,19 @@ public interface NV_path_rendering {
|
||||||
|
|
||||||
void glGetPathDashArrayNV(@GLuint int name, @Check @OutParameter FloatBuffer dashArray);
|
void glGetPathDashArrayNV(@GLuint int name, @Check @OutParameter FloatBuffer dashArray);
|
||||||
|
|
||||||
|
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
||||||
void glGetPathMetricsNV(@GLbitfield int metricQueryMask,
|
void glGetPathMetricsNV(@GLbitfield int metricQueryMask,
|
||||||
@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
|
@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
|
||||||
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
|
||||||
@GLuint int pathBase,
|
@GLuint int pathBase,
|
||||||
@GLsizei int stride,
|
@GLsizei int stride,
|
||||||
@Check("GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
|
@Check("numPaths * GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
|
||||||
|
|
||||||
void glGetPathMetricRangeNV(@GLbitfield int metricQueryMask,
|
void glGetPathMetricRangeNV(@GLbitfield int metricQueryMask,
|
||||||
@GLuint int fistPathName,
|
@GLuint int fistPathName,
|
||||||
@GLsizei int numPaths,
|
@GLsizei int numPaths,
|
||||||
@GLsizei int stride,
|
@GLsizei int stride,
|
||||||
@Check("GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
|
@Check("numPaths * GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
|
||||||
|
|
||||||
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
|
||||||
void glGetPathSpacingNV(@GLenum int pathListMode,
|
void glGetPathSpacingNV(@GLenum int pathListMode,
|
||||||
|
|
Loading…
Reference in New Issue