Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
f04489d8
Commit
f04489d8
authored
Aug 30, 2020
by
Kirill Terekhov
Browse files
Fix few warnings and opengl error in DrawGrid
parent
a2f605f6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Examples/DrawGrid/color_bar.cpp
View file @
f04489d8
...
...
@@ -117,7 +117,7 @@ namespace INMOST
void
color_bar
::
InitTexture
()
{
samples
=
4096
;
samples
=
512
;
float
*
pixel_array
=
new
float
[(
samples
+
2
)
*
4
];
...
...
@@ -147,24 +147,35 @@ namespace INMOST
pixel_array
[(
samples
+
1
)
*
4
+
2
]
=
0
;
pixel_array
[(
samples
+
1
)
*
4
+
3
]
=
1
;
glPrintError
();
glEnable
(
GL_TEXTURE
);
//glEnable(GL_TEXTURE);
//glPrintError();
glEnable
(
GL_TEXTURE_1D
);
glPrintError
();
glGenTextures
(
1
,
&
texture
);
glPrintError
();
glBindTexture
(
GL_TEXTURE_1D
,
texture
);
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
1
);
glPrintError
();
//glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage1D
(
GL_TEXTURE_1D
,
0
,
4
,
samples
+
2
,
1
,
GL_RGBA
,
GL_FLOAT
,
pixel_array
);
glPrintError
();
std
::
cout
<<
"Created texture "
<<
texture
<<
std
::
endl
;
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP
);
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glPrintError
();
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
glPrintError
();
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MIN_FILTER
,
GL_NEAREST
);
glPrintError
();
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_DECAL
);
glPrintError
();
UnbindTexture
();
delete
[]
pixel_array
;
...
...
@@ -172,15 +183,21 @@ namespace INMOST
void
color_bar
::
BindTexture
()
{
//glDisable(
GL_TEXTURE_GEN_S );
glDisable
(
GL_TEXTURE_2D
);
//glDisable(GL_TEXTURE_GEN_S );
//
glDisable(GL_TEXTURE_2D);
glEnable
(
GL_TEXTURE_1D
);
glPrintError
();
glBindTexture
(
GL_TEXTURE_1D
,
texture
);
glPrintError
();
}
void
color_bar
::
UnbindTexture
()
{
//glDisable(GL_TEXTURE_1D);
glDisable
(
GL_TEXTURE_1D
);
glPrintError
();
}
double
color_bar
::
pick_texture
(
double
value
)
const
...
...
Examples/DrawGrid/face2gl.cpp
View file @
f04489d8
...
...
@@ -502,23 +502,30 @@ namespace INMOST
void
draw_faces
(
std
::
vector
<
face2gl
>
&
set
,
int
highlight
)
{
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPrintError
();
glPolygonOffset
(
1.0
,
1.0
);
glPrintError
();
if
(
isColorBarEnabled
())
GetColorBar
()
->
BindTexture
();
glPrintError
();
glBegin
(
GL_TRIANGLES
);
for
(
INMOST_DATA_ENUM_TYPE
q
=
0
;
q
<
set
.
size
();
q
++
)
set
[
q
].
draw_colour
();
for
(
INMOST_DATA_ENUM_TYPE
q
=
0
;
q
<
set
.
size
();
q
++
)
set
[
q
].
draw_colour
();
glEnd
();
glPrintError
();
if
(
isColorBarEnabled
())
GetColorBar
()
->
UnbindTexture
();
glPrintError
();
if
(
highlight
!=
-
1
)
{
glColor4f
(
1
,
0
,
0
,
1
);
glPrintError
();
glBegin
(
GL_TRIANGLES
);
set
[
highlight
].
draw
();
glEnd
();
glPrintError
();
}
glDisable
(
GL_POLYGON_OFFSET_FILL
);
glPrintError
();
}
...
...
Examples/DrawGrid/inc_glut.h
View file @
f04489d8
...
...
@@ -16,7 +16,7 @@
#include <windows.h>
#include <GL/glut.h>
//#include "glut.h"
#pragma comment(lib,"glut32.lib")
//
#pragma comment(lib,"glut32.lib")
#endif
#if defined(__linux__)
#include <GL/glut.h>
...
...
@@ -29,5 +29,27 @@ static void glVertexNdv(double * v, int N)
if
(
N
==
2
)
glVertex2dv
(
v
);
else
glVertex3dv
(
v
);
}
#include <iostream>
static
void
glPrintError
()
{
unsigned
err
=
GL_NO_ERROR
;
do
{
err
=
glGetError
();
switch
(
err
)
{
case
GL_INVALID_ENUM
:
std
::
cout
<<
"invalid enum"
<<
std
::
endl
;
break
;
case
GL_INVALID_VALUE
:
std
::
cout
<<
"invalid value"
<<
std
::
endl
;
break
;
case
GL_INVALID_OPERATION
:
std
::
cout
<<
"invalid operation"
<<
std
::
endl
;
break
;
//case GL_INVALID_FRAMEBUFFER_OPERATION:
case
GL_OUT_OF_MEMORY
:
std
::
cout
<<
"out of memory"
<<
std
::
endl
;
break
;
case
GL_STACK_UNDERFLOW
:
std
::
cout
<<
"stack underflow"
<<
std
::
endl
;
break
;
case
GL_STACK_OVERFLOW
:
std
::
cout
<<
"stack overflow"
<<
std
::
endl
;
break
;
case
GL_NO_ERROR
:
break
;
default:
std
::
cout
<<
"unknown error "
<<
err
<<
std
::
endl
;
break
;
}
if
(
err
!=
GL_NO_ERROR
)
throw
err
;
}
while
(
err
!=
GL_NO_ERROR
);
}
#endif
Examples/DrawGrid/main.cpp
View file @
f04489d8
...
...
@@ -1806,6 +1806,7 @@ void ProcessCommonInput(char inpstr[8192], int inptype)
if
(
res
>
max
)
max
=
res
;
it
->
RealDF
(
visualization_tag
)
=
res
;
}
printf
(
"done
\n
"
);
GetColorBar
()
->
set_min
(
min
);
GetColorBar
()
->
set_max
(
max
);
...
...
@@ -1863,6 +1864,7 @@ void ProcessCommonInput(char inpstr[8192], int inptype)
else
printf
(
"component is out of range for tag %s of size %u
\n
"
,
name
,
source_tag
.
GetSize
());
}
else
printf
(
"mesh do not have tag with name %s
\n
"
,
name
);
printf
(
"finished with %s
\n
"
,
inpstr
);
}
else
if
(
!
correct_input
)
printf
(
"malformed string %s for visualization
\n
"
,
inpstr
);
//inpstr[0] = '\0';
...
...
@@ -2038,19 +2040,30 @@ void draw_screen()
//printf("draw2 %d %d\n",interactive, clipboxupdate);
if
(
interactive
)
{
glPrintError
();
if
(
!
(
drawedges
==
2
||
drawedges
==
3
))
draw_faces_interactive
(
clip_boundary
);
glColor4f
(
0
,
0
,
0
,
1
);
glPrintError
();
glColor4f
(
0.
,
0.
,
0.
,
1.
);
glPrintError
();
if
(
drawedges
&&
drawedges
!=
2
)
draw_edges_interactive
(
clip_boundary
);
glPrintError
();
}
else
{
glPrintError
();
if
(
!
(
drawedges
==
2
||
drawedges
==
3
))
draw_faces
(
clip_boundary
,
picked
);
glColor4f
(
0
,
0
,
0
,
1
);
std
::
cout
<<
"draw faces passed"
<<
std
::
endl
;
glPrintError
();
glColor4f
(
0.
,
0.
,
0.
,
1.
);
std
::
cout
<<
"set color passed"
<<
std
::
endl
;
glPrintError
();
if
(
drawedges
&&
drawedges
!=
2
)
draw_edges
(
clip_boundary
,
picked
);
std
::
cout
<<
"draw edges passed"
<<
std
::
endl
;
glPrintError
();
}
}
}
...
...
@@ -2071,8 +2084,9 @@ void draw_screen()
for
(
int
k
=
0
;
k
<
streamlines
.
size
();
++
k
)
streamlines
[
k
].
Draw
(
true
);
//interactive);
glColor4f
(
0
,
0
,
0
,
1
);
glBegin
(
GL_LINES
);
glColor4f
(
0
,
0
,
0
,
1
);
for
(
int
k
=
0
;
k
<
segments
.
size
();
++
k
)
segments
[
k
].
Draw
();
glEnd
();
...
...
@@ -2733,6 +2747,9 @@ int main(int argc, char ** argv)
glutInitWindowSize
(
width
,
height
);
glutInitWindowPosition
(
100
,
100
);
wnd
=
glutCreateWindow
(
"Graph"
);
//glEnable(GL_DEBUG_OUTPUT);
glDepthFunc
(
GL_LEQUAL
);
glClearDepth
(
1.
f
);
...
...
@@ -2742,8 +2759,8 @@ int main(int argc, char ** argv)
glHint
(
GL_POLYGON_SMOOTH_HINT
,
GL_NICEST
);
glHint
(
GL_LINE_SMOOTH_HINT
,
GL_NICEST
);
//
glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
//
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
...
...
Examples/DrawGridTests/my_glut.h
View file @
f04489d8
...
...
@@ -11,7 +11,7 @@
#include <windows.h>
#include <GL/glut.h>
//#include "glut.h"
#pragma comment(lib,"glut32.lib")
//
#pragma comment(lib,"glut32.lib")
#endif
#if defined(__linux__)
#include <GL/glut.h>
...
...
Examples/DrawMatrix/my_glut.h
View file @
f04489d8
...
...
@@ -11,7 +11,7 @@
#include <windows.h>
#include <GL/glut.h>
//#include "glut.h"
#pragma comment(lib,"glut32.lib")
//
#pragma comment(lib,"glut32.lib")
#endif
#if defined(__linux__)
#include <GL/glut.h>
...
...
Source/Headers/container.hpp
View file @
f04489d8
...
...
@@ -2872,7 +2872,7 @@ namespace INMOST
page_fault_type
page_fault
;
public:
unsigned
last_byte
()
const
{
return
last_alloc
.
back
();}
unsigned
allocations
()
const
{
return
inuse
.
size
()
-
1
;
}
unsigned
allocations
()
const
{
return
(
unsigned
)(
inuse
.
size
()
-
1
)
;
}
memory_pool
()
{
pool
.
push_back
((
char
*
)
malloc
(
sizeof
(
char
)
*
(
1
<<
pool_size_bits
)));
...
...
@@ -2935,7 +2935,7 @@ namespace INMOST
void
deallocate
(
T
*
mem
)
{
bool
find
=
false
;
unsigned
checkpos
=
last_alloc
.
size
(),
oldpos
,
newpos
,
pagepos
,
datapos
;
unsigned
checkpos
=
(
unsigned
)
last_alloc
.
size
(),
oldpos
,
newpos
,
pagepos
,
datapos
;
if
(
checkpos
>
1
)
{
while
(
!
find
&&
checkpos
>
1
)
...
...
Source/Headers/inmost_data.h
View file @
f04489d8
...
...
@@ -350,7 +350,7 @@ namespace INMOST
{
Mesh
*
m
;
public:
iterator
()
:
shell
<
HandleType
>::
iterator
()
{}
iterator
()
:
shell
<
HandleType
>::
iterator
()
,
m
(
NULL
)
{}
iterator
(
Mesh
*
m
,
const
shell
<
HandleType
>::
iterator
&
other
)
:
shell
<
HandleType
>::
iterator
(
other
),
m
(
m
)
{}
iterator
(
const
iterator
&
other
)
:
shell
<
HandleType
>::
iterator
(
other
),
m
(
other
.
m
)
{}
iterator
&
operator
=
(
iterator
const
&
other
)
{
m
=
other
.
m
;
shell
<
HandleType
>::
iterator
::
operator
=
(
other
);
return
*
this
;}
...
...
@@ -364,7 +364,7 @@ namespace INMOST
{
Mesh
*
m
;
public:
const_iterator
()
:
shell
<
HandleType
>::
const_iterator
()
{}
const_iterator
()
:
shell
<
HandleType
>::
const_iterator
()
,
m
(
NULL
)
{}
const_iterator
(
Mesh
*
m
,
const
shell
<
HandleType
>::
const_iterator
&
other
)
:
shell
<
HandleType
>::
const_iterator
(
other
)
,
m
(
m
)
{}
const_iterator
(
const
const_iterator
&
other
)
:
shell
<
HandleType
>::
const_iterator
(
other
),
m
(
other
.
m
)
{}
const_iterator
&
operator
=
(
const_iterator
const
&
other
)
{
m
=
other
.
m
;
shell
<
HandleType
>::
const_iterator
::
operator
=
(
other
);
return
*
this
;}
...
...
Source/Headers/inmost_dense.h
View file @
f04489d8
...
...
@@ -2376,7 +2376,6 @@ namespace INMOST
else
{
//~ typename Promote<INMOST_DATA_REAL_TYPE,variable>::type tmp = 0.0;
#pragma unroll
for
(
enumerator
k
=
0
;
k
<
Cols
();
++
k
)
ret
(
i
,
j
)
+=
(
*
this
)(
i
,
k
)
*
other
(
k
,
j
);
//~ ret(i,j) = tmp;
...
...
@@ -2415,7 +2414,6 @@ namespace INMOST
else
{
//~ typename Promote<INMOST_DATA_REAL_TYPE,variable>::type tmp = 0.0;
#pragma unroll
for
(
enumerator
k
=
0
;
k
<
Cols
();
++
k
)
ret
(
i
,
j
)
+=
(
*
this
)(
i
,
k
)
*
other
(
k
,
j
);
//~ ret(i,j) = tmp;
...
...
@@ -2454,7 +2452,6 @@ namespace INMOST
else
{
//~ typename Promote<INMOST_DATA_REAL_TYPE,variable>::type tmp = 0.0;
#pragma unroll
for
(
enumerator
k
=
0
;
k
<
Cols
();
++
k
)
ret
(
i
,
j
)
+=
(
*
this
)(
i
,
k
)
*
other
(
k
,
j
);
//~ ret(i,j) = tmp;
...
...
@@ -2476,7 +2473,6 @@ namespace INMOST
for
(
enumerator
j
=
0
;
j
<
other
.
Cols
();
++
j
)
//loop columns
{
//~ typename Promote<Var,typeB>::type tmp = 0.0;
#pragma unroll
for
(
enumerator
k
=
0
;
k
<
Cols
();
++
k
)
ret
(
i
,
j
)
+=
(
*
this
)(
i
,
k
)
*
other
(
k
,
j
);
//~ ret(i,j) = tmp;
...
...
@@ -3452,7 +3448,7 @@ namespace INMOST
}
else
throw
MatrixPseudoSolveFail
;
}
for
(
int
k
=
0
;
k
<
S
.
Cols
();
++
k
)
for
(
int
k
=
0
;
k
<
(
int
)
S
.
Cols
();
++
k
)
{
if
(
S
(
k
,
k
)
>
tol
)
S
(
k
,
k
)
=
1.0
/
S
(
k
,
k
);
...
...
Source/Solver/solver_inner/solver_mlmptiluc/solver_mlmtiluc2.cpp
View file @
f04489d8
...
...
@@ -5063,7 +5063,7 @@ const INMOST_DATA_ENUM_TYPE UNDEF = ENUMUNDEF, EOL = ENUMUNDEF - 1;
#if defined(USE_OMP_FACT)
#pragma omp for
#endif
for
(
k
=
cend
;
k
<
wend
;
++
k
)
for
(
int
k
=
cend
;
k
<
wend
;
++
k
)
{
INMOST_DATA_REAL_TYPE
v
,
coef
;
INMOST_DATA_ENUM_TYPE
Sbeg
=
EOL
,
i
,
j
;
...
...
@@ -5102,7 +5102,7 @@ const INMOST_DATA_ENUM_TYPE UNDEF = ENUMUNDEF, EOL = ENUMUNDEF - 1;
#if defined(USE_OMP_FACT)
#pragma omp for
#endif
for
(
k
=
cend
;
k
<
wend
;
++
k
)
for
(
int
k
=
cend
;
k
<
wend
;
++
k
)
{
for
(
unsigned
j
=
0
;
j
<
Scolmax_local
.
size
();
++
j
)
Scolmax
[
k
]
=
std
::
max
(
Scolmax
[
k
],
Scolmax_local
[
j
][
k
]);
...
...
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