lwjgl

OpenGL cube vertices are wrong

*爱你&永不变心* 提交于 2019-12-12 06:42:57
问题 I've been trying to solve the problem of my cube vertices being incorrect for well over a day now without much luck. I've tried about 10 different vertex arrays, but none have worked. The problem is that I don't really understand how someone goes about figuring out what number goes where, so I can't really debug it myself. Here is my code at the moment. I think it's relatively straightforward for someone familiar with OpenGL, but if you have any questions ask. EDIT: The problem now is that

Make the player go towards the mouse - Slick & Java

柔情痞子 提交于 2019-12-12 04:57:26
问题 So here is my problem: I'm a (new) java programmer and I need help for the game I am developing with Slick and LWJGL. What I want to do is really simple: make the player (or the image representing the player) head towards the mouse once I hold down the mouse button. I don't want it to rotate towards the player. Here's what my "Play" class looks like: package com.stuntmania.game; import org.lwjgl.input.Mouse; import org.newdawn.slick.Animation; import org.newdawn.slick.Color; import org

Java - how to use the vertex buffers object in LWJGL?

≯℡__Kan透↙ 提交于 2019-12-12 04:34:55
问题 I am trying to use the vertex buffers object. At first there wasn't any problem until I got into this nasty situation: glPointSize(2.0f); glBegin(GL_POINTS); for (Entity p : points) { glVertex3f(p.x, p.y, p.z); } glEnd(); How can I convert this into the Vertex Buffers Object render? I mean as you can see, the data (x, y, z) are changed every time for each point (it's a loop ). So how can i implement the Vertex Buffers Object render into this? 回答1: Basically what you want it putting all the

LWJGL3 shader, triangle not showing up

China☆狼群 提交于 2019-12-12 03:58:33
问题 I'm new to OpenGL and LWJGL3 and I'm trying to render a triangle. However, it isn't showing up, only the white, empty window. I guess it's a pretty small piece that I somehow forgot or where I just made a mistake. I don't find it after searching for hours now though. Here's the code: MainLoop: import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL20.*; import static org.lwjgl.opengl.GL30.*; import static org.lwjgl.glfw.GLFW.*; public

Why won't eclipse show lwjgl imports in the “quick fix” menu?

拈花ヽ惹草 提交于 2019-12-12 03:04:10
问题 I have tried everything mentioned in this question with no success. I have also tried deleting the entire workspace and letting eclipse generate a new one, and setting access restrictions. Deleting my installation of eclipse manually and deleting the eclipse folder in my user folder (windows 10), then reinstalling a fresh download of eclipse didn't work. eclipse will clean imports just fine. i could import something general, like an entire class, and eclipse will make more specific imports by

Render perspective projection matrix in LWJGL 3

拥有回忆 提交于 2019-12-12 03:03:34
问题 When adding a perspective projection matrix to my vertex shader the textured quad is not visible. shader.vert #version 400 in vec3 position; in vec2 textureCoordinate; out vec3 colour; out vec2 passTextureCoordinate; uniform mat4 transformationMatrix; uniform mat4 projectionMatrix; void main() { gl_Position = projectionMatrix * transformationMatrix * vec4(position, 1.0); passTextureCoordinate = textureCoordinate; colour = vec3(position.x+.5f, 0.0, position.y+.5f); } When I set the

Can't use LWJGL correctly, code giving errors

与世无争的帅哥 提交于 2019-12-12 02:55:22
问题 I'm trying to run this code that is used to see if things were setup properly: package simpleslickgame; import java.util.logging.Level; import java.util.logging.Logger; import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.BasicGame; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; public class SimpleSlickGame extends BasicGame { public SimpleSlickGame(String gamename) { super(gamename); } @Override public void

There is no OpenGL ES context current in the current thread - LWJGL using OpenGL ES 3.0

早过忘川 提交于 2019-12-12 02:07:59
问题 I am trying to use LWJGL using the Get Started example (from https://www.lwjgl.org/guide {which unaltered works fine}), but altering it so it uses OpenGL ES 3.0 instead (for reasons irrelevant to this question). I am using the latest LWJGL Release 3.1.1, selecting Minimal OpenGL ES as my preset (from https://www.lwjgl.org/download) and using windows natives. (I am running Windows 10 64bit) I'm stuck--I'm not sure how to fix it, and get it to run. The error I get is: Exception in thread "main"

OpenGL drawing triangle doesn't show + glClearColor not setting screen color

浪尽此生 提交于 2019-12-12 01:23:47
问题 I have a project im working on where it creates a window, creates the vertex and shaders, shader program, MemoryBuffer, etc... I have gotten through a ton of errors so far, and there are no errors when I run the code. The glClearColor() call doesn't set the screen color, and no triangle is drawn. Tutorial I'm following: https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Rendering Main: public class DungeonRunners { private double lastTick; private float timeCount; private int fps; private

Loading Tile Maps From Text Files In Slick2D

柔情痞子 提交于 2019-12-12 01:04:42
问题 I am making a fairly simple 2D Game Engine in Java using the Slick2D Library, and am trying to load levels (tile maps) from a text file. I want to be able to load in multiple different tilesets, and therefore don't want to assign each number to a tile like this: 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1 1 (Where 1 is a wall and 0 is a floor) instead, I would like to be able to use x and y coordinates in the tilemap to represent how many tiles across and down the tile is located at on