mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0032149: Draw Harness, ViewerTest - remove obsolete command vfeedback
This commit is contained in:
parent
9299697997
commit
4464c6b591
@ -218,164 +218,6 @@ static Standard_Integer VUserDraw (Draw_Interpretor& ,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
//function : VFeedback
|
|
||||||
//purpose :
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
static int VFeedback (Draw_Interpretor& theDI,
|
|
||||||
Standard_Integer /*theArgNb*/,
|
|
||||||
const char** /*theArgVec*/)
|
|
||||||
{
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
|
||||||
// get the active view
|
|
||||||
Handle(V3d_View) aView = ViewerTest::CurrentView();
|
|
||||||
if (aView.IsNull())
|
|
||||||
{
|
|
||||||
Message::SendFail ("Error: no active viewer");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int aBufferSize = 1024 * 1024;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
size_t aBytes = (size_t )aBufferSize * sizeof(GLfloat);
|
|
||||||
if (aBytes / sizeof(GLfloat) != (size_t )aBufferSize)
|
|
||||||
{
|
|
||||||
// finito la commedia
|
|
||||||
Message::SendFail() << "Can not allocate buffer - requested size ("
|
|
||||||
<< (double(aBufferSize / (1024 * 1024)) * double(sizeof(GLfloat)))
|
|
||||||
<< " MiB) is out of address space";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLfloat* aBuffer = (GLfloat* )Standard::Allocate (aBytes);
|
|
||||||
if (aBuffer == NULL)
|
|
||||||
{
|
|
||||||
// finito la commedia
|
|
||||||
Message::SendFail() << "Can not allocate buffer with size ("
|
|
||||||
<< (double(aBufferSize / (1024 * 1024)) * double(sizeof(GLfloat)))
|
|
||||||
<< " MiB)";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
glFeedbackBuffer ((GLsizei )aBufferSize, GL_2D, aBuffer);
|
|
||||||
glRenderMode (GL_FEEDBACK);
|
|
||||||
|
|
||||||
aView->Redraw();
|
|
||||||
|
|
||||||
GLint aResult = glRenderMode (GL_RENDER);
|
|
||||||
if (aResult < 0)
|
|
||||||
{
|
|
||||||
aBufferSize *= 2;
|
|
||||||
|
|
||||||
void* aPtr = aBuffer;
|
|
||||||
Standard::Free (aPtr);
|
|
||||||
aBuffer = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "FeedBack result= " << aResult << "\n";
|
|
||||||
GLint aPntNb = 0;
|
|
||||||
GLint aTriNb = 0;
|
|
||||||
GLint aQuadsNb = 0;
|
|
||||||
GLint aPolyNb = 0;
|
|
||||||
GLint aNodesNb = 0;
|
|
||||||
GLint aLinesNb = 0;
|
|
||||||
GLint aBitmapsNb = 0;
|
|
||||||
GLint aPassThrNb = 0;
|
|
||||||
GLint aUnknownNb = 0;
|
|
||||||
const GLint NODE_VALUES = 2; // GL_2D
|
|
||||||
for (GLint anIter = 0; anIter < aResult;)
|
|
||||||
{
|
|
||||||
const GLfloat aPos = aBuffer[anIter];
|
|
||||||
switch ((GLint )aPos)
|
|
||||||
{
|
|
||||||
case GL_POINT_TOKEN:
|
|
||||||
{
|
|
||||||
++aPntNb;
|
|
||||||
++aNodesNb;
|
|
||||||
anIter += 1 + NODE_VALUES;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GL_LINE_RESET_TOKEN:
|
|
||||||
case GL_LINE_TOKEN:
|
|
||||||
{
|
|
||||||
++aLinesNb;
|
|
||||||
aNodesNb += 2;
|
|
||||||
anIter += 1 + 2 * NODE_VALUES;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GL_POLYGON_TOKEN:
|
|
||||||
{
|
|
||||||
const GLint aCount = (GLint )aBuffer[++anIter];
|
|
||||||
aNodesNb += aCount;
|
|
||||||
anIter += aCount * NODE_VALUES + 1;
|
|
||||||
if (aCount == 3)
|
|
||||||
{
|
|
||||||
++aTriNb;
|
|
||||||
}
|
|
||||||
else if (aCount == 4)
|
|
||||||
{
|
|
||||||
++aQuadsNb;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++aPolyNb;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GL_BITMAP_TOKEN:
|
|
||||||
case GL_DRAW_PIXEL_TOKEN:
|
|
||||||
case GL_COPY_PIXEL_TOKEN:
|
|
||||||
{
|
|
||||||
++aBitmapsNb;
|
|
||||||
anIter += 1 + NODE_VALUES;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GL_PASS_THROUGH_TOKEN:
|
|
||||||
{
|
|
||||||
++aPassThrNb;
|
|
||||||
anIter += 2; // header + value
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
++anIter;
|
|
||||||
++aUnknownNb;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void* aPtr = aBuffer;
|
|
||||||
Standard::Free (aPtr);
|
|
||||||
|
|
||||||
// return statistics
|
|
||||||
theDI << "Total nodes: " << aNodesNb << "\n"
|
|
||||||
<< "Points: " << aPntNb << "\n"
|
|
||||||
<< "Line segments: " << aLinesNb << "\n"
|
|
||||||
<< "Triangles: " << aTriNb << "\n"
|
|
||||||
<< "Quads: " << aQuadsNb << "\n"
|
|
||||||
<< "Polygons: " << aPolyNb << "\n"
|
|
||||||
<< "Bitmap tokens: " << aBitmapsNb << "\n"
|
|
||||||
<< "Pass through: " << aPassThrNb << "\n"
|
|
||||||
<< "UNKNOWN: " << aUnknownNb << "\n";
|
|
||||||
|
|
||||||
double aLen2D = double(aNodesNb * 2 + aPntNb + aLinesNb * 2 + (aTriNb + aQuadsNb + aPolyNb) * 2 + aBitmapsNb + aPassThrNb);
|
|
||||||
double aLen3D = double(aNodesNb * 3 + aPntNb + aLinesNb * 2 + (aTriNb + aQuadsNb + aPolyNb) * 2 + aBitmapsNb + aPassThrNb);
|
|
||||||
double aLen3D_rgba = double(aNodesNb * 7 + aPntNb + aLinesNb * 2 + (aTriNb + aQuadsNb + aPolyNb) * 2 + aBitmapsNb + aPassThrNb);
|
|
||||||
theDI << "Buffer size GL_2D: " << aLen2D * double(sizeof(GLfloat)) / double(1024 * 1024) << " MiB\n"
|
|
||||||
<< "Buffer size GL_3D: " << aLen3D * double(sizeof(GLfloat)) / double(1024 * 1024) << " MiB\n"
|
|
||||||
<< "Buffer size GL_3D_COLOR: " << aLen3D_rgba * double(sizeof(GLfloat)) / double(1024 * 1024) << " MiB\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void )theDI;
|
|
||||||
std::cout << "Command is unsupported on current platform.\n";
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : VImmediateFront
|
//function : VImmediateFront
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1517,9 +1359,6 @@ void ViewerTest::OpenGlCommands(Draw_Interpretor& theCommands)
|
|||||||
theCommands.Add("vuserdraw",
|
theCommands.Add("vuserdraw",
|
||||||
"vuserdraw : name - simulates drawing with help of UserDraw",
|
"vuserdraw : name - simulates drawing with help of UserDraw",
|
||||||
__FILE__, VUserDraw, aGroup);
|
__FILE__, VUserDraw, aGroup);
|
||||||
theCommands.Add("vfeedback",
|
|
||||||
"vfeedback : perform test GL feedback rendering",
|
|
||||||
__FILE__, VFeedback, aGroup);
|
|
||||||
theCommands.Add("vimmediatefront",
|
theCommands.Add("vimmediatefront",
|
||||||
"vimmediatefront : render immediate mode to front buffer or to back buffer",
|
"vimmediatefront : render immediate mode to front buffer or to back buffer",
|
||||||
__FILE__, VImmediateFront, aGroup);
|
__FILE__, VImmediateFront, aGroup);
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
puts "============"
|
|
||||||
puts "OCC23227"
|
|
||||||
puts "New Draw Harness command to estimate current geometry complexity of OpenGL scene"
|
|
||||||
puts "============"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
set BugNumber OCC23227
|
|
||||||
|
|
||||||
box b 1 2 3
|
|
||||||
vinit View1
|
|
||||||
vclear
|
|
||||||
vaxo
|
|
||||||
vdisplay b
|
|
||||||
vsetdispmode 1
|
|
||||||
vfit
|
|
||||||
set vfeedback1 [vfeedback]
|
|
||||||
vdump $imagedir/${casename}_box.png
|
|
||||||
|
|
||||||
vclear
|
|
||||||
set vfeedback2 [vfeedback]
|
|
||||||
|
|
||||||
set llength_vfeedback1 [llength ${vfeedback1}]
|
|
||||||
set llength_vfeedback2 [llength ${vfeedback2}]
|
|
||||||
set IndexTriangles1 [lsearch ${vfeedback1} Triangles:]
|
|
||||||
set IndexTriangles2 [lsearch ${vfeedback2} Triangles:]
|
|
||||||
|
|
||||||
if { ${llength_vfeedback1} < 36 || ${llength_vfeedback2} < 36 || ${IndexTriangles1} < 0 || ${IndexTriangles2} < 0 } {
|
|
||||||
puts "Bad format of vfeedback command"
|
|
||||||
puts "Faulty ${BugNumber}"
|
|
||||||
} else {
|
|
||||||
set Triangles1 [lindex ${vfeedback1} ${IndexTriangles1}+1]
|
|
||||||
set Triangles2 [lindex ${vfeedback2} ${IndexTriangles1}+1]
|
|
||||||
if { ${Triangles1} != 0 && ${Triangles2} == 0 } {
|
|
||||||
puts "OK ${BugNumber}"
|
|
||||||
} else {
|
|
||||||
puts "Faulty ${BugNumber}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
|
Loading…
x
Reference in New Issue
Block a user