Tomorrow Actually maybe Saturday (it's the last exam tomorrow and we are going to the pub afterwards ).EcazS wrote:Do it! Do it naow!
Reason: It needs a launcher to handle the downloading of the correct lwjgl stuff and I haven’t made that yet.
Tomorrow Actually maybe Saturday (it's the last exam tomorrow and we are going to the pub afterwards ).EcazS wrote:Do it! Do it naow!
That's pretty low considering the amount of geometry. The applet loaders seems really buggy or something, I've made some big changes since then so I'll make a proper downloadable version for the next onebowersbros wrote:Gives me an fps of 489. maybe that has something to do with it?
It's actually really easyTemor wrote:Now that's cool. I will definitely take a look at LWJGL
// build VBO this.dataVBOId = ARBVertexBufferObject.glGenBuffersARB(); this.indexVBOId = ARBVertexBufferObject.glGenBuffersARB(); int intSize = Integer.SIZE / 8; int floatSize = Float.SIZE / 8; int doubleSize = Double.SIZE / 8; this.vertexSize = doubleSize * 3; this.normalSize = doubleSize * 3; this.colourSize = floatSize * 4; this.totalVertices = 8; this.VBOElementSize = this.vertexSize + this.normalSize + this.colourSize; int totalDataSize = this.VBOElementSize * this.totalVertices; int totalIndexSize = intSize * this.totalVertices; ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.dataVBOId); ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, totalDataSize, ARBVertexBufferObject.GL_STATIC_DRAW_ARB); ByteBuffer dataBuffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, ARBVertexBufferObject.GL_WRITE_ONLY_ARB, totalDataSize, null); // base dataBuffer.putDouble(-20).putDouble(20).putDouble(0.1); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1); dataBuffer.putDouble(20).putDouble(20).putDouble(0.1); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1); dataBuffer.putDouble(20).putDouble(-20).putDouble(0.1); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1); dataBuffer.putDouble(-20).putDouble(-20).putDouble(0.1); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1); // gun dataBuffer.putDouble(-6).putDouble(26).putDouble(0.2); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1); dataBuffer.putDouble(6).putDouble(26).putDouble(0.2); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1); dataBuffer.putDouble(6).putDouble(4).putDouble(0.2); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1); dataBuffer.putDouble(-6).putDouble(4).putDouble(0.2); dataBuffer.putDouble(0).putDouble(0).putDouble(1); dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1); dataBuffer.flip(); ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, this.indexVBOId); ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, totalIndexSize, ARBVertexBufferObject.GL_STATIC_DRAW_ARB); ByteBuffer indexBuffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, ARBVertexBufferObject.GL_WRITE_ONLY_ARB, totalIndexSize, null); for (int i = 0; i < this.totalVertices; ++i){ indexBuffer.putInt(i); } indexBuffer.flip(); ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0); // render VBO GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.dataVBOId); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, this.indexVBOId); GL11.glVertexPointer(3, GL11.GL_DOUBLE, this.VBOElementSize, 0); GL11.glNormalPointer(GL11.GL_DOUBLE, this.VBOElementSize, this.vertexSize); GL11.glColorPointer(4, GL11.GL_FLOAT, this.VBOElementSize, this.vertexSize + this.normalSize); GL11.glPushMatrix(); GL11.glRotated(this.lookAngle, 0, 0, -1); GL11.glDrawElements(GL11.GL_QUADS, this.totalVertices, GL11.GL_UNSIGNED_INT, 0); GL11.glPopMatrix(); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0); ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);See, simple...
Light weight does not necessary mean less code. The above could be done with about 20 lines, all of the extra is creating a buffer in the GPU memory so that the geometry is read from there, making it super fastTemor wrote:It looks very... light weight...
Oh sorry, I forgot to post. I was BAFFLED by them!jacek wrote:Nobody amazed by my hashes
Why not make it so that it can't spawn at 32,32? Or you spawn randomly, and do a check for if there is a block there?jacek wrote:Launcher made: http://jacekk.co.uk/Lux/LuxLauncher.jar
It will handle downloading the necessary library files and all that boring stuff. Download it and run it with your favourite JVM.
The changes since the applet version are not that interesting, I put a limit on the turning speed and added some basic collision detection for the walls. The location of the wall blocks is still totally random so you might get stuck in one it it spawns at 32,32.
Because the random blocks are not how the levels will actually be, they are just there so I can test the collisions and pathfinding when I get to enemies.bowersbros wrote:Why not make it so that it can't spawn at 32,32? Or you spawn randomly, and do a check for if there is a block there?
Ah okay.jacek wrote:Because the random blocks are not how the levels will actually be, they are just there so I can test the collisions and pathfinding when I get to enemies.bowersbros wrote:Why not make it so that it can't spawn at 32,32? Or you spawn randomly, and do a check for if there is a block there?