Nick Karasch

  • Content count

  • Joined

  • Last visited

Community Reputation

171 Neutral

About Nick Karasch

  • Rank
  1. Euler angle rotations

    I used ZYZ, doesn't that match up to what that says? Thanks for your input
  2. Euler angle rotations   Does that look right? I would just go ahead and try it but I have no idea how my end result is supposed to look. All I can do is make sure I'm right on a theory level.
  3. Euler angle rotations

    "You will eventually regret any use of Euler angles." -John Carmack   Part of my assignment:   So I need to produce a transformation matrix for these rotations     These kinds of rotation matrices can't give me rotations around the "new" y' and z'' can they? aren't they only relative to the x, y and z of my coordinate system?  
  4. Euler angle rotations

    How would you accomplish this? I know how to do rotations around the X, Y, Z axis, but those are not applicable in this case other than the inital rotation right? It's the rotations around the "new" axis that are throwing me off.
  5. Power Up Table Tennis Contest

    I would like to participate as well
  6. All matrix operations in shader?

    Thanks, I don't know about instanced rendering yet but now I have something new to read about   I think it's all opinion but I disagree about me reusing my work being unfair to other students. If I have spent 12 hours a day working on this stuff since school resumed, I don't think it's unfair for me to get to reuse code. It's also NOT unfair to me that I have to start over, I wasn't trying to say that either.
  7. All matrix operations in shader?

    Thanks for the friendly reply. Yeah it is very frustrating, I have my 4000+ line "3D engine" I have been working on that would make this assignment take 10 minutes. I expected I could just strip it down to the essentials and reuse my code for these assignments. Now I'm having to start over, sweating over finding a new way to do the basics in the way he wants.
  8. I ask my Graphics Programming professor if I could use something I am familiar with like GLM and he said no, we are supposed to do everything in the vertex shader. From my experience/understanding, it makes more sense to calculate the model-view-projection matrix once per model for this simple program and pass it in through a uniform.   I think he wants us to create all of the matrices in the shader code, can that ever make sense? I don't understand why you would EVER create your main view and projection matrices within a shader. Thanks
  9. Android GLES1 2d collisions detection

    Now that I'm working out how to keep track of the locations of my objects outside of OGL, another question has popped into my head. Would reloading a fresh set of  pre-transformed vertices into OpenGL every frame be significantly slower than using glTranslate, glScale etc?   I'm dealing with 2D here, usually arrays of 12 values. something like: draw(){ vertices = somewhereElse.getVertices(); vertexBuffer.put(vertices); //blah blah blah gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); //draw stuff //blah blah blah }   Also, thanks for the SAT advice. I might use something like it.
  10. So far I can draw textured quads (triangle strips), move them and it all works independently of screen resolution and aspect ratio. I'm hitting a huge snag when it comes to collision detection. My only prior experiences were with fixed resolutions with no rotation.   How do you guys handle it? Is there any easy way to get my objects vertices after a translation and rotation? I know how to peek at the model view matrix and it isn't of much help as far as I can tell. I feel like all of my problems would be solved if I could just get the post-transform coordinates of my vertex array.
  11. Passing attributes to shaders

    Disclaimer: This code is an ugly mess that has been getting abused for a few days. It is not pretty, I'm aware. I'm just desperate to get it working, then the beautification process will occur.   Also, the delta time is no longer working as intended. I know how to fix it, but there is no point when I can't get rotations working.   I'm having a tough time here. My translations work perfectly. However, as soon as I start adding rotations in, things go nuts. X axis rotations alone are fine, Y axis alone are fine but when I have both activated I end up spinning and rolling out of control. I'm also pretty sure that the rotations are all more like revolutions around the original starting point.   Any insight would be great. I was stole this code, using the built in matrix stack and it worked great. A lot of the code below is ugly remnants of it   package karasch.lwjgl.utility; import; import; import karasch.lwjgl.entitysetup.IEntity; import org.lwjgl.input.Mouse; import org.lwjgl.util.vector.Matrix4f; import org.lwjgl.util.vector.Vector3f; public class View implements IEntity { private Vector3f position; private float x, y, z, yaw, pitch; private float moveSpeed, mouseSensitivity, deltaMoveSpeed; int dx, dy; static Matrix4f viewMatrix; public View(float x, float y, float z) throws FileNotFoundException, IOException { moveSpeed = 0.00001f; dx = Mouse.getDX(); dy = Mouse.getDY(); yaw = 0; pitch = 0; position = new Vector3f(x, y, z); mouseSensitivity = 0.0000025f; viewMatrix = new Matrix4f(); viewMatrix.setIdentity(); } // increment the camera's current yaw rotation public void yaw(float amount) { // increment the yaw by the amount param yaw += amount; } // increment the camera's current yaw rotation public void pitch(float amount) { // increment the pitch by the amount param pitch += amount; } public void applyTransformations() { viewMatrix.rotate(pitch, new Vector3f(1, 0, 0)); viewMatrix.rotate(yaw, new Vector3f(0, 1, 0)); viewMatrix.translate(position); System.out.println(viewMatrix); } public void update(int delta) { deltaMoveSpeed = moveSpeed * delta; dx = Mouse.getDX(); dy = Mouse.getDY(); this.yaw(dx * mouseSensitivity); this.pitch(dy * -mouseSensitivity); if (Input.dPressed) { strafeRight(deltaMoveSpeed); } if (Input.aPressed) { strafeLeft(deltaMoveSpeed); } if (Input.wPressed) { walkForward(deltaMoveSpeed); } if (Input.sPressed) { walkBackward(deltaMoveSpeed); } if (Input.controlPressed) { moveDown(deltaMoveSpeed); } if (Input.spacePressed) { moveUp(deltaMoveSpeed); } } public static Matrix4f getViewMatrix() { return viewMatrix; } // moves the camera forward relative to its current rotation (yaw) // moves the camera forward relative to its current rotation (yaw) public void walkForward(float distance) { position.x -= distance * (float) Math.sin(Math.toRadians(yaw)); position.z += distance * (float) Math.cos(Math.toRadians(yaw)); } // moves the camera backward relative to its current rotation (yaw) public void walkBackward(float distance) { position.x += distance * (float) Math.sin(Math.toRadians(yaw)); position.z -= distance * (float) Math.cos(Math.toRadians(yaw)); } public void moveUp(float distance) { position.y -= distance; } public void moveDown(float distance) { position.y += distance; } // strafes the camera left relitive to its current rotation (yaw) public void strafeLeft(float distance) { position.x -= distance * (float) Math.sin(Math.toRadians(yaw - 90)); position.z += distance * (float) Math.cos(Math.toRadians(yaw - 90)); } // strafes the camera right relitive to its current rotation (yaw) public void strafeRight(float distance) { position.x -= distance * (float) Math.sin(Math.toRadians(yaw + 90)); position.z += distance * (float) Math.cos(Math.toRadians(yaw + 90)); } public Vector3f getPosition() { return position; } public float getX() { return x; } public void setX(float x) { this.x = x; } public float getY() { return y; } public void setY(float y) { this.y = y; } public float getZ() { return z; } public void setZ(float z) { this.z = z; } @Override public void destroy() { } @Override public void render() { this.applyTransformations(); } }
  12. Passing attributes to shaders

    Thanks. I got around to implementing my own matrices today, hasn't worked out so well so far but I know it's just errors in my logic   For your amusement:
  13. Passing attributes to shaders

    Is gl_ModelViewProjectionMatrix unknown by GSLS 3.3? Even gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; isn't working, it is definitely my problem line
  14. Passing attributes to shaders

  15. Passing attributes to shaders

    System.out.println(glGetShaderInfoLog(vertexShader, glGetProgrami(shaderProgram, GL_INFO_LOG_LENGTH))); Isn't giving me anything, hmmm.   And yeah, I am going to move away from the built in matrix functions.   Also, I'm using Java so I don't think GLM is an option. LWJGL has appropriate tools built in though.   Thanks for the response