本文整理汇总了Java中com.jogamp.opengl.GL2.GL_LUMINANCE属性的典型用法代码示例。如果您正苦于以下问题:Java GL2.GL_LUMINANCE属性的具体用法?Java GL2.GL_LUMINANCE怎么用?Java GL2.GL_LUMINANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.GL_LUMINANCE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyseAndSetOpenGLParameters
/**
* Analyes the specified image and sets the proper openGLImage-values.
* @return <code>true</code> if the image foramt has successfully detected.
*/
public boolean analyseAndSetOpenGLParameters() {
boolean retValue = true;
String errorString = "";
try {
switch(image.getType()) {
case BufferedImage.TYPE_4BYTE_ABGR:
openGLImageFormat= GL2.GL_RGBA;
openGLImageType = GL2.GL_UNSIGNED_INT_8_8_8_8; // OK!
openGLImageInternalFormat = GL2.GL_RGBA;
break;
case BufferedImage.TYPE_3BYTE_BGR:
openGLImageFormat= GL2.GL_BGR;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_RGB;
break;
case BufferedImage.TYPE_BYTE_GRAY:
openGLImageFormat= GL2.GL_LUMINANCE;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_LUMINANCE;
break;
case BufferedImage.TYPE_CUSTOM:
ColorModel colorModel = image.getColorModel();
ColorSpace colorSpace = colorModel.getColorSpace();
if(colorSpace.getType()==ColorSpace.TYPE_GRAY) {
if(colorModel.hasAlpha()==true) {
openGLImageFormat= GL2.GL_LUMINANCE_ALPHA;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_LUMINANCE_ALPHA;
}
else {
openGLImageFormat= GL2.GL_LUMINANCE;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_LUMINANCE;
}
}
else {
errorString = "Unsupported image format."+
"\nURL="+textureBaseURL+textureURL+"\n";
retValue = false;
}
break;
}
}
catch(Throwable t) {
errorString = "Exception during image analyzing."+
"\nURL="+textureBaseURL+textureURL+"\n"+t.getMessage();
retValue = false;
}
if(!errorString.isEmpty()){
StatusPrinter.print("ERROR", errorString, Texture.class);
}
return retValue;
}