当前位置: 首页>>代码示例>>Java>>正文


Java Texture.Type方法代码示例

本文整理汇总了Java中com.jme3.texture.Texture.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.Type方法的具体用法?Java Texture.Type怎么用?Java Texture.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.texture.Texture的用法示例。


在下文中一共展示了Texture.Type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertTextureType

import com.jme3.texture.Texture; //导入方法依赖的package包/类
/*********************************************************************\
|* Textures                                                          *|
\*********************************************************************/
private int convertTextureType(Texture.Type type, int samples) {
    switch (type) {
        case TwoDimensional:
            if (samples > 1) {
                return ARBTextureMultisample.GL_TEXTURE_2D_MULTISAMPLE;
            } else {
                return GL_TEXTURE_2D;
            }
        case TwoDimensionalArray:
            if (samples > 1) {
                return ARBTextureMultisample.GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
            } else {
                return EXTTextureArray.GL_TEXTURE_2D_ARRAY_EXT;
            }
        case ThreeDimensional:
            return GL_TEXTURE_3D;
        case CubeMap:
            return GL_TEXTURE_CUBE_MAP;
        default:
            throw new UnsupportedOperationException("Unknown texture type: " + type);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:LwjglRenderer.java

示例2: convertTextureType

import com.jme3.texture.Texture; //导入方法依赖的package包/类
private int convertTextureType(Texture.Type type) {
        switch (type) {
            case TwoDimensional:
                return GL_TEXTURE_2D;
//            case ThreeDimensional:
//                return GL_TEXTURE_3D;
//            case CubeMap:
//                return GL_TEXTURE_CUBE_MAP;
            default:
                throw new UnsupportedOperationException("Unknown texture type: " + type);
        }
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:LwjglGL1Renderer.java

示例3: updateTexImageData

import com.jme3.texture.Texture; //导入方法依赖的package包/类
public void updateTexImageData(Image img, Texture.Type type, boolean mips, int unit) {
        int texId = img.getId();
        if (texId == -1) {
            // create texture
            glGenTextures(ib1);
            texId = ib1.get(0);
            img.setId(texId);
            objManager.registerForCleanup(img);

            statistics.onNewTexture();
        }

        // bind texture
        int target = convertTextureType(type);
//        if (context.boundTextureUnit != unit) {
//            glActiveTexture(GL_TEXTURE0 + unit);
//            context.boundTextureUnit = unit;
//        }
        if (context.boundTextures[unit] != img) {
            glEnable(target);
            glBindTexture(target, texId);
            context.boundTextures[unit] = img;

            statistics.onTextureUse(img, true);
        }

        // Check sizes if graphics card doesn't support NPOT
        if (!GLContext.getCapabilities().GL_ARB_texture_non_power_of_two) {
            if (img.getWidth() != 0 && img.getHeight() != 0) {
                if (!FastMath.isPowerOfTwo(img.getWidth())
                        || !FastMath.isPowerOfTwo(img.getHeight())
                        || img.getWidth() != img.getHeight()) {

                    // Resize texture to Power-of-2 size
                    MipMapGenerator.resizeToPowerOf2(img);

                }
            }
        }

        if (!img.hasMipmaps() && mips) {
            // No pregenerated mips available,
            // generate from base level if required

            // Check if hardware mips are supported
            if (GLContext.getCapabilities().OpenGL14) {
                glTexParameteri(target, GL14.GL_GENERATE_MIPMAP, GL_TRUE);
            } else {
                MipMapGenerator.generateMipMaps(img);
            }
        } else {
        }

        /*
        if (target == GL_TEXTURE_CUBE_MAP) {
        List<ByteBuffer> data = img.getData();
        if (data.size() != 6) {
        logger.log(Level.WARNING, "Invalid texture: {0}\n"
        + "Cubemap textures must contain 6 data units.", img);
        return;
        }
        for (int i = 0; i < 6; i++) {
        TextureUtil.uploadTexture(img, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, i, 0, tdc);
        }
        } else if (target == EXTTextureArray.GL_TEXTURE_2D_ARRAY_EXT) {
        List<ByteBuffer> data = img.getData();
        // -1 index specifies prepare data for 2D Array
        TextureUtil.uploadTexture(img, target, -1, 0, tdc);
        for (int i = 0; i < data.size(); i++) {
        // upload each slice of 2D array in turn
        // this time with the appropriate index
        TextureUtil.uploadTexture(img, target, i, 0, tdc);
        }
        } else {*/
        TextureUtil.uploadTexture(img, target, 0, 0, false);
        //}

        img.clearUpdateNeeded();
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:80,代码来源:LwjglGL1Renderer.java

示例4: bindImage

import com.jme3.texture.Texture; //导入方法依赖的package包/类
@Override
public Image bindImage(com.jme3.texture.Image image, Texture.Type type, int i, MemoryAccess ma) {
	if ((flags & FLAG_LOG_CREATION) != 0) LOG.log(Level.INFO, "{0}: bind image {1} with texture type {2} mipmap level {3} and mem access {4}", new Object[]{this, image, type, i, ma});
	return new LoggingImage(delegate.bindImage(image, type, i, ma), flags);
}
 
开发者ID:shamanDevel,项目名称:jME3-OpenCL-Library,代码行数:6,代码来源:LoggingContextFactory.java

示例5: bindImage

import com.jme3.texture.Texture; //导入方法依赖的package包/类
@Override
public Image bindImage(com.jme3.texture.Image image, Texture.Type type, int i, MemoryAccess ma) {
	return new DebugImage(delegate.bindImage(image, type, i, ma), flags, true);
}
 
开发者ID:shamanDevel,项目名称:jME3-OpenCL-Library,代码行数:5,代码来源:DebugContextFactory.java


注:本文中的com.jme3.texture.Texture.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。