當前位置: 首頁>>代碼示例>>Java>>正文


Java GL.createCapabilities方法代碼示例

本文整理匯總了Java中org.lwjgl.opengl.GL.createCapabilities方法的典型用法代碼示例。如果您正苦於以下問題:Java GL.createCapabilities方法的具體用法?Java GL.createCapabilities怎麽用?Java GL.createCapabilities使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lwjgl.opengl.GL的用法示例。


在下文中一共展示了GL.createCapabilities方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
@Override
public void run() {
	init();
	glfwMakeContextCurrent(window);
	GL.createCapabilities();

	// Set the clear color
	glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
	while (!glfwWindowShouldClose(window)) {
		loop();
	}

	// Free the window callbacks and destroy the window
	glfwFreeCallbacks(window);
	glfwDestroyWindow(window);

	// Terminate GLFW and free the error callback
	glfwTerminate();
	glfwSetErrorCallback(errorCallback).free();
}
 
開發者ID:HuajiStudio,項目名稱:ChessMaster,代碼行數:21,代碼來源:RenderLoop.java

示例2: init

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
/**
 * Initialize default state.
 */
private void init() {
    if (glfwInit() != GL_TRUE) {
        throw new IllegalStateException("GLFW failed to initialize!");
    }

    win = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, TITLE, 0, 0);
    glfwShowWindow(win);
    glfwMakeContextCurrent(win);

    GLContext.createFromCurrent();
    GL.createCapabilities(true);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
 
開發者ID:DeadRunningOnTray,項目名稱:Prepare4LudumDare,代碼行數:19,代碼來源:Game.java

示例3: OpenGLEngine

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
public OpenGLEngine() {
	// Set OpenGL context
	GL.createCapabilities();
 
	// Set the clear color
	glClearColor(0.0f, 0.4f, 0.8f, 0.0f);
	
	// Enable transparent textures
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_BLEND); 
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	
	renderQueue = new RenderQueue();
       
	// TODO shader support
       shader = new ShaderProgram(
		new Shader("shaders/vertex.glsl", GL20.GL_VERTEX_SHADER),
		new Shader("shaders/fragment.glsl", GL20.GL_FRAGMENT_SHADER)
	);
}
 
開發者ID:tacocat,項目名稱:lambda,代碼行數:21,代碼來源:OpenGLEngine.java

示例4: initGL

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
/**
 * Initializes the GL parameters
 */
private void initGL() {
	GL.createCapabilities();

       for (int flag : GL_FLAGS) {
       	glEnable(flag);
       }

       glClearColor(Colour.BACKDROP[0], Colour.BACKDROP[1], Colour.BACKDROP[2], Colour.BACKDROP[3]);

	// Matrix Initialization
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();

       // Define frustum
       float yTop  = (float) (VIEW_Z_NEAR * Math.tan(Math.toRadians(VIEW_FOV / 2)));
    float xLeft = yTop * VIEW_ASPECT;
    glFrustum(xLeft, -xLeft, -yTop, yTop, VIEW_Z_NEAR, VIEW_Z_FAR);

       glMatrixMode(GL_MODELVIEW);
       glLoadIdentity();
}
 
開發者ID:Mandrenkov,項目名稱:Geoscape,代碼行數:25,代碼來源:Window.java

示例5: loop

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
public void loop(){
	GL.createCapabilities();

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glClearColor(0, 0, 0, 1);

	screen = new MainScreen(w);
	w.navigate(screen);

	while(!w.shouldClose()){
		w.loop();
	}
}
 
開發者ID:jason-yang31415,項目名稱:gl3DGE,代碼行數:19,代碼來源:LightingDemo.java

示例6: create

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
/**
 * Initializes the GLFW display and GL capabilities.
 */
public void create()
{
	if (glfwInit() != GLFW_TRUE)
		throw new RuntimeException("Could not init GLFW.");
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	window = glfwCreateWindow(width, height, title, 0, 0);

	if (window == 0)
	{
		glfwTerminate();
		throw new RuntimeException("Window pointer is NULL.");
	}

	glfwMakeContextCurrent(window);
	glfwSwapInterval(vSync ? 1 : 0);
	GL.createCapabilities(true);
	glfwSetInputMode(window, GLFW_STICKY_KEYS, GLFW_TRUE);
	isCreated = true;
}
 
開發者ID:jibini-media,項目名稱:lwjgl-utils,代碼行數:26,代碼來源:Display.java

示例7: Window

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
/**
 * Create a window
 *
 * @param title               The window title
 * @param width               The window width
 * @param height              The window height
 * @param fullscreen          Wether it should be a fullscreen window
 * @param fullscreenVideoMode The video mode (ignored if fullscreen is <code>false</code>)
 * @param monitor             The monitor to put the window on (ignored if fullscreen is <code>false</code>)
 */
public Window(String title, int width, int height, boolean fullscreen, @Nullable GLFWVidMode fullscreenVideoMode, long monitor) {
	this.width = width;
	this.height = height;
	this.title = title;
	this.fullscreen = fullscreen;

	if (fullscreen) {
		GLFW.glfwWindowHint(GLFW.GLFW_RED_BITS, fullscreenVideoMode.redBits());
		GLFW.glfwWindowHint(GLFW.GLFW_GREEN_BITS, fullscreenVideoMode.greenBits());
		GLFW.glfwWindowHint(GLFW.GLFW_BLUE_BITS, fullscreenVideoMode.blueBits());
		GLFW.glfwWindowHint(GLFW.GLFW_REFRESH_RATE, fullscreenVideoMode.refreshRate());
		width = fullscreenVideoMode.width();
		height = fullscreenVideoMode.height();
	}

	window = GLFW.glfwCreateWindow(width, height, title, fullscreen ? monitor : MemoryUtil.NULL, MemoryUtil.NULL
	);
	GLFW.glfwMakeContextCurrent(window);
	GLFW.glfwSwapInterval(0);
	glCapabilities = GL.createCapabilities();
	initCallbacks();
	setCursorEnabled(cursorEnabled);
}
 
開發者ID:warlockcodes,項目名稱:Null-Engine,代碼行數:34,代碼來源:Window.java

示例8: getGLVersion

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
@UIEffect
private String getGLVersion(boolean es) {
	String fullVersion;
	String renderer;
	
	if (es) {
		GLES.createCapabilities();
		fullVersion = GLES20.glGetString(GLES20.GL_VERSION);
		renderer = GLES20.glGetString(GLES20.GL_RENDERER);
	} else {
		GL.createCapabilities();
		fullVersion = GL11.glGetString(GL11.GL_VERSION);
		renderer = GL11.glGetString(GL11.GL_RENDERER);
	}
	
	log.info("{}", fullVersion);
	log.info("{}", renderer);
	
	String version = fullVersion.split(" ", 2)[0];
	return version;
}
 
開發者ID:mav-assistant,項目名稱:Mavkit,代碼行數:22,代碼來源:Display.java

示例9: loop

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
void loop() {
    GL.createCapabilities();

    glClearColor(0.99f, 0.99f, 0.99f, 1.0f);
    glLineWidth(1.8f);

    while (!glfwWindowShouldClose(window)) {
        glViewport(0, 0, fbWidth, fbHeight);
        glClear(GL_COLOR_BUFFER_BIT);

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, fbWidth, fbHeight, 0, -1, 1);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

        renderPolygon();

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    // autosave current polygon
    // store("autopoly.gon");
}
 
開發者ID:JOML-CI,項目名稱:joml-lwjgl3-demos,代碼行數:26,代碼來源:PolygonDrawer.java

示例10: setUp

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    window = new Window();
    window.setup();

    GLFW.glfwMakeContextCurrent(window.getWindowHandler());
    GL.createCapabilities();
    final String VERTEX_SHADER_STRING = "#version 100\n" +
            "\n" +
            "uniform mat4 projTrans;\n" +
            "\n" +
            "attribute vec2 Position;\n" +
            "attribute vec2 TexCoord;\n" +
            "\n" +
            "varying vec2 vTexCoord;\n" +
            "\n" +
            "void main() {\n" +
            "    vTexCoord = TexCoord;\n" +
            "    gl_Position = 80.0 * vec4(Position, 0.0, 1.0);\n" +
            "}";
    shader = new Shader(ShaderUtil.VERTEX_SHADER, VERTEX_SHADER_STRING);
}
 
開發者ID:agent6262,項目名稱:Abstract-Java-Game-Library,代碼行數:23,代碼來源:ShaderProgramTest.java

示例11: create

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
public void create()
{
	glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);	
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);	
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);	
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);	
	
	setId(glfwCreateWindow(getWidth(), getHeight(), "OE3", 0, 0));
	
	if(getId() == 0) {
	    throw new RuntimeException("Failed to create window");
	}
	
	setIcon("textures/logo/oreon_lwjgl_icon32.png");
	
	glfwMakeContextCurrent(getId());
	glfwSwapInterval(0);
	glfwShowWindow(getId());
	capabilities = GL.createCapabilities();
}
 
開發者ID:oreonengine,項目名稱:oreon-engine,代碼行數:21,代碼來源:GLWindow.java

示例12: loop

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
void loop() {
    glfwMakeContextCurrent(window);
    GL.createCapabilities();
    glClearColor(0.97f, 0.97f, 0.97f, 1.0f);
    while (!glfwWindowShouldClose(window)) {
        glfwPollEvents();
        glViewport(0, 0, fbWidth, fbHeight);
        viewport[2] = fbWidth; viewport[3] = fbHeight;
        glClear(GL_COLOR_BUFFER_BIT);
        computeVisibleExtents();
        glMatrixMode(GL_PROJECTION);
        glLoadMatrixf(cam.viewproj().get(fb));
        renderGrid();
        renderTickLabels();
        //renderMouseCursorCoordinates();
        glfwSwapBuffers(window);
    }
}
 
開發者ID:JOML-CI,項目名稱:joml-lwjgl3-demos,代碼行數:19,代碼來源:CoordinateSystemDemo.java

示例13: init

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
/**
 * Create window and OpenGL context
 * @param title Window title
 * @param width Window width
 * @param height Window height
 * @param resizable Should the window be resizable
 * @param game CoreGame instance
 */
public static void init(String title, int width, int height, boolean resizable, CoreGame game) {
	if (!glfwInit()) {
		System.err.println("Could not initialize window system!");
		System.exit(1);
	}
	
	if (!resizable)
		glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
	if (anti_alias)
		glfwWindowHint(GLFW_SAMPLES, 4);
	
	window = glfwCreateWindow(width, height, title, 0, 0);
	if (window == 0) {
		glfwTerminate();
		System.err.println("Could not create window!");
		System.exit(1);
	}
	
	glfwMakeContextCurrent(window);
	GL.createCapabilities();

	GLFWVidMode vidMode = glfwGetVideoMode(window);
	glfwSetWindowPos(window, (vidMode.width() / 2) - (width / 2), (vidMode.height() / 2) - (height / 2));
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, width, height, 0, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	
	if (anti_alias) glEnable(GL_MULTISAMPLE);
	
	Window.game = game;
	Window.render = new Render();
	
	AudioPlayer.init();
	
	start();
}
 
開發者ID:jonahisadev,項目名稱:SquareOne,代碼行數:48,代碼來源:Window.java

示例14: create

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
public void create(int width, int height)
{
	setWidth(width);
	setHeight(height);
	
	glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);	
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);	
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);	
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);	
	
	window = glfwCreateWindow(width, height, "OREON ENGINE Programming Tutorial Series", 0, 0);
	
	if(window == 0) {
	    throw new RuntimeException("Failed to create window");
	}
	
	ByteBuffer bufferedImage = ImageLoader.loadImageToByteBuffer("./res/logo/oreon_lwjgl_icon32.png");
	
	GLFWImage image = GLFWImage.malloc();
	
	image.set(32, 32, bufferedImage);
	
	GLFWImage.Buffer images = GLFWImage.malloc(1);
       images.put(0, image);
	
	glfwSetWindowIcon(window, images);
	
	glfwMakeContextCurrent(window);
	GL.createCapabilities();
	glfwShowWindow(window);
}
 
開發者ID:oreonengine,項目名稱:Lwjgl3-Game-Engine-Programming-Series,代碼行數:32,代碼來源:Window.java

示例15: init

import org.lwjgl.opengl.GL; //導入方法依賴的package包/類
/**
   * Initializes the GLFW library, creating a window and any necessary shaders.
   */
  void init(GameState gameState, Main client) {
      if (!glfwInit()) {
          System.err.println("Failed to initialise GLFW");
          System.exit(1);
      }
      glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
      window = glfwCreateWindow(windowWidth, windowHeight, Constants.TITLE, 0, 0);
      if (window == 0) {
          System.err.println("Failed to create window.");
          System.exit(1);
      }

      GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
      int windowXPosition = (videoMode.width() - windowWidth) / 2;
      int windowYPosition = (videoMode.height() - windowHeight) / 2;
      glfwSetWindowPos(window, windowXPosition, windowYPosition);

      glfwShowWindow(window);
      glfwMakeContextCurrent(window);

      GL.createCapabilities();
      cshader = new ShaderProgram("shaders/cshader.vs","shaders/shader.fs");
rshader = new ShaderProgram("shaders/rshader.vs","shaders/shader.fs");
pshader1 = new ShaderProgram("shaders/pshader.vs","shaders/shader.fs");
pshader2 = new ShaderProgram("shaders/pshader2.vs","shaders/shader.fs");
pshader3 = new ShaderProgram("shaders/pshader3.vs","shaders/shader.fs");
starshader = new ShaderProgram("shaders/starshader.vs","shaders/shader.fs");

      registerInputCallbacks(gameState, client);
  }
 
開發者ID:TauOmicronMu,項目名稱:TeamProject,代碼行數:34,代碼來源:Window.java


注:本文中的org.lwjgl.opengl.GL.createCapabilities方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。