Jump to content
  • Advertisement

LizardCPP

Member
  • Content count

    370
  • Joined

  • Last visited

Community Reputation

206 Neutral

About LizardCPP

  • Rank
    Member
  1. Ok I solved it myself and the problem lies in how one should work with java.nio.Buffer. I have to call the order() method on the ByteBuffer with ByteOrder.nativeOrder(). Then it works! Full working source: import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.util.FPSAnimator; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; import javax.swing.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; /** * @version 2010-nov-13 */ public class JOGLTest { public static void main(String[] args) { JFrame frame = new JFrame("JOGL test"); frame.setSize(640, 480); GLProfile glProfile = GLProfile.get(GLProfile.GL2); GLCapabilities glCapabilities = new GLCapabilities(glProfile); GLCanvas canvas = new GLCanvas(glCapabilities); frame.add(canvas); canvas.addGLEventListener(new JOGLRenderer()); AnimatorBase animator = new FPSAnimator(canvas, 60); animator.add(canvas); animator.start(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); } private static class JOGLRenderer implements GLEventListener { @Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glShadeModel(GL2.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // Create vertex data float[] vertexData = new float[] { 0.75f, 0.25f, -2.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.75f, 0.75f, -2.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.25f, 0.25f, -2.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.25f, 0.75f, -2.0f, 0.5f, 0.5f, 0.5f, 1.0f }; ByteBuffer vertexByteBuffer = ByteBuffer.allocateDirect(7 * 4 * 4); vertexByteBuffer.order(ByteOrder.nativeOrder()); // <-- this line was missing FloatBuffer vertexBuffer = vertexByteBuffer.asFloatBuffer(); vertexBuffer.put(vertexData); // Create vertex buffer int[] vertexBufferId = new int[1]; gl.glGenBuffers(1, vertexBufferId, 0); gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexBufferId[0]); gl.glBufferData(GL2.GL_ARRAY_BUFFER, 1024, null, GL2.GL_DYNAMIC_DRAW); // Load vertex data into vertex buffer gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, vertexByteBuffer.capacity(), vertexByteBuffer); // Create index data int[] indexData = new int[] { 0, 1, 2, 2, 1, 3 }; ByteBuffer indexByteBuffer = ByteBuffer.allocateDirect(6 * 4); indexByteBuffer.order(ByteOrder.nativeOrder()); // <- this line was missing IntBuffer indexBuffer = indexByteBuffer.asIntBuffer(); indexBuffer.put(indexData); // Create index buffer int[] indexBufferId = new int[1]; gl.glGenBuffers(1, indexBufferId, 0); gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferId[0]); gl.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, 1024, null, GL2.GL_DYNAMIC_DRAW); // Load index data into index buffer gl.glBufferSubData(GL2.GL_ELEMENT_ARRAY_BUFFER, 0, indexByteBuffer.capacity(), indexByteBuffer); } @Override public void dispose(GLAutoDrawable drawable) { } @Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); /* This rendered a purple quad gl.glBegin(GL2.GL_TRIANGLES); gl.glColor3f(0.5f ,0.0f, 0.5f); gl.glVertex3f(0.75f, 0.25f, -2); gl.glVertex3f(0.75f, 0.75f, -2); gl.glVertex3f(0.25f, 0.25f, -2); gl.glVertex3f(0.25f, 0.25f, -2); gl.glVertex3f(0.75f, 0.75f, -2); gl.glVertex3f(0.25f, 0.75f, -2); gl.glEnd(); */ int stride = 7 * 4; gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl.glEnableClientState(GL2.GL_COLOR_ARRAY); gl.glVertexPointer(3, GL2.GL_FLOAT, stride, 0); gl.glColorPointer(4, GL2.GL_FLOAT, stride, 3 * 4); gl.glDrawRangeElements(GL2.GL_TRIANGLES, 0, 5, 6, GL2.GL_UNSIGNED_INT, 0); // gl.glDrawElements(GL2.GL_TRIANGLES, 6, GL2.GL_UNSIGNED_INT, 0); // glGetError returns 0 int error = gl.glGetError(); gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); gl.glDisableClientState(GL2.GL_COLOR_ARRAY); } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl = drawable.getGL().getGL2(); GLU glu = new GLU(); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0f, (float) width / (float) height, 0.1f, 100.0f); gl.glMatrixMode(GL2.GL_MODELVIEW); } } }
  2. Ok I have created a single file that displays my problem, it can be compiled and run if one has a java SDK and JOGL. The problem is still that nothing is rendered. glGetError returns 0 after glDrawRangelElements. import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.util.FPSAnimator; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; import javax.swing.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; /** * @version 2010-nov-13 */ public class JOGLTest { public static void main(String[] args) { JFrame frame = new JFrame("JOGL test"); frame.setSize(640, 480); GLProfile glProfile = GLProfile.get(GLProfile.GL2); GLCapabilities glCapabilities = new GLCapabilities(glProfile); GLCanvas canvas = new GLCanvas(glCapabilities); frame.add(canvas); canvas.addGLEventListener(new JOGLRenderer()); AnimatorBase animator = new FPSAnimator(canvas, 60); animator.add(canvas); animator.start(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); } private static class JOGLRenderer implements GLEventListener { @Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glShadeModel(GL2.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // Create vertex data float[] vertexData = new float[] { 0.75f, 0.25f, -2.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.75f, 0.75f, -2.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.25f, 0.25f, -2.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.25f, 0.75f, -2.0f, 0.5f, 0.5f, 0.5f, 1.0f }; ByteBuffer vertexByteBuffer = ByteBuffer.allocateDirect(7 * 4 * 4); FloatBuffer vertexBuffer = vertexByteBuffer.asFloatBuffer(); vertexBuffer.put(vertexData); // Create vertex buffer int[] vertexBufferId = new int[1]; gl.glGenBuffers(1, vertexBufferId, 0); gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexBufferId[0]); gl.glBufferData(GL2.GL_ARRAY_BUFFER, 1024, null, GL2.GL_DYNAMIC_DRAW); // Load vertex data into vertex buffer gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, vertexByteBuffer.capacity(), vertexByteBuffer); // Create index data int[] indexData = new int[] { 0, 1, 2, 2, 1, 3 }; ByteBuffer indexByteBuffer = ByteBuffer.allocateDirect(6 * 4); IntBuffer indexBuffer = indexByteBuffer.asIntBuffer(); indexBuffer.put(indexData); // Create index buffer int[] indexBufferId = new int[1]; gl.glGenBuffers(1, indexBufferId, 0); gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferId[0]); gl.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, 1024, null, GL2.GL_DYNAMIC_DRAW); // Load index data into index buffer gl.glBufferSubData(GL2.GL_ELEMENT_ARRAY_BUFFER, 0, indexByteBuffer.capacity(), indexByteBuffer); } @Override public void dispose(GLAutoDrawable drawable) { } @Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); /* This rendered a purple quad gl.glBegin(GL2.GL_TRIANGLES); gl.glColor3f(0.5f ,0.0f, 0.5f); gl.glVertex3f(0.75f, 0.25f, -2); gl.glVertex3f(0.75f, 0.75f, -2); gl.glVertex3f(0.25f, 0.25f, -2); gl.glVertex3f(0.25f, 0.25f, -2); gl.glVertex3f(0.75f, 0.75f, -2); gl.glVertex3f(0.25f, 0.75f, -2); gl.glEnd(); */ // this below renders nothing int stride = 7 * 4; gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl.glEnableClientState(GL2.GL_COLOR_ARRAY); gl.glVertexPointer(3, GL2.GL_FLOAT, stride, 0); gl.glColorPointer(4, GL2.GL_FLOAT, stride, 3 * 4); gl.glDrawRangeElements(GL2.GL_TRIANGLES, 0, 5, 6, GL2.GL_UNSIGNED_INT, 0); // gl.glDrawElements(GL2.GL_TRIANGLES, 6, GL2.GL_UNSIGNED_INT, 0); // glGetError returns 0 int error = gl.glGetError(); gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); gl.glDisableClientState(GL2.GL_COLOR_ARRAY); } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl = drawable.getGL().getGL2(); GLU glu = new GLU(); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0f, (float) width / (float) height, 0.1f, 100.0f); gl.glMatrixMode(GL2.GL_MODELVIEW); } } }
  3. Quote:Original post by karwosts I realize this is a bit of work for you, but can you redo your code into a nice little linear flow without so many function calls? I found myself rolling up and down the screen about 50 times trying to follow the flow of your program and it's difficult to gather in my head in what order things are happening. maybe just make a new quickie render hack function that is like the following: *** Source Snippet Removed *** It doesn't have to be clean and you can break on the second frame so you don't have to worry about initializing outside of your render loop, but that's probably the best way to get the basics nailed down, and once you have it working, you can OO'ize your code into classes. But just for me trying to read it's very difficult to follow. You can certainly choose not to do this, but it's much easier to debug that way. Yeah, I'll think I have to do that. Create a single class that does this without the OO. I'll get back to this post tomorrow if I can't get that to work. Thanks for trying to help me.
  4. Quote:Original post by karwosts *** Source Snippet Removed *** I think you've got the wrong value for 'count' here. It should be the number of indices, not the number of primitives. I believe this code only draws two vertices and quits, so you're not completing the first triangle. Thanks for your replay, but I have now tried a count between 2-6 nothing is rendered in any case.
  5. It's been a while since I have done any OpenGL coding and now I'm trying to get back into the game using JOGL, OpenGL bindings for Java. I got a simple program up and running that draws two triangles as a quad using the old fixed-function pipeline (i.e. glBegin(GL_TRIANGLES) / glEnd()). Now I'm trying to get it to work with VBO:s, indexed interleaved vertex data as i used to do it 5 years ago. Then after that I'm thinking of working my way up to use the 3.2 profile. Update: I created a simpler test program that displays my problem in one file, see post 6 in this thread. Update 2: This has now been solved, see post 7. The sample program requests a OpenGL 2.0 profile and then tries to render two triangles as a quad with one color per vertex. The vertex data is interleaved with first 3 floats for position and then 4 floats for color. 4 vertex is set in a VBO and then 6 indices are set in a index buffer. Result is a black window, nothing is rendered,glGetError returns 0 if called after glDrawRangeElements(). Geometry class: import java.nio.Buffer; public class Geometry { /** * */ private VertexFormat vertexFormat; /** * */ private Buffer vertexBuffer; /** * */ private Buffer indexBuffer; /** * @param vertexFormat * @param vertexBuffer * @param indexBuffer */ public Geometry(VertexFormat vertexFormat, Buffer vertexBuffer, Buffer indexBuffer) { this.vertexFormat = vertexFormat; this.vertexBuffer = vertexBuffer; this.indexBuffer = indexBuffer; } /** * @return */ public int getStride() { return vertexFormat.getStride(); } public Buffer getVertexData() { return vertexBuffer; } public Buffer getIndexData() { return indexBuffer; } } JOGLBufferObject class: import javax.media.opengl.GL2; import javax.media.opengl.GLContext; import java.nio.Buffer; class JOGLBufferObject implements BufferObject { /** * The OpenGL api object */ private GL2 gl; /** * This will either be set to GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER */ private int type; /** * Size of the buffer in bytes */ private int size; /** * The buffers id */ private int[] bufferId; /** * * @param type the type of the buffer, will either be GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER * @param size size of the buffer in bytes */ private JOGLBufferObject(int type, int size) { this.gl = GLContext.getCurrentGL().getGL2(); this.type = type; this.bufferId = new int[1]; this.size = size; gl.glGenBuffers(1, bufferId, 0); gl.glBindBuffer(type, bufferId[0]); gl.glBufferData(type, size, null, GL2.GL_DYNAMIC_DRAW); } /** * * @param size * @return */ public static JOGLBufferObject createVertexBuffer(int size) { return new JOGLBufferObject(GL2.GL_ARRAY_BUFFER, size); } /** * * @param size * @return */ public static JOGLBufferObject createIndexBuffer(int size) { return new JOGLBufferObject(GL2.GL_ELEMENT_ARRAY_BUFFER, size); } /** * Retrieve the size of the buffer * * @return size of the buffer */ public int getSize() { return size; } /** * */ public void destroy() { gl.glDeleteBuffers(1, bufferId, 0); } /** * */ public void bind() { gl.glBindBuffer(type, bufferId[0]); } /** * */ public void unbind() { gl.glBindBuffer(type, 0); } /** * * @param offset * @param size * @param buffer */ public void update(int offset, int size, Buffer buffer) { gl.glBufferSubData(type, offset, size, buffer); } } Setup of geometry: float[] vertexData = new float[] { 0.75f, 0.25f, -2.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.75f, 0.75f, -2.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.25f, 0.25f, -2.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.25f, 0.75f, -2.0f, 0.5f, 0.5f, 0.5f, 1.0f }; ByteBuffer vertexByteBuffer = ByteBuffer.allocateDirect(7 * 4 * 4); FloatBuffer vertexBuffer = vertexByteBuffer.asFloatBuffer(); vertexBuffer.put(vertexData); int[] indexData = new int[] { 0, 1, 2, 2, 1, 3 }; ByteBuffer indexByteBuffer = ByteBuffer.allocateDirect(6 * 4); IntBuffer indexBuffer = indexByteBuffer.asIntBuffer(); indexBuffer.put(indexData); VertexFormat vertexFormat = new VertexFormat(7 * 4); geometry = new Geometry(vertexFormat, vertexByteBuffer, indexByteBuffer); JOGLRenderer, it's the render(Geometry geometry) function that draws nothing: import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLContext; import javax.media.opengl.glu.GLU; import java.nio.Buffer; public class JOGLRenderer implements Renderer { /** * */ private GL2 gl; /** * */ private GLU glu; /** * */ private BufferObject vertexBuffer; /** * */ private BufferObject indexBuffer; // TEMP private boolean setupDone = false; /** */ public JOGLRenderer() { this.gl = GLContext.getCurrentGL().getGL2(); this.glu = new GLU(); this.vertexBuffer = JOGLBufferObject.createVertexBuffer(1024); this.indexBuffer = JOGLBufferObject.createIndexBuffer(1024); gl.glShadeModel(GL2.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); } @Override public void reshape(int x, int y, int width, int height) { gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0f, (float) width / (float) height, 0.1f, 100.0f); gl.glMatrixMode(GL2.GL_MODELVIEW); } @Override public void prepare() { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); } @Override public void render(OLDGeometry oldGeometry) { gl.glBegin(GL.GL_TRIANGLES); gl.glColor3f(oldGeometry.color.getX(), oldGeometry.color.getY(), oldGeometry.color.getZ()); gl.glVertex3f(oldGeometry.topLeft.getX(), oldGeometry.topLeft.getY(), oldGeometry.topLeft.getZ()); gl.glVertex3f(oldGeometry.topRight.getX(), oldGeometry.topRight.getY(), oldGeometry.topRight.getZ()); gl.glVertex3f(oldGeometry.bottomLeft.getX(), oldGeometry.bottomLeft.getY(), oldGeometry.bottomLeft.getZ()); gl.glVertex3f(oldGeometry.bottomLeft.getX(), oldGeometry.bottomLeft.getY(), oldGeometry.bottomLeft.getZ()); gl.glVertex3f(oldGeometry.topRight.getX(), oldGeometry.topRight.getY(), oldGeometry.topRight.getZ()); gl.glVertex3f(oldGeometry.bottomRight.getX(), oldGeometry.bottomRight.getY(), oldGeometry.bottomRight.getZ()); gl.glEnd(); } @Override public void render(Geometry geometry) { Buffer vertexBufferData = geometry.getVertexData(); Buffer indexBufferData = geometry.getIndexData(); int stride = geometry.getStride(); // the stride is here 28 i.e. 7*4 gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl.glEnableClientState(GL2.GL_COLOR_ARRAY); if (!setupDone) { vertexBuffer.bind(); indexBuffer.bind(); vertexBuffer.update(0, vertexBufferData.capacity(), vertexBufferData); // capacity returns 112 i.e. 7*4*4 indexBuffer.update(0, indexBufferData.capacity(), indexBufferData); // capacity returns 24 i.e. 6*4 setupDone = true; } gl.glVertexPointer(3, GL2.GL_FLOAT, stride, 0); gl.glColorPointer(4, GL2.GL_FLOAT, stride, 3 * 4); gl.glDrawRangeElements(GL2.GL_TRIANGLES, 0, 5, 2, GL2.GL_UNSIGNED_INT, 0); gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); gl.glDisableClientState(GL2.GL_COLOR_ARRAY); } @Override public void present() { // No need to swap buffers, jogl does that for me } } Render loop: renderer.prepare(); renderer.render(geometry); renderer.present(); Can anyone see what I'm doing wrong? [Edited by - LizardCPP on November 13, 2010 8:00:52 AM]
  6. LizardCPP

    2D collision response

    I'm implementing simple 2D collision detection and now I want to add collision response. I'm thinking of using a simple projection method where I push the dynamic object out of the static by the normal om the static. But that got me thinking: That can result in another collision. How do I know if that object collided again? Do I have to redo the whole collision detection for that object again? And if I solve that collision then it can be pushed into another collision (or in to the first collision again!), how do I solve this? Can't I end up in a infinite loop? Thanx Lizard
  7. LizardCPP

    [java] Eclipse vs. Net Beans

    IntelliJ /Lizard
  8. Do anyone know how to do nice outline font in java like the one you can see in for instance flash and photoshop. Currently I'm using something like this: if (outline) { m_g2d.setColor(outlineColor); m_g2d.drawString(text, -1, 0); m_g2d.drawString(text, 1, 0); m_g2d.drawString(text, 0, -1); m_g2d.drawString(text, 0, 1); } m_g2d.setColor(color); m_g2d.drawString(text, 0, 0); I have also tried approaches similar to this: http://www.java2s.com/Code/Java/2D-Graphics-GUI/OutlineFontpaint.htm But neither produces a nice and clean outline text. Lizard
  9. LizardCPP

    Can anyone recommend a simple bug tracker?

    Bugzilla. Lizard
  10. LizardCPP

    Drawing a 3D grid ..... HOW???

    Something like this prehaps? glColor3ub(0, 255, 0); glBegin(GL_LINES); for (int i = -200; i < 200; i++) { glVertex3i(-200, 0, i); glVertex3i(200, 0, i); } for (int i = -200; i < 200; i++) { glVertex3i(i, 0, -200); glVertex3i(i, 0, 200); } glEnd(); /Lizard
  11. I use GLEE for extension handling. I can also ask GLEE what version of GL I'm using. GLEE: http://elf-stone.com/glee.php /Lizard
  12. Look at RenderingHints for Java2D, there you can specify to use anti-alias. Is that enough for you? Edit: Sorry, missed some things in your post, you have already been down this road. Lizard
  13. LizardCPP

    Character Animation Questions

    Quote:Original post by RobTheBloke Quote:Original post by LizardCPPThen each key frame is represented by a set of matrices for each bone. Quaternion for rotation, vec3 for translate (+ possibly vec3 for scale, but that introduces other problems). Less data that matrices. Quote:Original post by LizardCPPA animation is often (always) in place, so the model never moves? To actually move the model forward when walking we also apply a translation in the direction we are walking. That's upto you, but generally that method is not recommended since the translation during a walk is non linear. Normally you use LVE to extract the velocity of the root bone on the anim. This lets the animators just animate the character walking forward, and you compensate for it in code. Things like foot slip can be avoided if you use lve. Quote: Now I'm trying to decide on a good model format to use for character animation. What options do I got? Pros, cons and limitation of each model format? fbx, collada or dotxsi - but you'll need to extract data from those to your own runtime format since they are not ideal for runtime usage. Cal3d is ok and includes a runtime anim engine. Thanks for your answer. Whats LVE? Lizard
  14. I'm new to the world of character animation, but basically I think (hope) that the process is something like this: Load model from file, should give one all the data to render the model: vertices's, texture coordinates, normals etc. But also some grouping (bone?/joint?) of vertices's that will be transformed together. Then each key frame is represented by a set of matrices for each bone. Then a certain animation as a walk-cycle, can be made up out of say 4 key frames which you interpolate between. So to render the animation we store the vertex, texture coordinates etc in a vertex buffer, and then we render the first frame by using the matrices in key frame 1. The we calculate the next set of matrices for the next frame by interpolating between the matrices in key frame 1 and 2 over a certain time. When we reach key frame 2 we start interpolating between 2 and 3, then 3 and 4. And then we start over again until the animation stops. A animation is often (always) in place, so the model never moves? To actually move the model forward when walking we also apply a translation in the direction we are walking. Is that a correct image? Now I'm trying to decide on a good model format to use for character animation. What options do I got? Pros, cons and limitation of each model format? Lizard
  15. LizardCPP

    OpenGL Sprites?

    There is a article about this here at GD.net: link Lizard
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!