Added MipMap to Texture and proper opengl debug info

This commit is contained in:
Julian Nießner
2018-05-10 23:16:23 +02:00
parent 47a47a15a4
commit 50fe9dbe02
5 changed files with 13 additions and 23 deletions

View File

@@ -7,7 +7,7 @@ class OrtographicCamera {
private:
glm::vec2 cameraPos;
float zoom = 0.01f;
float zoom = 0.05f;
public:
OrtographicCamera() : cameraPos(glm::vec2(-5.0f,-5.0f)) {}

View File

@@ -116,22 +116,16 @@ void DarkRP2D::render(unsigned int delta) {
{
static float f = 0.0f;
static int counter = 0;
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
ImGui::Text("-------------------OpenGL Info-------------------------");
ImGui::Text("GLEW Version: %s\n", glewGetString(GLEW_VERSION));
ImGui::Text(" Version: %s\n", glGetString(GL_VERSION));
ImGui::Text(" Vendor: %s\n", glGetString(GL_VENDOR));
ImGui::Text(" Renderer: %s\n", glGetString(GL_RENDERER));
ImGui::Text(" Shading: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
ImGui::Text("----------------------------------------------------------");
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
}
ImGui::Render();
ImGui_ImplSdlGL3_RenderDrawData(ImGui::GetDrawData());
#endif

View File

@@ -88,15 +88,7 @@ bool initSDL() {
if (GLEW_KHR_debug) {
Utility::printInfo(Utility::GLEW, "Supporting KHR debug output!");
}
//Print OpenGL version
printf("----------------------OpenGL Info----------------------------\n");
printf("Glew Version: %s\n", glewGetString(GLEW_VERSION));
printf(" Version: %s\n", glGetString(GL_VERSION));
printf(" Vendor: %s\n", glGetString(GL_VENDOR));
printf(" Renderer: %s\n", glGetString(GL_RENDERER));
printf(" Shading: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
printf("----------------------------------------------------------------\n");
if(glDebugMessageCallback) {
glEnable(GL_DEBUG_OUTPUT);
Utility::printInfo(Utility::OpenGL, "Register OpenGL debug callback");

View File

@@ -1,6 +1,8 @@
#ifndef DESKTOPLAUNCHER_H
#define DESKTOPLAUNCHER_H
#include <string>
namespace Game {
#define WINDOW_WIDTH = 800;

View File

@@ -15,6 +15,8 @@ void Texture2D::Generate(GLuint width, GLuint height, unsigned char* data) {
// Create Texture
glBindTexture(GL_TEXTURE_2D, this->ID);
glTexImage2D(GL_TEXTURE_2D, 0, this->Internal_Format, width, height, 0, this->Image_Format, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
// Set Texture wrap and filter modes
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, this->Wrap_S);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, this->Wrap_T);