Open aod6060 opened 1 month ago
I forgot one thing... I also need to add in font render here too. I need to display text output to the player which will be useful for alot of thing such as huds, custom ui elements, messagebox, etc.
Ok here is a simple example of what the render can do at this time...
I doesn't do much just yet but its a start. I guess I could make it move :)
Got done adding UniformBlock and UniformBuffer to the render. I also added a render interal interface for stuff that the rest of the application doesn't need to access to. Alright time to add in the other stuff.
Alright I've added in Texture2DArrays which is cool. Here is what it actually does.
What does a Texture2DArray does. It load up a bunch of images from the file. Here is the code example to initialize a Texture2DArray from file. This example is from main.cpp currently.
""" render::glw::Texture2DArray::createTexture2DArrayFromFiles(&icon_array, { "data/icon/icon_32.png", "data/icon/icon_32_green.png", "data/icon/icon_32_blue.png", "data/icon/icon_32_magenta.png" }); """
What I'm upload to are these images.
icon_32.png icon_32_green.png icon_32_blue.png icon_32_magenta.png
In order to get the rough fx we'll have to use custom texturecoords...
""" icon_array_texCoords.init(); icon_array_texCoords.add3(0.0f, 0.0f, 0.0f); icon_array_texCoords.add3(1.0f, 0.0f, 1.0f); icon_array_texCoords.add3(0.0f, 1.0f, 2.0f); icon_array_texCoords.add3(1.0f, 1.0f, 3.0f); icon_array_texCoords.update(); """
In order to render it we'll need to use the TEXTURE2D_ARRAY shader and the rest will work the same way as the normal textures.
""" render::startShader(render::ShaderType::ST_TEXTURE2D_ARRAY);
//render::setView(glm::mat4(1.0f)); render::setModel( glm::translate(glm::mat4(1.0f), glm::vec3(this->postion, 0.0f)) * glm::scale(glm::mat4(1.0f), glm::vec3(32.0f, 32.0f, 0.0f)) );
icon_array.bind(GL_TEXTURE0); render::draw(icon_array_texCoords); icon_array.unbind(GL_TEXTURE0);
render::endShader(); """
This is complete and I can't wait to start using them for tilemapping.
Time for the framebuffer.
Alright got done with the frame buffer. Which is cool. I'm going to create a quick video to document how it works because its a little hard to describe its functionality of without showing it off.
Alright I'm back to the main branch. The last thing I want to add into the render section of the engine is font or text rendering. I've already started using my faviorit font pack which has a bunch of nice fonts for games. They are located in bin/data/font directory. I'll be trying to load them using freetype and then rendering them using OpenGL textures.
Alright I'm back. Had to do some family stuff which made up most of my time. Went to a dinner to honor my uncle who tragically died saving his men during Vietnam war from a tragic explosion that happened on a plane they were riding on. He was a great man according to my mom.
Here is an example of freetype rendering text to a cli
Alright added in font rendering :)
I'm going to add in a separate shader to render fonts because it should be rendered on top of the game render unless it being used with in the render. Plus I want to add in coloring.
Alright added in a font shader to render out color font :)
Here is the postprocessing image... Shown in green for demonstration purposes.
Alright I'm going to be adding in 4 new additions to the render system.
Texture2D manager will manage the 2D textures from a centralizer location. Now not all Texture2D will require a file load because they are being use to render to texture or some other purpose.
Texture2DArray manager will be very similar to the Texture2D manager but will manage Texture2DArrays
VertexBuffer manager will be used in a similar way to the previous 2 however it doesn't need to worry about loading anything from a file.
IndexBuffer manager will be the same as VertexBuffer manager, however, its for IndexBuffers.
Reload function are functions that will be called when the game reloads. I'm still debating on how this will work because I might need two functions for this one were I'm releasing resources and another reinitializing them. I might split it up into 2 different functions
This actually might be better.
Basically this is the main issues I'm currently tackling. I'm right now adding an opengl wrapper or glw which is in the has a bunch of opengl functionality that is wrapped to make it more focused on the modern pipe. Internally I've decided to use OpenGL 4.x as my main render api. I might decided later on to support Direct3D 11 if I need it (aka driver issues). Here a list of stuff I need for glw
That should sum up what I need for GLW its not a big list because the game engine isn't a 3D game engine so I don't need to add in Cubemaps or RenderBuffer because I'm don't need to Depth buffer for any thing. I might add that in to allow for Z ordering down the line. Next is for the actual render interface. The goal for this render interface is to only allow for the functionality that I'll need for the engine and nothing more. For instance sprite rendering... I can use just the main program to handle most of it but the drawing routine will require me passing a custom VertexBuffer for texCoords. Another example will be for TileMaps and ObjectMaps this will require both a custom VertexBuffers for both the vertices and texCoords. The other thing about the render is that internally it will have a fixed resolution at 640x480 (4:3) or 640x360 (16:9) so the actual render be independent to the actual resolution of the window. This means I'll have to make a FrameBuffer combo and a Texture2D that can resize if the use changes the resolution in the eventual setting menu.