Jump to content
  • Advertisement

Totologic

Member
  • Content Count

    38
  • Joined

  • Last visited

Community Reputation

225 Neutral

About Totologic

  • Rank
    Member

Personal Information

  1. Hello.   Toto2DEngine is a C++ API dedicated to GPU accelerated 2D graphics for the Raspberry PI.   I have made a video showing what can be done with that stuff ;)   The source code is available: https://github.com/totologic/Toto2D-Engine   I am not an OpenGL expert, so feedbacks are appreciated :)
  2. Totologic

    Sprite batching performance

    Yes I need help. I want to find benchmarks on some 2D libraries in openGL. It is more difficult to find than expected. If you have any, you can share.
  3. Totologic

    Sprite batching performance

    Why is it so hard to extract from you the actual OpenGL and GLSL code you are using? Do I need to request it again? Because that is not going to happen. L. Spiro     Because my code is not open source.
  4. Totologic

    Sprite batching performance

      Yes.     Not necessarily.
  5. Totologic

    Sprite batching performance

    Mmmh OK.   But in fact I dont have any vertex buffer.
  6. Totologic

    Sprite batching performance

    Actually I think I don't undertand your question about double buffering because you seem to speak about the vertex buffers.
  7. Totologic

    Sprite batching performance

    About double buffering, I must admit I trusted GLFW:   http://www.glfw.org/docs/latest/quick.html#quick_swap_buffers   So I setted glfwSwapInterval(1) and then called glfwSwapBuffers(window) every frame when my rendering is finished.   Is it correct ?   About vertex buffers, I would say no, even if it is more complicated than that...
  8. Totologic

    Sprite batching performance

    While almost finished my tile renderer, I took time to build a new benchmark for my sprite renderer:   window 1200x800px 9600 sprites, sharing 25 textures 200x200px, with opacity (alpha 1 or 0) each sprite is scaled 1/10 and rotated continuously so the screen contains 80 lines of 120 sprite of size 20x20px the offset between each sprite is 10px, so each sprite is completely overlaped by his 8 neighbours   I reached average of 16ms per frame, so around 60fps  (edit: my laptop was under battery... with energy plugged I reach 10ms per frame)   A capture of my screen: [sharedmedia=gallery:images:6161]   My loop code: glm::mat3 matTransf; int i; float t = 0.0f; float t2x, t2y, rot, sx, sy, t1x, t1y; while (!glfwWindowShouldClose(window)) { toto2d.clear(); toto2d.setCameraLookAt(600.0f, 400.0f, 0.0f, 1.0f); for (i=0 ; i<9600 ; i++) { t1x = -100.0f; t1y = -100.0f; rot = t; sx = 0.1f; sy = 0.1f; t2x = (i%120)*10.0f; t2y = (i/120)*10.0f; Utils::mat3TRST(t2x, t2y, rot, sx, sy, t1x, t1y, matTransf); toto2d.getSpriteMatrixLayer().addSpriteMatrix(200*(i%5), 200*((i/5)%5), 200, 200, matTransf); if ((i > 0) && ((i % 799) == 0)) // the sprite layer can render 800 sprites max toto2d.getSpriteMatrixLayer().render(); } if ((i % 799) > 0) toto2d.getSpriteMatrixLayer().render(); // render the last sprites on the list toto2d.swap(); t += 0.01f; /* Poll for and process events */ glfwPollEvents(); }
  9. Totologic

    media

  10. Totologic

    Sprite batching performance

    OK thank you for you benchmark, it gives me a good start.   I start to implement a layer managing sprites sharing UV and with fixed scale and rotation. A kind of tile based renderer.   I hope this layer will reach several thousand of sprites.
  11. Totologic

    Adjusting the direction

    Rotations are always around origin.   You must first translate all the vertices in you object such that your point is at origin. So if P = (x, y, z), you translate all vertices by (-x, -y, -z). Then you perform your rotation around the velocity axis. Finaly you move back everything at the good place by translating by (x, y, z).
  12. I am working on a sprite batcher.   My sprites live in a top-left corner screen coordinates (we will abreviate by TLCSC). Meaning 0,0 is the top-left corner of the screen, the x-axis goes right and the y-axis goes down. The unit of each axis is the pixel.   OpenGL has a center normalized screen coordinates (we will abreviate by CNSC). Meaning 0,0 is at the center of the screen, x-axis going right and y-axis going up. No fixed units here, just know that  in-screen coordinates are pairs (x, y) such that x in [-1 ; 1] and y in [-1 ; 1].   From that, I wrote a matrix screenMat  doing conversion from TLCSC to CNSC:   glm::mat4 screenScaleMat = glm::scale(glm::mat4(1.0f), glm::vec3(2.0f/screenWidth, 2.0f/screenHeight, 1.0f)); glm::mat4 screenTransMat = glm::translate(glm::mat4(1.0f), glm::vec3(-1.0f, -1.0f, 0.0f)); glm::mat4 screenAxisMat = glm::scale(glm::mat4(1.0f), glm::vec3(1.0f, -1.0f, 1.0f)); glm::mat4 screenMat = screenAxisMat*screenTransMat*screenScaleMat;   I can apply screenMat  to any vec4(x, y, 0.0f, 1.0f).   Hoping it will help you.
  13. Totologic

    Sprite batching performance

    My machine has Integrated Intel® HD Graphics 3000
  14. Totologic

    Sprite batching performance

      Yes I now reached  6.8ms per frame (around 140FPS), solving my matrix composition issue and some other few things.   I continue to investigate...
  15. Totologic

    Sprite batching performance

    I solved my matrix multiplication problem by completely baking them.   I took time to write an article on my blog: http://totologic.blogspot.com/2015/02/2d-transformation-matrices-baking.html   Do you think that technique can also save resources in GLSL ?
  • 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!