MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / run

Method run

src/main/java/trace/scratch/Scratch.java:15–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13import org.lwjgl.opengl.GL;
14import org.lwjgl.opengl.GL11;
15import org.lwjgl.opengl.GL43;
16import org.lwjgl.opengl.GLUtil;
17
18import static org.lwjgl.glfw.GLFW.*;
19import static org.lwjgl.glfw.GLFW.GLFW_STICKY_MOUSE_BUTTONS;
20
21public class Scratch implements Runnable {
22
23
24 private long window;
25
26 @Override
27 public void run() {
28
29 // experimenting with moving this initialization first. Seems to remove the occasional crash on startup?
30// new Thread(() -> {
31// System.err.println(" building the CefSystem");
32 CefSystem sys = CefSystem.cefSystem;
33// System.err.println(" finished building the CefSystem");
34// }).start();
35
36 glfwInit();
37
38 glfwWindowHint(GLFW_DEPTH_BITS, 24);
39 glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, 1);
40 glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
41 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, 1);
42 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
43 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
44 glfwWindowHint(GLFW_DOUBLEBUFFER, 1);
45 glfwWindowHint(GLFW_DECORATED, 1);
46 window = glfwCreateWindow(500, 500, "Hello?", 0, 0);
47
48 glfwSetWindowPos(window, 50, 50);
49
50 glfwSetCursorPosCallback(window, new GLFWCursorPosCallback(){
51 @Override
52 public void invoke(long window, double xpos, double ypos) {
53 System.out.println(" cursor post :"+window+" "+xpos+" "+ypos);
54 }
55 });
56 glfwShowWindow(window);
57
58 glfwMakeContextCurrent(window);
59 /*glfwSwapInterval(0);
60
61 GL11.glClearColor(0.25f, 0.25f, 0.25f, 1);
62 GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
63
64 glfwSwapBuffers(window);
65
66 glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, GL11.GL_TRUE);
67 */
68
69 GL.createCapabilities();
70
71 // Set the clear color
72 GL11.glClearColor(1.0f, 0.0f, 0.0f, 0.0f);

Callers

nothing calls this directly

Calls 2

glClearColorMethod · 0.80
glClearMethod · 0.80

Tested by

no test coverage detected