Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arm Designer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engeler
Arm Designer
Commits
0ce1fa47
Commit
0ce1fa47
authored
3 years ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
Program starts!
parent
2a1c8048
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/imgui/imgui_impl_sdl.cpp
+2
-2
2 additions, 2 deletions
src/imgui/imgui_impl_sdl.cpp
src/infrastructure.cpp
+1
-3
1 addition, 3 deletions
src/infrastructure.cpp
src/main.cpp
+89
-0
89 additions, 0 deletions
src/main.cpp
with
92 additions
and
5 deletions
src/imgui/imgui_impl_sdl.cpp
+
2
−
2
View file @
0ce1fa47
...
@@ -361,8 +361,8 @@ void ImGui_ImplSDL2_NewFrame(SDL_Window* window)
...
@@ -361,8 +361,8 @@ void ImGui_ImplSDL2_NewFrame(SDL_Window* window)
/*We call the touch specific function here*/
/*We call the touch specific function here*/
/*For the imgui demo we need the top line, for waves we need the second line*/
/*For the imgui demo we need the top line, for waves we need the second line*/
//
ImGui_ImplSDL2_UpdateMousePosAndButtons();
ImGui_ImplSDL2_UpdateMousePosAndButtons
();
ImGui_ImplSDL2_Touch_UpdateMousePosAndButtons
();
//
ImGui_ImplSDL2_Touch_UpdateMousePosAndButtons();
ImGui_ImplSDL2_UpdateMouseCursor
();
ImGui_ImplSDL2_UpdateMouseCursor
();
// Update game controllers (if enabled and available)
// Update game controllers (if enabled and available)
...
...
This diff is collapsed.
Click to expand it.
src/infrastructure.cpp
+
1
−
3
View file @
0ce1fa47
#include
<init.hpp>
#include
<glad/glad.h>
#include
<glad/glad.h>
//#include <SDL2/SDL.h>
#include
<SDL.h>
#include
<SDL.h>
#include
<string>
#include
<string>
#include
<iostream>
#include
<iostream>
...
@@ -26,7 +24,7 @@ bool Infrastructure::init(const std::string name, const int width, const int hei
...
@@ -26,7 +24,7 @@ bool Infrastructure::init(const std::string name, const int width, const int hei
SDL_GL_SetAttribute
(
SDL_GL_MULTISAMPLEBUFFERS
,
1
);
SDL_GL_SetAttribute
(
SDL_GL_MULTISAMPLEBUFFERS
,
1
);
SDL_GL_SetAttribute
(
SDL_GL_MULTISAMPLESAMPLES
,
4
);
SDL_GL_SetAttribute
(
SDL_GL_MULTISAMPLESAMPLES
,
4
);
window_
=
SDL_CreateWindow
(
name
.
c_str
(),
SDL_WINDOWPOS_CENTERED
/*SDL_WINDOWPOS_CENTERED_DISPLAY(1)*/
,
SDL_WINDOWPOS_CENTERED
,
width
,
height
,
SDL_WINDOW_SHOWN
|
SDL_WINDOW_OPENGL
|
SDL_WINDOW_RESIZABLE
|
SDL_WINDOW_FULLSCREEN
);
window_
=
SDL_CreateWindow
(
name
.
c_str
(),
SDL_WINDOWPOS_CENTERED
/*SDL_WINDOWPOS_CENTERED_DISPLAY(1)*/
,
SDL_WINDOWPOS_CENTERED
,
width
,
height
,
SDL_WINDOW_SHOWN
|
SDL_WINDOW_OPENGL
|
SDL_WINDOW_RESIZABLE
);
//uncomment to make ginormous windows visible
//uncomment to make ginormous windows visible
//SDL_SetWindowPosition(window, 0, 0);
//SDL_SetWindowPosition(window, 0, 0);
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
0 → 100644
+
89
−
0
View file @
0ce1fa47
#include
<glad/glad.h>
#include
<SDL.h>
#include
<infrastructure.hpp>
#include
<imgui.h>
#include
<imgui_impl_opengl3.h>
#include
<imgui_impl_sdl.h>
#include
<iostream>
#define WIDTH 1280
#define HEIGHT 720
/*Debugging: Get VRAM info*/
#define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX 0x9048
#define GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX 0x9049
int
main
(
int
argc
,
char
**
argv
)
{
std
::
cout
<<
"Program is Starting
\n
"
;
Infrastructure
infra
;
infra
.
init
(
"Arm Designer"
,
WIDTH
,
HEIGHT
);
IMGUI_CHECKVERSION
();
ImGui
::
CreateContext
();
ImGui
::
StyleColorsDark
();
ImGui_ImplSDL2_InitForOpenGL
(
infra
.
window
(),
infra
.
context
());
const
char
*
glsl_version
=
"#version 330"
;
ImGui_ImplOpenGL3_Init
(
glsl_version
);
for
(
int
i
=
0
;
i
<
1000
;
++
i
)
{
ImGui_ImplOpenGL3_NewFrame
();
ImGui_ImplSDL2_NewFrame
(
infra
.
window
());
ImGui
::
NewFrame
();
ImGui
::
Begin
(
"Developer"
,
nullptr
,
ImGuiWindowFlags_AlwaysAutoResize
);
ImGui
::
Text
(
"Application average %.3f ms/frame (%.1f FPS)"
,
1000.0
/
double
(
ImGui
::
GetIO
().
Framerate
),
double
(
ImGui
::
GetIO
().
Framerate
));
GLint
total_mem_kb
=
0
;
glGetIntegerv
(
GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX
,
&
total_mem_kb
);
ImGui
::
Text
(
"Total VRAM: %.3f MB"
,
static_cast
<
float
>
(
total_mem_kb
)
/
1000.
f
);
GLint
cur_avail_mem_kb
=
0
;
glGetIntegerv
(
GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX
,
&
cur_avail_mem_kb
);
ImGui
::
Text
(
"Available VRAM: %.3f MB"
,
static_cast
<
float
>
(
cur_avail_mem_kb
)
/
1000.
f
);
ImGui
::
Text
(
"Used VRAM: %.3f MB"
,
static_cast
<
float
>
(
total_mem_kb
-
cur_avail_mem_kb
)
/
1000.
f
);
if
(
ImGui
::
GetIO
().
MousePos
[
0
]
<
-
1000000
)
{
ImGui
::
Text
(
"Mouse Coordinates: (N/A, N/A)"
);
}
else
{
ImGui
::
Text
(
"Mouse Coordinates: (%5.f, %5.f)"
,
ImGui
::
GetIO
().
MousePos
[
0
],
ImGui
::
GetIO
().
MousePos
[
1
]);
}
ImGui
::
End
();
ImGui
::
Render
();
glViewport
(
0
,
0
,
WIDTH
,
HEIGHT
);
ImGui_ImplOpenGL3_RenderDrawData
(
ImGui
::
GetDrawData
());
SDL_GL_SwapWindow
(
infra
.
window
());
#ifndef NDEBUG
GLint
err
=
glGetError
();
if
(
err
!=
GL_NO_ERROR
)
{
std
::
cout
<<
"Error Code: "
<<
err
<<
std
::
endl
;
std
::
cout
<<
"GL_NO_ERROR: "
<<
GL_NO_ERROR
<<
std
::
endl
;
std
::
cout
<<
"GL_INVALID_ENUM: "
<<
GL_INVALID_ENUM
<<
std
::
endl
;
std
::
cout
<<
"GL_INVALID_VALUE: "
<<
GL_INVALID_VALUE
<<
std
::
endl
;
std
::
cout
<<
"GL_INVALID_OPERATION: "
<<
GL_INVALID_OPERATION
<<
std
::
endl
;
std
::
cout
<<
"GL_INVALID_FRAMEBUFFER_OPERATION: "
<<
GL_INVALID_FRAMEBUFFER_OPERATION
<<
std
::
endl
;
std
::
cout
<<
"GL_OUT_OF_MEMORY: "
<<
GL_OUT_OF_MEMORY
<<
std
::
endl
;
}
#endif
}
return
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment