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


Java DisplayMode.getBitsPerPixel方法代码示例

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


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

示例1: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode getDisplayMode(Dimension p_getDisplayMode_0_) throws LWJGLException
{
    DisplayMode[] adisplaymode = Display.getAvailableDisplayModes();

    for (int i = 0; i < adisplaymode.length; ++i)
    {
        DisplayMode displaymode = adisplaymode[i];

        if (displaymode.getWidth() == p_getDisplayMode_0_.width && displaymode.getHeight() == p_getDisplayMode_0_.height && (desktopDisplayMode == null || displaymode.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && displaymode.getFrequency() == desktopDisplayMode.getFrequency()))
        {
            return displaymode;
        }
    }

    return desktopDisplayMode;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:Config.java

示例2: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private static DisplayMode getDisplayMode(DisplayMode[] p_getDisplayMode_0_, DisplayMode p_getDisplayMode_1_)
{
    if (p_getDisplayMode_1_ != null)
    {
        for (int i = 0; i < p_getDisplayMode_0_.length; ++i)
        {
            DisplayMode displaymode = p_getDisplayMode_0_[i];

            if (displaymode.getBitsPerPixel() == p_getDisplayMode_1_.getBitsPerPixel() && displaymode.getFrequency() == p_getDisplayMode_1_.getFrequency())
            {
                return displaymode;
            }
        }
    }

    if (p_getDisplayMode_0_.length <= 0)
    {
        return null;
    }
    else
    {
        Arrays.sort(p_getDisplayMode_0_, new DisplayModeComparator());
        return p_getDisplayMode_0_[p_getDisplayMode_0_.length - 1];
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:Config.java

示例3: findFullscreenDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
/**
 * from org.newdawn.slick.AppGameContainer#setDisplayMode
 */
public static DisplayMode findFullscreenDisplayMode(int targetBPP, int targetFrequency, int width, int height) throws LWJGLException {
	DisplayMode[] modes = Display.getAvailableDisplayModes();
	DisplayMode foundMode = null;
	int freq = 0;
	int bpp = 0;

	for (DisplayMode current : modes) {
		if (current.getWidth() != width || current.getHeight() != height) {
			continue;
		}

		if (current.getBitsPerPixel() == targetBPP && current.getFrequency() == targetFrequency) {
			return current;
		}

		if (current.getFrequency() >= freq && (foundMode == null || current.getBitsPerPixel() >= bpp)) {
			foundMode = current;
			freq = foundMode.getFrequency();
			bpp = foundMode.getBitsPerPixel();
		}
	}
	return foundMode;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:27,代码来源:GLHelper.java

示例4: getFullscreenDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
protected DisplayMode getFullscreenDisplayMode(int width, int height, int bpp, int freq){
    try {
        DisplayMode[] modes = Display.getAvailableDisplayModes();
        for (DisplayMode mode : modes){
            if (mode.getWidth() == width
             && mode.getHeight() == height
             && (mode.getBitsPerPixel() == bpp || (bpp==24&&mode.getBitsPerPixel()==32))
             && mode.getFrequency() == freq){
                return mode;
            }
        }
    } catch (LWJGLException ex) {
        listener.handleError("Failed to acquire fullscreen display mode!", ex);
    }
    return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:LwjglDisplay.java

示例5: compare

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
@Override
public int compare(DisplayMode a, DisplayMode b)
{
	if (a.getWidth() != b.getWidth())
	{
		return (a.getWidth() > b.getWidth()) ? 1 : -1;
	}
	if (a.getHeight() != b.getHeight())
	{
		return (a.getHeight() > b.getHeight()) ? 1 : -1;
	}
	if (a.getBitsPerPixel() != b.getBitsPerPixel())
	{
		return (a.getBitsPerPixel() > b.getBitsPerPixel()) ? 1 : -1;
	}
	if (a.getFrequency() != b.getFrequency())
	{
		return (a.getFrequency() > b.getFrequency()) ? 1 : -1;
	}
	return 0;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:22,代码来源:DisplayModeComparator.java

示例6: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode getDisplayMode(Dimension dim) throws LWJGLException
{
    DisplayMode[] modes = Display.getAvailableDisplayModes();

    for (int i = 0; i < modes.length; ++i)
    {
        DisplayMode dm = modes[i];

        if (dm.getWidth() == dim.width && dm.getHeight() == dim.height && (desktopDisplayMode == null || dm.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && dm.getFrequency() == desktopDisplayMode.getFrequency()))
        {
            return dm;
        }
    }

    return desktopDisplayMode;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:17,代码来源:Config.java

示例7: getFrequencies

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private List<Integer> getFrequencies()
{
	List<DisplayMode> modes = resolutionMap.get(getSelectedResolution());
	List<Integer> freqs = new ArrayList<Integer>();
	
	if (modes != null)
	{
		for (DisplayMode mode:modes)
		{
			if (getSelectedBitsPerPixel()<0 || mode.getBitsPerPixel() == getSelectedBitsPerPixel())
			{
				if (!freqs.contains(mode.getFrequency()))
					freqs.add(mode.getFrequency());
			}
		}
	}
	Collections.sort(freqs);
	return freqs;
}
 
开发者ID:sambayless,项目名称:golems,代码行数:20,代码来源:DisplayModeTab.java

示例8: findBestDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode findBestDisplayMode(int width, int height) {
    DisplayMode desktopMode = Display.getDesktopDisplayMode();
    if (width == desktopMode.getWidth() && height == desktopMode.getHeight()) {
        return desktopMode;
    }
    DisplayMode bestMode = null;
    try {
        for (DisplayMode m : Display.getAvailableDisplayModes()) {
            if (width == m.getWidth() && height == m.getHeight()) {
                if (null == bestMode
                        || (m.isFullscreenCapable() && !bestMode.isFullscreenCapable())
                        || (m.getBitsPerPixel() > bestMode.getBitsPerPixel())
                        || m.getFrequency() > bestMode.getFrequency()) {
                    bestMode = m;
                }
            }
        }
        if (null != bestMode) {
            return bestMode;
        }
    } catch (LWJGLException ex) {
        Logger.getLogger(LwjglHelper.class.getName()).log(Level.SEVERE, null, ex);
    }
    return new DisplayMode(width, height);
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:26,代码来源:LwjglHelper.java

示例9: create

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
@Override
public void create() {
	try {
		// Get the desktop display mode
		final DisplayMode mode = Display.getDesktopDisplayMode();
		// Create the pixel format
		final PixelFormat format = new PixelFormat(mode.getBitsPerPixel(), 8, 8, 0, 0);
		// Create the context attrib
		ContextAttribs attribs = new ContextAttribs(getGLVersion().getMajor(), getGLVersion().getMinor());
		attribs = attribs.withProfileCore(true);
		attribs = attribs.withDebug(true);
		// Create the display
		Display.create(format, attribs);
		super.create();
	} catch (LWJGLException ex) {
		throw new IllegalStateException("Unable to create display!", ex);
	}
	setWindowTitle("Fusion Engine | Version: " + Engine.ENGINE_VERSION);
	setClearColour(0.0f, 0.35f, 0.75f);
	setWindowSize(800, 600);
	enableVSync(true);
}
 
开发者ID:thehutch,项目名称:Fusion,代码行数:23,代码来源:OpenGL30Context.java

示例10: isSuitableFullScreenResolution

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private boolean isSuitableFullScreenResolution(DisplayMode resolution, DisplayMode desktopResolution) {
	if (resolution.getBitsPerPixel() == desktopResolution.getBitsPerPixel()) {
		if (resolution.getFrequency() == desktopResolution.getFrequency()) {
			float desktopAspect = (float) desktopResolution.getWidth() / desktopResolution.getHeight();
			float resAspect = (float) resolution.getWidth() / resolution.getHeight();
			float check = resAspect / desktopAspect;
			if (check > 0.95f && check < 1.05f) {
				return resolution.getHeight() > MIN_HEIGHT;
			}
		}
	}
	return false;
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:14,代码来源:Window.java

示例11: getFullscreenDisplayModes

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode[] getFullscreenDisplayModes()
{
    try
    {
        DisplayMode[] adisplaymode = Display.getAvailableDisplayModes();
        List list = new ArrayList();

        for (int i = 0; i < adisplaymode.length; ++i)
        {
            DisplayMode displaymode = adisplaymode[i];

            if (desktopDisplayMode == null || displaymode.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && displaymode.getFrequency() == desktopDisplayMode.getFrequency())
            {
                list.add(displaymode);
            }
        }

        DisplayMode[] adisplaymode1 = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()]));
        Comparator comparator = new Comparator()
        {
            public int compare(Object p_compare_1_, Object p_compare_2_)
            {
                DisplayMode displaymode1 = (DisplayMode)p_compare_1_;
                DisplayMode displaymode2 = (DisplayMode)p_compare_2_;
                return displaymode1.getWidth() != displaymode2.getWidth() ? displaymode2.getWidth() - displaymode1.getWidth() : (displaymode1.getHeight() != displaymode2.getHeight() ? displaymode2.getHeight() - displaymode1.getHeight() : 0);
            }
        };
        Arrays.sort(adisplaymode1, comparator);
        return adisplaymode1;
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
        return new DisplayMode[] {desktopDisplayMode};
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:37,代码来源:Config.java

示例12: isSuitableFullScreenResolution

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private boolean isSuitableFullScreenResolution(DisplayMode resolution, DisplayMode desktopResolution) {
    if (resolution.getBitsPerPixel() == desktopResolution.getBitsPerPixel()) {
        if (resolution.getFrequency() == desktopResolution.getFrequency()) {
            float desktopAspect = (float) desktopResolution.getWidth() / desktopResolution.getHeight();
            float resAspect = (float) resolution.getWidth() / resolution.getHeight();
            float check = resAspect / desktopAspect;
            if (check > 0.95f && check < 1.05f) {
                return resolution.getHeight() > MIN_HEIGHT;
            }
        }
    }
    return false;
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:14,代码来源:Window.java

示例13: findDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
/**
 * Retrieves a displaymode, if one such is available
 *
 * @param width Required width
 * @param height Required height
 * @param bpp Minimum required bits per pixel
 * @return
 */
private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException {
  DisplayMode[] modes = Display.getAvailableDisplayModes();
 for ( DisplayMode mode : modes ) {
  if ( mode.getWidth() == width && mode.getHeight() == height && mode.getBitsPerPixel() >= bpp )
	  return mode;
 }
  return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:PbufferTest.java

示例14: getCurrentDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
/**
 * Gets the current display mode.
 *
 * @param modes
 *            the modes
 * @return the current display mode
 */
public DisplayMode getCurrentDisplayMode(DisplayMode[] modes)
{
	for (DisplayMode m : modes)
	{
		if ((m.getHeight() == prefs.getHeight()) && (m.getWidth() == prefs.getWidth()) && (m.getBitsPerPixel() == prefs.getBitsPerPixel()) && (m.getFrequency() == prefs.getFrequency()))
		{
			return m;
		}
	}

	return null;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:20,代码来源:DisplayConfigPanel.java

示例15: getCurrentDisplayModeIndex

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
/**
 * Gets the current display mode index.
 *
 * @param modes
 *            the modes
 * @return the current display mode index
 */
private int getCurrentDisplayModeIndex(DisplayMode[] modes)
{
	for (int i = 0; i < modes.length; i++)
	{
		DisplayMode m = modes[i];

		if ((m.getHeight() == prefs.getHeight()) && (m.getWidth() == prefs.getWidth()) && (m.getBitsPerPixel() == prefs.getBitsPerPixel()) && (m.getFrequency() == prefs.getFrequency()))
		{
			return i;
		}
	}

	return -1;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:22,代码来源:DisplayConfigPanel.java


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