Fixed issue where cameras would use the render resolution set in config instead of actual resolution

dev
Shariq Shah 6 years ago
parent 4f3632bb3e
commit 0ea5ee3e89
  1. 1
      src/game/editor.c
  2. 1
      src/game/player.c
  3. 6
      src/system/platform.c
  4. 4
      todo.txt

@ -178,6 +178,7 @@ void editor_init_camera(struct Editor* editor, struct Hashmap* cvars)
{ {
int render_width = hashmap_int_get(cvars, "render_width"); int render_width = hashmap_int_get(cvars, "render_width");
int render_height = hashmap_int_get(cvars, "render_height"); int render_height = hashmap_int_get(cvars, "render_height");
window_get_drawable_size(game_state_get()->window, &render_width, &render_height);
camera_attach_fbo(editor_camera, render_width, render_height, true, true, true); camera_attach_fbo(editor_camera, render_width, render_height, true, true, true);
} }

@ -44,6 +44,7 @@ void player_init(struct Player* player, struct Scene* scene)
{ {
int render_width = hashmap_int_get(config, "render_width"); int render_width = hashmap_int_get(config, "render_width");
int render_height = hashmap_int_get(config, "render_height"); int render_height = hashmap_int_get(config, "render_height");
window_get_drawable_size(game_state->window, &render_width, &render_height);
camera_attach_fbo(player_camera, render_width, render_height, true, true, true); camera_attach_fbo(player_camera, render_width, render_height, true, true, true);
} }

@ -91,12 +91,6 @@ struct Window* window_create(const char* title, int width, int height, int msaa,
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major);
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor);
log_message("Window created and initialized with opengl core context %d.%d", major, minor); log_message("Window created and initialized with opengl core context %d.%d", major, minor);
int msaa_recieved = 0, msaa_recieved_levels = 0;
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &msaa_recieved);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_recieved_levels);
log_message("MSAA : %d MSAA Levels : %d", msaa_recieved, msaa_recieved_levels);
return new_window; return new_window;
} }

@ -1,5 +1,4 @@
Todo: Todo:
- Fix cameras not resizing to current resolution when scene is loaded/reloaded
- Allow renaming scene objects in editor - Allow renaming scene objects in editor
- Add parameter to entity_load command that renames the newly loaded object to whatever the second specified parameter is - Add parameter to entity_load command that renames the newly loaded object to whatever the second specified parameter is
- Bring back debug variable display in editor and allow showing colours, textures etc - Bring back debug variable display in editor and allow showing colours, textures etc
@ -343,4 +342,5 @@ Done:
* Fixed bugs with meshes being registered to uninitialized materials and not rendering * Fixed bugs with meshes being registered to uninitialized materials and not rendering
* Added EF_SKIP_RENDER flag to allow entites to skip rendering * Added EF_SKIP_RENDER flag to allow entites to skip rendering
* Save default entity archetype to be loaded when there is not other archetype or in case of an error as fallback * Save default entity archetype to be loaded when there is not other archetype or in case of an error as fallback
* Ensure cameras are not initialized multiple times * Ensure cameras are not initialized multiple times
* Fixed cameras not resizing to current resolution when scene is loaded/reloaded
Loading…
Cancel
Save