Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - unlight

Pages: 1 2 [3]
31
Graphics / Superfluous Transformations in Sprite Batch
« on: February 19, 2019, 11:23:12 pm »
Hi guys,

I am currently looking to write a Sprite Batch class to assist in rendering a large number of sprites and would like some advice so that I don't needlessly double up on transform calculations.

My approach is to write a custom Sprite class that inherits only from Transformable (not Drawable) and provides a function to get it's (untransformed) vertices. I would also write a Sprite Batch class with an "addToBatch" function that takes a custom Sprite object. The Sprite Batch would get the Sprites vertices and its Transform, apply the transform and store the resulting vertices in a Vertex Array (or Vertex Buffer).

The Sprite Batch itself would inherit from Transformable and Drawable so that it can be rendered as though it were a native SFML entity. Within the inherited draw function, it would send set the Render State's Texture and draw a bunch of Sprites in a single draw call. This seems straight forward, but I noticed in the source code for Render Target, that the Render State's Transform is applied to all of the vertices before drawing. This would mean that all vertices have had two transformations applied in total. Is this something that would be detrimental to performance?  Or am I being overly paranoid?

32
System / Re: Issues with SFML/OpenGL.hpp on Mac OS
« on: January 15, 2017, 01:50:03 am »
Thank you for the reply, I'll use this solution until SFML upgrades naturally.

33
System / Issues with SFML/OpenGL.hpp on Mac OS
« on: January 14, 2017, 01:20:52 am »
Hi guys,

I am new to SFML and have come across an issue and would like some advice on how to report it, or find out if it is already a known issue.

I have been trying to use the SFML/OpenGL.hpp header to access openGL function calls on a MacBook. However, this header file does not give me access to the standard OpenGL functions for generating or binding/unbinding vertex arrays, instead I am provided with Apple-specific versions of those functions as shown below:

glGenVertexArrays(GLsizei n, GLuint *arrays)  --->  glGenVertexArraysAPPLE(GLsizei n, GLuint *ids)
glBindVertexArray(GLuint array)  --->  glBindVertexArrayAPPLE(GLuint id)

After some research and experimentation on the subject, I found the cause of this to be the inclusion of a header file within the SFML/OpenGL.hpp header:

.....
#elif defined(SFML_SYSTEM_MACOS)
    #include <OpenGL/gl.h>
.....

This header file I believe should actually be replaced with:

#include <OpenGL/gl3.h>

As I mentioned before, I am new to SFML and OpenGL so I may very well be wrong here, all I know is that if I include the above header file, I get access to the standard OpenGL functions to generate and bind vertex arrays. Using the Apple specific ones mentioned earlier result in my calls to glDrawArrays failing to render (no error messages), but using the above header and the standard vertex array functions fixes this problem.

If anyone has any advice on how I could further this issue, or if I am wrong in some way, I would appreciate your time.

Pages: 1 2 [3]
anything