Coder Social home page Coder Social logo

mortennobel / simplerenderengine Goto Github PK

View Code? Open in Web Editor NEW
339.0 21.0 59.0 28.19 MB

Small C++14 render engine

License: MIT License

CMake 2.60% C++ 92.85% Shell 1.52% GLSL 3.03%
opengl webgl rendering rendering-engine rendering-3d-graphics cpp shaders imgui game-engine 3d-graphics-engine

simplerenderengine's Introduction

GitHub license Build Status Codacy Badge

SimpleRenderEngine

The goal of SimpleRenderEngine (sre) is to provide easy way to get started with graphics programming in 2D or 3D without a deep knowledge about the low-level graphics APIs like OpenGL, DirectX and Vulkan.

SimpleRenderEngine currently depends on Simple Direct Layer 2.x (SDL2), SDL2-image, OpenGL Mathematics (GLM), and OpenGL 3.3 (or higher), Dear ImGui and runs on both Windows, macOS and Linux.

sre provides:

  • Virtual camera (perspective and orthographic)
  • Texture support (JPEG, PNG)
  • Cube map support
  • Mesh support (with custom vertex attributes)
  • Shaders (PBR, Blinn-Phong, unlit, alpha blending, and custom shaders)
  • Enforces efficient use of OpenGL
  • Forward rendering
  • Full C++14 support
  • Support for 2D or 3D rendering
  • GUI rendering (using Dear ImGui)
  • Emscripten support (allows cross compiling to HTML 5 + WebGL)
  • VR support (OpenVR)
  • Bump mapping
  • Shadowmap

To keep sre as simple and flexible as possible the following features are not a part of sre:

  • Scenegraphs
  • Deferred rendering
  • Dynamic particle systems

Getting started

First clone the library (git clone --recurse-submodules https://github.com/mortennobel/SimpleRenderEngine.git). You can use of the examples as starting point.

If you want to create new projects using SimpleRenderEngine you can use SimpleRenderEngineTemplate as a simple project template.

Also look into SimpleRenderEngineProject as starting point, which bundles all/most dependencies for Windows and macOS.

Examples

Example usage can be found in the examples folder.

MatcapPickingSkyboxRender to textureCloth_SimulationShadowsGLSL EditorPlatformerParticle systemImGUI integration

Documentation

API documentation is defined in header files.

Other resources

simplerenderengine's People

Contributors

kasperhdl avatar mortennobel avatar pyjamads avatar realek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplerenderengine's Issues

How to build this engine?

I looked around the project, but I am hardly to find any way to build this engine, especially on macOS or Windows 7, any help?

RenderPass failure when using plain Renderer (missing initialization?)

I've been trying to use the Renderer class directly without the use of the SDLRenderer because the latter didn't allow to split the engine into different systems like rendering / IO / ...

But when I create a RenderPass I end up with a corrupted stack. All the other examples seemed to work fine though.

I create the Renderer with a pointer to the SDL_Window and vsync false and my render loop looks like this (see: SimpleRenderer.cpp in the attached zip):

    auto cameraObj = ObjectManager::GetInstance()->getCameraManager().GetActiveCamera();

    auto rp = sre::RenderPass::create()
            .withCamera(*cameraObj)
            .build();

    auto spriteBatchBuilder = sre::SpriteBatch::create();
    for (auto& renderComp : ObjectManager::GetInstance()->getRenderableComponents()){
        renderComp->renderSprite(spriteBatchBuilder);
    }

    auto sb = spriteBatchBuilder.build();
    rp.draw(sb);

Full project: master.zip
On linux It crashes at line 386: glLinkProgram(g_ShaderHandle); in imgui_sre.cpp
On windows it crashes at the end of the same method.


  • Is there some code which has to be executed for initialization that I'm missing?
  • Is there an example on how to use the plain Renderer?

Error about SRE-Example-17_deferred-shading

Hi,
I think SRE is a great project! But when I try to run SRE-Example-17_deferred-shading, I got the error message like this

OpenGL version 3.3.0 NVIDIA 384.130 (3.3)
sre version 1.1.4
SRE Error: /home/xhg/SimpleRenderEngine/src/sre/ModelImporter.cpp:82 in getFileContents()
Error reading examples_data/sponza/sponza.obj. Error code: 2
RenderPass
GL_INVALID_ENUM

By the way, my operating system is Ubuntu 16.04.

Screenshots

Some screenshots of the engine in action would be nice.

Error compiling sre

On ubuntu 16.04 LTS, gcc version 5.4.0 20160609, i have this error :

Texture.cpp:126:70: error: โ€˜SDL_PIXELFORMAT_RGBA32โ€™ was not declared in this scope
alpha ?SDL_PIXELFORMAT_RGBA32 : SDL_PIXELFORMAT_RGB24, 0);

Check correct uniform type in debug mode

Enforce checking if the value type is correct in shader->set(name, value) in debug mode.
This allows catching errors such as shader->set("specularity",20); where shader->set("specularity",20.0f); is expected.

Specularity

Specularity is stored in the light - but should probably be a 'raw' shader property.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.