aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/RenderBackend/OpenGL/DeviceFrame.hpp1
-rw-r--r--include/RenderBackend/OpenGL/DeviceMemory.hpp2
-rw-r--r--src/RenderBackend/OpenGL/ShaderProgram.cpp2
-rw-r--r--src/RenderBackend/OpenGL/Texture2D.cpp4
-rw-r--r--src/main.cpp5
5 files changed, 6 insertions, 8 deletions
diff --git a/include/RenderBackend/OpenGL/DeviceFrame.hpp b/include/RenderBackend/OpenGL/DeviceFrame.hpp
index f10af4c..3fa7fe7 100644
--- a/include/RenderBackend/OpenGL/DeviceFrame.hpp
+++ b/include/RenderBackend/OpenGL/DeviceFrame.hpp
@@ -16,6 +16,7 @@ namespace amalgine
DeviceFrame();
~DeviceFrame();
+ // The returned pointers cleaned when the frame is cleaned. Do not deallocate the returned pointer!
DeviceMemory* alloc();
void draw(ShaderProgram *shader);
private:
diff --git a/include/RenderBackend/OpenGL/DeviceMemory.hpp b/include/RenderBackend/OpenGL/DeviceMemory.hpp
index 3e0fede..5f593fc 100644
--- a/include/RenderBackend/OpenGL/DeviceMemory.hpp
+++ b/include/RenderBackend/OpenGL/DeviceMemory.hpp
@@ -35,7 +35,6 @@ namespace amalgine {
TRIANGLE
};
- ~DeviceMemory();
//void copy(const DataView<f32> &data, StorageType storageType, PrimitiveType primitiveType = PrimitiveType::TRIANGLE);
void copy(const DataView<vec2f> &texture_coords, StorageType storageType);
void copy(const DataView<Triangle2D> &triangles, StorageType storageType);
@@ -45,6 +44,7 @@ namespace amalgine {
DeviceMemoryType get_type() const { return type; }
private:
DeviceMemory();
+ ~DeviceMemory();
void use() const;
private:
u32 vertexBufferObjectId;
diff --git a/src/RenderBackend/OpenGL/ShaderProgram.cpp b/src/RenderBackend/OpenGL/ShaderProgram.cpp
index 14b15aa..7990a82 100644
--- a/src/RenderBackend/OpenGL/ShaderProgram.cpp
+++ b/src/RenderBackend/OpenGL/ShaderProgram.cpp
@@ -12,7 +12,7 @@ namespace amalgine {
ShaderProgram::~ShaderProgram()
{
- GLint numAttachedShaders;
+ GLint numAttachedShaders = 0;
glGetProgramiv(program_id, GL_ATTACHED_SHADERS, &numAttachedShaders);
GLuint *attachedShaders = new GLuint[numAttachedShaders];
diff --git a/src/RenderBackend/OpenGL/Texture2D.cpp b/src/RenderBackend/OpenGL/Texture2D.cpp
index a561f6e..dcb9cef 100644
--- a/src/RenderBackend/OpenGL/Texture2D.cpp
+++ b/src/RenderBackend/OpenGL/Texture2D.cpp
@@ -7,10 +7,10 @@
namespace amalgine {
struct TextureIdAllocator {
TextureIdAllocator(){
- glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_units);
+ glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_texture_units);
if(max_texture_units < 1)
max_texture_units = 1;
- printf("max texture units: %d\n", max_texture_units);
+ fprintf(stderr, "max texture units: %d\n", max_texture_units);
}
u32 get_free_texture_id() {
diff --git a/src/main.cpp b/src/main.cpp
index 5845332..22bfe1c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -180,11 +180,8 @@ int main()
glfwSwapBuffers(window);
}
- delete model_gpu_texture;
delete image;
- delete gpuModel;
- delete gpuSand;
- glfwTerminate();
+ //glfwTerminate();
return 0;
}