Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
ofxImGui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wt
ofxImGui
Commits
f4b94d91
Commit
f4b94d91
authored
Dec 01, 2019
by
w4t
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VectorCombo, VectorListBox demo
parent
d8d09ed5
Pipeline
#67
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
ofApp.cpp
example-demo/src/ofApp.cpp
+37
-8
ofApp.h
example-demo/src/ofApp.h
+2
-0
No files found.
example-demo/src/ofApp.cpp
View file @
f4b94d91
...
@@ -47,6 +47,14 @@ void ofApp::setup()
...
@@ -47,6 +47,14 @@ void ofApp::setup()
std
::
cout
<<
"GPU : "
<<
glGetString
(
GL_RENDERER
)
<<
std
::
endl
;
std
::
cout
<<
"GPU : "
<<
glGetString
(
GL_RENDERER
)
<<
std
::
endl
;
std
::
cout
<<
"OpenGL ver. "
<<
glGetString
(
GL_VERSION
)
<<
std
::
endl
;
std
::
cout
<<
"OpenGL ver. "
<<
glGetString
(
GL_VERSION
)
<<
std
::
endl
;
std
::
cout
<<
"GLSL ver. "
<<
glGetString
(
GL_SHADING_LANGUAGE_VERSION
)
<<
std
::
endl
;
std
::
cout
<<
"GLSL ver. "
<<
glGetString
(
GL_SHADING_LANGUAGE_VERSION
)
<<
std
::
endl
;
ofDirectory
dataDirectory
(
ofToDataPath
(
""
,
true
));
files
=
dataDirectory
.
getFiles
();
for
(
size_t
i
=
0
;
i
<
files
.
size
();
i
++
)
{
fileNames
.
push_back
(
files
[
i
].
getFileName
());
}
}
}
//--------------------------------------------------------------
//--------------------------------------------------------------
...
@@ -100,11 +108,35 @@ void ofApp::draw() {
...
@@ -100,11 +108,35 @@ void ofApp::draw() {
ImGui
::
ShowDemoWindow
(
&
show_test_window
);
ImGui
::
ShowDemoWindow
(
&
show_test_window
);
}
}
ImGui
::
ShowTabsDemo
(
"Tabs Demo"
);
//
ImGui::ShowTabsDemo("Tabs Demo");
bool
pressed
=
ImGui
::
ImageButton
((
ImTextureID
)(
uintptr_t
)
imageButtonID
,
ImVec2
(
200
,
200
));
if
(
!
fileNames
.
empty
())
pressed
=
ImGui
::
ImageButton
((
ImTextureID
)(
uintptr_t
)
pixelsButtonID
,
ImVec2
(
200
,
200
));
{
pressed
=
ImGui
::
ImageButton
((
ImTextureID
)(
uintptr_t
)
textureSourceID
,
ImVec2
(
200
,
200
));
//ofxImGui::VectorListBox allows for the use of a vector<string> as a data source
static
int
currentListBoxIndex
=
0
;
if
(
ofxImGui
::
VectorListBox
(
"VectorListBox"
,
&
currentListBoxIndex
,
fileNames
))
{
ofLog
()
<<
" VectorListBox FILE PATH: "
<<
files
[
currentListBoxIndex
].
getAbsolutePath
();
}
//ofxImGui::VectorCombo allows for the use of a vector<string> as a data source
static
int
currentFileIndex
=
0
;
if
(
ofxImGui
::
VectorCombo
(
"VectorCombo"
,
&
currentFileIndex
,
fileNames
))
{
ofLog
()
<<
"VectorCombo FILE PATH: "
<<
files
[
currentFileIndex
].
getAbsolutePath
();
}
}
//GetImTextureID is a static function define in Helpers.h that accepts ofTexture, ofImage, or GLuint
if
(
ImGui
::
ImageButton
(
GetImTextureID
(
imageButtonID
),
ImVec2
(
200
,
200
)))
{
ofLog
()
<<
"PRESSED"
;
}
//or do it manually
ImGui
::
Image
((
ImTextureID
)(
uintptr_t
)
textureSourceID
,
ImVec2
(
200
,
200
));
ImGui
::
Image
(
GetImTextureID
(
pixelsButtonID
),
ImVec2
(
200
,
200
));
if
(
doThemeColorsWindow
)
{
if
(
doThemeColorsWindow
)
{
gui
.
openThemeColorWindow
();
gui
.
openThemeColorWindow
();
...
@@ -113,9 +145,6 @@ void ofApp::draw() {
...
@@ -113,9 +145,6 @@ void ofApp::draw() {
//required to call this at end
//required to call this at end
gui
.
end
();
gui
.
end
();
if
(
textureSource
.
isAllocated
())
{
//textureSource.draw(ofRandom(200), ofRandom(200));
}
}
}
//--------------------------------------------------------------
//--------------------------------------------------------------
...
...
example-demo/src/ofApp.h
View file @
f4b94d91
...
@@ -36,4 +36,6 @@ public:
...
@@ -36,4 +36,6 @@ public:
ofTexture
textureSource
;
ofTexture
textureSource
;
GLuint
textureSourceID
;
GLuint
textureSourceID
;
std
::
vector
<
std
::
string
>
fileNames
;
std
::
vector
<
ofFile
>
files
;
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment