The problem was caused by vector re-allocation. This is a similar
problem to what happened with the mesh factory. It was solved by
converting the texture factory to use lists instead of vectors.
The reason for using lists is to prevent the need for explicit
deallocation of resources and instead allow the use of a list to
automatically allocate/deallocate the textures/samplers/meshes.
There is an OpenGL error (1282) invalid operation that is getting
caught when switching to the imagescene. This needs to get fixed
and then hopefully the whole thing will work.
Added image scene to render an image in a scene. There is also now
a testing image that is an uber meme. Currently the problem is
that the spritebatch cannot use the offsetof macro because it is a
templated class. Possible solutions to this are changing it to be
specifyable or implemented per vertex type as the other batches
have been.
The sprite inherits from Poseable. It is intended to allow for
pure 2D rendering or integration of sprites/particles into 3D
scenes. Eventually an ImageScene should be created to test out the
image loading, sprite movement and rotation, and 2D camera
functionality for the builtin engine.
MyBuiltinTexturedScene (number 7) displays a cube that loads its
faces from a hard-coded texture. Mipmaping is supported. Just use
the XXX_MIPMAP_XXX Min/Mag filters to use it. TODO next is
combining lighting and textures and then up after that is shadows.
I may just do lighting and shadows before lighting, shadows, and
textures.
Want to use seperate textures and samplers for the scene to allow
for more modularization. Currently have created a texture class
and started creating a scene class.
Now, LitScene allows for simple lighting. (Shadows still to come).
Ambient, specular, and diffuse lighting available and each mesh's
vertex can define a material that defines its reflectivity. An
example scene was added to the MyApplication as the scene for the
6 button.
The builtin namespace is intended to be a slighly higher level
interface with OpenGL through the charcoal engine. It is inteneded
to allow the developer to create applications without needing to
create shader code or worry about rendering techniques. Eventually,
applications with lighting, textures, vertex coloring, shadows, and
a text-based UI should be available through the builtin namespace
Got the builtin basicscene to render. For some reason, it seems
like the model matrices are not working correctly. The two shapes
that are supposed to be rendering on screen are not moving around
as they should be.
Need to re-make the builtin version. The problem, again, was caused
by vtables. Need to find a way to make interfaces without virtual
methods to remove the need for vtables. Found a good stackoverflow
article on this.
https://stackoverflow.com/questions/44317289/c-interface-without-virtual-functions
The Positioned, Normaled, Textured, etc. Interfaces should be
re-made using this format.
Builtin general structure created. Added a builtin::BasicScene
class for quick general testing of the engine on different systems.
The builtin::BasicScene class greatly reduces the amount of code
needed to be handled by the developer by offering a pre-made way
to handle it. It even includes pre-made shaders!
Starting the setup for builtin types for rendering. This will allow
the engine to be easier to use for beginners while still offering
great modularity and functionality. The builtin namespace is
intended to simplify mesh loading and rendering. It should
eventually offer pre-made shaders to simplify the rendering of the
builtin types. Possibly in the future, it could have partially
setup scenes/application to simplify scene/application building
Also added a required prerender function to scene and application.
This function is intended to be used as a way to prepare the scene
to be rendered in its current state. For that reason, the delta
time and the current clock tick are not passed to it.
Finally got a 3D cube to be rendered. While doing it, fixed a
bug in MeshFactory that caused it to allocate the incorrect amount
of memory for each mesh.
Poseable is not a struct because it has a vtable. This means that
it cannot be used easily with glVertexAttribPointer.
This quick fix should be overwritten by a full fix that stores the
matrix data in a seperate vector and modifies the matrices with
poseable interfaces. (Will go into more detail in that commit.)
Now using GLM instead of the custom math libraries.
Sadly, this did not 100% fix the problem at hand but it does give
some closure that the math is not the problem.
Also it will be nice to have a general math library to not have to
deal with creating every math function every time.
Now, the batch subclasses define the Element specification and the
elements are not stored in the main Batch class. It is suggested
that the batch subclasses use vectors of the different element
types per requested VBO and offer a function to return a reference
to one of the elements by index. This functionality is implemented
in the current version of MyBatch.
A test for the movement needs to be completed
The trapezoid now throbs between black and white. This was made to
test out the element buffers using MyBatch. Next up for the
batches should probably be to figure out the recommended way of
specifying more than one element buffer. Currently it is done
by specifying the number of elements to be stored and the number
of element vbos needed but maybe there is some way to get it to
work using variadic templates. There is a comment about this in
the Batch.h file.
Now batches are actually batches.
Also added the MeshFactory class.
Drawing modes are now specified with DrawMode instead of the
GLenum. Renderables must be specified with a draw mode.
This commit gets creates the ObjectOriented scene and gets it
working.
The current test program swaps a triangle from small to large with
the 1 and 2 keys on the keyboard. (1 for small and 2 for large).
The small triangle is rendered by the simple scene and the large
one is rendered by the object oriented one.