Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netrunner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Odilitime
netrunner
Commits
fb231562
Commit
fb231562
authored
7 years ago
by
Odilitime
Browse files
Options
Downloads
Patches
Plain Diff
changeColor()
parent
30d53f69
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graphics/components/BoxComponent.cpp
+20
-0
20 additions, 0 deletions
src/graphics/components/BoxComponent.cpp
src/graphics/components/BoxComponent.h
+1
-0
1 addition, 0 deletions
src/graphics/components/BoxComponent.h
with
21 additions
and
0 deletions
src/graphics/components/BoxComponent.cpp
+
20
−
0
View file @
fb231562
...
...
@@ -186,6 +186,26 @@ void BoxComponent::resize(const int passedWindowWidth, const int passedWindowHei
verticesDirty
=
true
;
}
void
BoxComponent
::
changeColor
(
const
unsigned
int
hexColor
)
{
// really a texture swap
// set texture color
data
[
0
][
0
][
0
]
=
(
hexColor
>>
24
)
&
0xFF
;
data
[
0
][
0
][
1
]
=
(
hexColor
>>
16
)
&
0xFF
;
data
[
0
][
0
][
2
]
=
(
hexColor
>>
8
)
&
0xFF
;
data
[
0
][
0
][
3
]
=
(
hexColor
>>
0
)
&
0xFF
;
glBindVertexArray
(
vertexArrayObject
);
// now replace existing texture
glBindTexture
(
GL_TEXTURE_2D
,
texture
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
GL_RGBA
,
1
,
1
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
data
);
glGenerateMipmap
(
GL_TEXTURE_2D
);
glBindVertexArray
(
0
);
// unbind to prevent anything from accidentally changing it
}
/*
void BoxComponent::resize(const int passedWindowWidth, const int passedWindowHeight) {
...
...
This diff is collapsed.
Click to expand it.
src/graphics/components/BoxComponent.h
+
1
−
0
View file @
fb231562
...
...
@@ -27,6 +27,7 @@ public:
BoxComponent
();
BoxComponent
(
const
float
rawX
,
const
float
rawY
,
const
float
rawWidth
,
const
float
rawHeight
,
const
unsigned
int
hexColor
,
const
int
passedWindowWidth
,
const
int
passedWindowHeight
);
~
BoxComponent
();
void
changeColor
(
const
unsigned
int
hexColor
);
virtual
void
render
();
virtual
void
resize
(
const
int
passedWindowWidth
,
const
int
passedWindowHeight
);
};
...
...
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