mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
Don't mess with render state in AppWindow.
This commit is contained in:
parent
1ddba7d9d0
commit
c6a43e16be
@ -7,6 +7,7 @@
|
|||||||
#include "render_core/keyboard.h"
|
#include "render_core/keyboard.h"
|
||||||
#include "render_core/mesh_utils.h"
|
#include "render_core/mesh_utils.h"
|
||||||
#include "render_immediate/renderer.h"
|
#include "render_immediate/renderer.h"
|
||||||
|
#include "render_core/window.h"
|
||||||
//#include "render_core/font.h"
|
//#include "render_core/font.h"
|
||||||
|
|
||||||
void GameScene::input_event(const Ref<InputEvent> &event) {
|
void GameScene::input_event(const Ref<InputEvent> &event) {
|
||||||
@ -79,6 +80,17 @@ void GameScene::update(float delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameScene::render() {
|
void GameScene::render() {
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
AppWindow::get_singleton()->reset_viewport();
|
||||||
|
|
||||||
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static float rotmi = 0;
|
static float rotmi = 0;
|
||||||
|
|
||||||
if (render_type == 0) {
|
if (render_type == 0) {
|
||||||
@ -269,9 +281,6 @@ void GameScene::render_immediate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameScene::render_obj() {
|
void GameScene::render_obj() {
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
|
|
||||||
//static float rot = 0;
|
//static float rot = 0;
|
||||||
//Transform t = camera->get_camera_transform();
|
//Transform t = camera->get_camera_transform();
|
||||||
//t.basis = Basis(Vector3(0, 1, 0), rot);
|
//t.basis = Basis(Vector3(0, 1, 0), rot);
|
||||||
|
@ -250,31 +250,7 @@ void AppWindow::glNewFrame() {
|
|||||||
AppWindow::get_singleton()->width = w;
|
AppWindow::get_singleton()->width = w;
|
||||||
AppWindow::get_singleton()->height = h;
|
AppWindow::get_singleton()->height = h;
|
||||||
|
|
||||||
// blending defaults
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
// culling defaults
|
|
||||||
// glEnable(GL_CULL_FACE);
|
|
||||||
// glCullFace(GL_BACK);
|
|
||||||
// glFrontFace(GL_CCW);
|
|
||||||
|
|
||||||
// depth-testing defaults
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
// glDepthFunc(GL_LESS);
|
|
||||||
|
|
||||||
// depth-writing defaults
|
|
||||||
// glDepthMask(GL_TRUE);
|
|
||||||
|
|
||||||
// seamless cubemaps
|
|
||||||
// glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
// GLfloat bgColor[4]; glGetFloatv(GL_COLOR_CLEAR_VALUE, bgColor);
|
|
||||||
glClearColor(winbgcolor.r, winbgcolor.g, winbgcolor.b, has_transparent() ? 0 : winbgcolor.a); // @transparent
|
|
||||||
//glClearColor(0.15,0.15,0.15,1);
|
|
||||||
//glClearColor( clearColor.r, clearColor.g, clearColor.b, clearColor.a );
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppWindow::create_from_handle(void *handle, bool full_Screen, float canvas_scale, unsigned int flags, float window_scale) {
|
bool AppWindow::create_from_handle(void *handle, bool full_Screen, float canvas_scale, unsigned int flags, float window_scale) {
|
||||||
@ -510,32 +486,9 @@ int AppWindow::frame_begin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AppWindow::frame_end() {
|
void AppWindow::frame_end() {
|
||||||
// flush batching systems that need to be rendered before frame swapping. order matters.
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
font_goto(0, 0);
|
|
||||||
touch_flush();
|
|
||||||
sprite_flush();
|
|
||||||
|
|
||||||
// flush all debugdraw calls before swap
|
|
||||||
dd_ontop = 0;
|
|
||||||
ddraw_flush();
|
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
|
||||||
dd_ontop = 1;
|
|
||||||
ddraw_flush();
|
|
||||||
|
|
||||||
ui_render();
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppWindow::frame_swap() {
|
void AppWindow::frame_swap() {
|
||||||
// glFinish();
|
|
||||||
/*
|
|
||||||
#ifndef __EMSCRIPTEN__
|
|
||||||
vsync(hz);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
glfwSwapBuffers(_window);
|
glfwSwapBuffers(_window);
|
||||||
// emscripten_webgl_commit_frame();
|
// emscripten_webgl_commit_frame();
|
||||||
}
|
}
|
||||||
@ -544,6 +497,10 @@ void AppWindow::shutdown() {
|
|||||||
loop_exit(); // finish emscripten loop automatically
|
loop_exit(); // finish emscripten loop automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppWindow::reset_viewport() {
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
int AppWindow::swap() {
|
int AppWindow::swap() {
|
||||||
// end frame
|
// end frame
|
||||||
if (frame_count > 0) {
|
if (frame_count > 0) {
|
||||||
|
@ -107,6 +107,8 @@ public:
|
|||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
|
void reset_viewport();
|
||||||
|
|
||||||
Vector2 dpi();
|
Vector2 dpi();
|
||||||
|
|
||||||
enum CURSOR_SHAPES {
|
enum CURSOR_SHAPES {
|
||||||
|
Loading…
Reference in New Issue
Block a user