lwjgl

EXCEPTION_ACCESS_VIOLATION (0xc0000005) when trying to free memory

家住魔仙堡 提交于 2019-12-25 07:35:20
问题 When using opencl via LWJGL, I am getting the following error message: # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000002201971, pid=8476, tid=8920 # # JRE version: 7.0_03-b05 # Java VM: Java HotSpot(TM) 64-Bit Server VM (22.1-b02 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [OpenCL.dll+0x1971] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

Can not draw anything after text rendering initialization code in lwjgl (Java)

ぃ、小莉子 提交于 2019-12-25 06:55:48
问题 Hello I have two seperate initialization codes to switch between rendering 2d shapes and (2d) text in lwjgl. If the initialization code for rendering text is executed, the 2d shapes will not be drawn. I tried everything, and I found the problem line: GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); After I have done something with the glBlendFunc, I can only render tekst, and switching to the initialization code for rendering 2d shapes won't work anymore. Here are my 2 codes:

Java Opengl: Discarding Texture Background with Shaders

喜你入骨 提交于 2019-12-25 06:04:02
问题 I'm trying to follow this tutorial to remove the background color of texture with a shader. https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/discard.php Everything is running correctly, I copied the shader code directly from the tutorial, however the fragment shader is throwing several errors. sampler2D myTexture; varying vec2 vTexCoord; void main (void) { vec4 color = texture2D(myTexture, vTexCoord); if (color.rgb == vec3(1.0,0.0,0.0)) discard; gl_FragColor = color; } ERROR: 0:3:

Why do textures have to be sized a multiple of two? [duplicate]

。_饼干妹妹 提交于 2019-12-25 04:23:06
问题 This question already has answers here : Power of two textures (2 answers) Closed 5 years ago . For OpenGL rendering, the texure sizes have to be a multiple of two. Why is there this restriction? Is it related to the memory usage, or the way the GPU processes textures? Why do textures have to be sized a multiple of two? 回答1: The memory used for texture in the memory banks are optimally powers of two (even more constrained than multiple of two) in order to allow best partitioning and fastest

Java OpenGL EXCEPTION_ACCESS_VIOLATION on glDrawArrays only on NVIDIA

我只是一个虾纸丫 提交于 2019-12-25 03:45:51
问题 I'm working on a game in java using lwjgl and it's OpenGL implementation. Never had any problems until I exchanged it with a colleague who uses NVIDIA instead of AMD, and suddenly it crashes on a line that works on AMD but it only crashes at that point in the code. That is the weardest part because I use the same method to create the VBOs from .obj-files. I even tried it with the same file but still at that point it crashes on all other occasion not. Could it be maybe a wrong set flag or

LWJGL Circle program create's an oval-like shape

不想你离开。 提交于 2019-12-25 02:53:20
问题 I'm trying to draw a circle in LWJGL, but when I draw I try to draw it, it makes a shape that's more like an oval rather than a circle. Also, when I change my circleVertexCount 350+, the shape like flips out. I'm really not sure how the code works that creates the vertices(I have taken Geometry and I know the basic trig ratios). I haven't really found that good of tutorials on creating circles. Here's my code: public class Circles { // Setup variables private int WIDTH = 800; private int

How do I make a full screen in LWJGL?

孤街浪徒 提交于 2019-12-25 01:35:35
问题 I am making a game in eclipse with LWJGL and I would like to know how to make the screen go full screen by changing some of the following code. Could you help, please? public static void main(String args[]) { AppGameContainer appgc; try{ appgc = new AppGameContainer(new Game(gamename)); appgc.setDisplayMode(700, 500, false); appgc.start(); }catch(SlickException e){ e.printStackTrace(); } } 回答1: The JavaDoc says that the 3th param of setDisplayMode indicates the fullscreen flag. Try putting it

Reading images from a sprite sheet Java

て烟熏妆下的殇ゞ 提交于 2019-12-25 01:23:47
问题 I want to use sprite sheets in my game and with the research I have done found this piece of code. BufferedImage bigImg = ImageIO.read(new File("sheet.png")); // The above line throws an checked IOException which must be caught. final int width = 10; final int height = 10; final int rows = 5; final int cols = 5; BufferedImage[] sprites = new BufferedImage[rows * cols]; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { sprites[(i * cols) + j] = bigImg.getSubimage( i * width, j

BufferedImage causes a program freeze on MacOs but not on Windows

蹲街弑〆低调 提交于 2019-12-24 23:53:26
问题 I'm using a piece of code to grab a screenshot of my application screen for a group project. On my Macbook Pro the code freezes the screen whereas on my teammates's PC's (all Windows) it runs just fine and exports a .png file in their root dir. The code public void screenShot(){ //Creating an rbg array of total pixels int[] pixels = new int[WIDTH * HEIGHT]; int bindex; // allocate space for RBG pixels ByteBuffer fb = ByteBuffer.allocateDirect(WIDTH * HEIGHT * 3); // grab a copy of the current

LWJGL OpenGL glGenVertexArrays() Error: This Function is not available

為{幸葍}努か 提交于 2019-12-24 18:30:13
问题 All, Having difficulty with glGenVertexArrays(). I get the following error: Exception in thread "main" java.lang.IllegalStateException: This functionality is not available. at org.lwjgl.system.Checks.checkFunctionality(Checks.java:57) at org.lwjgl.opengl.GL30.getInstance(GL30.java:667) at org.lwjgl.opengl.GL30.getInstance(GL30.java:662) at org.lwjgl.opengl.GL30.nglGenVertexArrays(GL30.java:2789) at org.lwjgl.opengl.GL30.glGenVertexArrays(GL30.java:2816) at renderEngine.Loader.createVAO(Loader