本文整理汇总了Java中org.lwjgl.opengl.GL11.glClearColor方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glClearColor方法的具体用法?Java GL11.glClearColor怎么用?Java GL11.glClearColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glClearColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDisplay
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.renderer.SGL#initDisplay(int, int)
*/
public void initDisplay(int width, int height) {
this.width = width;
this.height = height;
String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,width,height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
示例2: initGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Initialise the GL context
*/
protected void initGL() {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,screenWidth,screenHeight);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
enterOrtho();
}
示例3: initGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Initialise the GL context
*/
protected void initGL() {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,screenWidth,screenHeight);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
enterOrtho();
}
示例4: clearColor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void clearColor(float red, float green, float blue, float alpha)
{
if (red != clearState.field_179203_b.red || green != clearState.field_179203_b.green || blue != clearState.field_179203_b.blue || alpha != clearState.field_179203_b.alpha)
{
clearState.field_179203_b.red = red;
clearState.field_179203_b.green = green;
clearState.field_179203_b.blue = blue;
clearState.field_179203_b.alpha = alpha;
GL11.glClearColor(red, green, blue, alpha);
}
}
示例5: prepare
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Prepares for a rendering pass. The depth and colour buffers of the
* current framebuffer are cleared and a few other default settings are set.
*/
private void prepare() {
GL11.glClearColor(0f, 0.66f, 0.94f, 1f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
OpenGlUtils.cullBackFaces(true);
OpenGlUtils.enableDepthTesting(true);
OpenGlUtils.antialias(true);
}
示例6: initGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Initialise the GL display
*
* @param width The width of the display
* @param height The height of the display
*/
private void initGL(int width, int height) {
try {
Display.setDisplayMode(new DisplayMode(width,height));
Display.create();
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,width,height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, width, height, 0, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
示例7: clearColor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void clearColor(float red, float green, float blue, float alpha)
{
if (red != clearState.color.red || green != clearState.color.green || blue != clearState.color.blue || alpha != clearState.color.alpha)
{
clearState.color.red = red;
clearState.color.green = green;
clearState.color.blue = blue;
clearState.color.alpha = alpha;
GL11.glClearColor(red, green, blue, alpha);
}
}
示例8: gameLoop
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void gameLoop() throws InterruptedException {
double startTime = GLFW.glfwGetTime();
double deltaTime = 0.;
double fpsSleepTime = 0.;
while (running) {
input();
update(deltaTime);
GL11.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
render();
GLFW.glfwSwapBuffers(window);
// FPS calculations
fpsSleepTime = ((1. / (double) (TARGET_FPS)) + startTime - GLFW.glfwGetTime()) * 1000.;
if (fpsSleepTime < 0.)
fpsSleepTime = 0.;
Thread.sleep((long) fpsSleepTime);
deltaTime = GLFW.glfwGetTime() - startTime;
startTime = GLFW.glfwGetTime();
if (deltaTime > 1)
deltaTime = 1;// catch framedrops
// java.lang.System.out.println("FPS: " + (1./deltaTime));
}
}
示例9: setClearColor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void setClearColor(float r, float g, float b){
r = (r > 1) ? r / 255 : r;
g = (g > 1) ? g / 255 : g;
b = (b > 1) ? b / 255 : b;
if(cr == r && cg == g && cb == b)
return;
GL11.glClearColor(r, g, b, 1);
}
示例10: prepare
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void prepare() {
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glClearColor(0.49f, 89f, 0.98f, 1);
}
示例11: createWindow
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected void createWindow()
{
// the window will stay hidden after creation
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
// Configure GLFW
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3);
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 2);
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE);
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE,
GLFW.GLFW_OPENGL_CORE_PROFILE);
// Create the window
this.handle = GLFW.glfwCreateWindow(this.width, this.height, this.title,
MemoryUtil.NULL, MemoryUtil.NULL);
if (this.handle == MemoryUtil.NULL)
{
throw new RuntimeException("Failed to create the GLFW window");
}
//Create the input context
//this.inputEngine = new InputEngine(this);
//Setup a size callback.
GLFW.glfwSetWindowSizeCallback(this.handle, (window, w, h) ->
{
int prevW = this.width;
int prevH = this.height;
this.width = w;
this.height = h;
this.onWindowSizeChanged.notifyListeners(new int[]{
this.width, this.height, prevW, prevH
});
});
//Setup a position callback
GLFW.glfwSetWindowPosCallback(this.handle, (window, xpos, ypos) -> {
int prevX = this.x;
int prevY = this.y;
this.x = xpos;
this.y = ypos;
this.onWindowPosChanged.notifyListeners(new int[]{
this.x, this.y, prevX, prevY
});
});
this.makeWindowCentered();
// Make the OpenGL context current
GLFW.glfwMakeContextCurrent(this.handle);
// Enable v-sync
GLFW.glfwSwapInterval(this.vsync ? 1 : 0);
// This line is critical for LWJGL's interoperation with GLFW's
// OpenGL context, or any context that is managed externally.
// LWJGL detects the context that is current in the current thread,
// creates the GLCapabilities instance and makes the OpenGL
// bindings available for use.
GL.createCapabilities();
System.out.println("OPENGL " + GL11.glGetString(GL11.GL_VERSION));
// Set the clear color
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//Enable depth testing
GL11.glEnable(GL11.GL_DEPTH_TEST);
//Set current viewport
this.view = new View(this);
}
示例12: setClearColor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void setClearColor(float red, float green, float blue, float alpha) {
if(!glInitilized) {
return;
}
GL11.glClearColor(red, green, blue, alpha);
}
示例13: clearColors
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void clearColors(float r, float g, float b, float a) {
GL11.glClearColor(r, g, b, a);
}
示例14: prepare
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void prepare() {
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glClearColor(0.33F, 0.33F, 0.33F, 1);
}
示例15: glClearColor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.renderer.SGL#glClearColor(float, float, float, float)
*/
public void glClearColor(float red, float green, float blue, float alpha) {
GL11.glClearColor(red, green, blue, alpha);
}