mirror of https://github.com/CGAL/cgal
Pass to OpenGL_ES_2
This commit is contained in:
parent
2d9000efde
commit
301416c151
|
|
@ -494,14 +494,7 @@ void Camera::computeModelViewMatrix() const {
|
|||
CGAL_INLINE_FUNCTION
|
||||
void Camera::loadProjectionMatrix(bool reset) const {
|
||||
// WARNING: makeCurrent must be called by every calling method
|
||||
gl()->glMatrixMode(GL_PROJECTION);
|
||||
|
||||
if (reset)
|
||||
gl()->glLoadIdentity();
|
||||
|
||||
computeProjectionMatrix();
|
||||
|
||||
gl()->glMultMatrixd(projectionMatrix_);
|
||||
}
|
||||
|
||||
/*! Loads the OpenGL \c GL_MODELVIEW matrix with the modelView matrix
|
||||
|
|
@ -536,12 +529,7 @@ void Camera::loadProjectionMatrix(bool reset) const {
|
|||
CGAL_INLINE_FUNCTION
|
||||
void Camera::loadModelViewMatrix(bool reset) const {
|
||||
// WARNING: makeCurrent must be called by every calling method
|
||||
gl()->glMatrixMode(GL_MODELVIEW);
|
||||
computeModelViewMatrix();
|
||||
if (reset)
|
||||
gl()->glLoadMatrixd(modelViewMatrix_);
|
||||
else
|
||||
gl()->glMultMatrixd(modelViewMatrix_);
|
||||
}
|
||||
|
||||
/*! Same as loadProjectionMatrix() but for a stereo setup.
|
||||
|
|
@ -575,9 +563,6 @@ void Camera::loadProjectionMatrixStereo(bool leftBuffer) const {
|
|||
qreal left, right, bottom, top;
|
||||
qreal screenHalfWidth, halfWidth, side, shift, delta;
|
||||
|
||||
gl()->glMatrixMode(GL_PROJECTION);
|
||||
gl()->glLoadIdentity();
|
||||
|
||||
switch (type()) {
|
||||
case Camera::PERSPECTIVE:
|
||||
// compute half width of screen,
|
||||
|
|
@ -629,7 +614,6 @@ void Camera::loadProjectionMatrixStereo(bool leftBuffer) const {
|
|||
CGAL_INLINE_FUNCTION
|
||||
void Camera::loadModelViewMatrixStereo(bool leftBuffer) const {
|
||||
// WARNING: makeCurrent must be called by every calling method
|
||||
gl()->glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
qreal halfWidth = focusDistance() * tan(horizontalFieldOfView() / 2.0);
|
||||
qreal shift =
|
||||
|
|
@ -641,7 +625,6 @@ void Camera::loadModelViewMatrixStereo(bool leftBuffer) const {
|
|||
modelViewMatrix_[12] -= shift;
|
||||
else
|
||||
modelViewMatrix_[12] += shift;
|
||||
gl()->glLoadMatrixd(modelViewMatrix_);
|
||||
}
|
||||
|
||||
/*! Fills \p m with the Camera projection matrix values.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <CGAL/Qt/manipulatedCameraFrame.h>
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
|
|
@ -75,7 +75,7 @@ href="../examples/callback.html">callback example</a> for a complete
|
|||
implementation.
|
||||
|
||||
\nosubgrouping */
|
||||
class CGAL_QT_EXPORT QGLViewer : public QOpenGLWidget, public QOpenGLFunctions_2_1 {
|
||||
class CGAL_QT_EXPORT QGLViewer : public QOpenGLWidget, public QOpenGLFunctions {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ If a 4.3 context could not be set, a 2.1 context will be used instead.
|
|||
*/
|
||||
CGAL_INLINE_FUNCTION
|
||||
void CGAL::QGLViewer::initializeGL() {
|
||||
QSurfaceFormat format;
|
||||
/*QSurfaceFormat format;
|
||||
format.setDepthBufferSize(24);
|
||||
format.setStencilBufferSize(8);
|
||||
format.setVersion(4,3);
|
||||
|
|
@ -229,9 +229,10 @@ void CGAL::QGLViewer::initializeGL() {
|
|||
else
|
||||
{
|
||||
is_ogl_4_3 = true;
|
||||
}
|
||||
}*/
|
||||
is_ogl_4_3 = false;
|
||||
makeCurrent();
|
||||
QOpenGLFunctions_2_1::initializeOpenGLFunctions();
|
||||
QOpenGLFunctions::initializeOpenGLFunctions();
|
||||
// Default colors
|
||||
setForegroundColor(QColor(180, 180, 180));
|
||||
setBackgroundColor(QColor(51, 51, 51));
|
||||
|
|
|
|||
|
|
@ -490,13 +490,9 @@ void Scene::renderScene(const QList<Scene_interface::Item_id> &items,
|
|||
if( group || item.renderingMode() == Flat || item.renderingMode() == FlatPlusEdges || item.renderingMode() == Gouraud)
|
||||
{
|
||||
if(with_names) {
|
||||
viewer->glClearDepth(1.0);
|
||||
viewer->glClearDepthf(1.0);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
if(item.renderingMode() == Gouraud)
|
||||
viewer->glShadeModel(GL_SMOOTH);
|
||||
else
|
||||
viewer->glShadeModel(GL_FLAT);
|
||||
item.draw(viewer);
|
||||
}
|
||||
|
||||
|
|
@ -543,14 +539,14 @@ void Scene::renderWireScene(const QList<Scene_interface::Item_id> &items,
|
|||
|| item.renderingMode() == PointsPlusNormals)
|
||||
{
|
||||
viewer->glDisable(GL_LIGHTING);
|
||||
viewer->glPointSize(2.f);
|
||||
//viewer->glPointSize(2.f);
|
||||
viewer->glLineWidth(1.0f);
|
||||
item.drawEdges(viewer);
|
||||
}
|
||||
else{
|
||||
if( item.renderingMode() == PointsPlusNormals ){
|
||||
viewer->glDisable(GL_LIGHTING);
|
||||
viewer->glPointSize(2.f);
|
||||
//viewer->glPointSize(2.f);
|
||||
viewer->glLineWidth(1.0f);
|
||||
if(index == selected_item || selected_items_list.contains(index))
|
||||
{
|
||||
|
|
@ -596,7 +592,7 @@ void Scene::renderPointScene(const QList<Scene_interface::Item_id> &items,
|
|||
if(group ||item.visible())
|
||||
{
|
||||
if(item.renderingMode() == Points && with_names) {
|
||||
viewer->glClearDepth(1.0);
|
||||
viewer->glClearDepthf(1.0);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
|
@ -605,7 +601,7 @@ void Scene::renderPointScene(const QList<Scene_interface::Item_id> &items,
|
|||
(item.renderingMode() == ShadedPoints))
|
||||
{
|
||||
viewer->glDisable(GL_LIGHTING);
|
||||
viewer->glPointSize(3.0f);
|
||||
//viewer->glPointSize(3.0f);
|
||||
viewer->glLineWidth(1.0f);
|
||||
item.drawPoints(viewer);
|
||||
}
|
||||
|
|
@ -673,7 +669,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
|||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
viewer->glClearDepth(1);
|
||||
viewer->glClearDepthf(1);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
//renderScene(children, viewer, picked_item_IDs, false, 0,false, NULL);
|
||||
renderScene(opaque_items, viewer, picked_item_IDs, false, 0,false, NULL);
|
||||
|
|
@ -689,7 +685,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
|||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
viewer->glClearDepth(1);
|
||||
viewer->glClearDepthf(1);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// renderScene(children, viewer, picked_item_IDs, false, 0,true, NULL);
|
||||
renderScene(opaque_items, viewer, picked_item_IDs, false, 0,true, NULL);
|
||||
|
|
@ -709,7 +705,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
|||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
viewer->glClearDepth(1);
|
||||
viewer->glClearDepthf(1);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
renderWireScene(children, viewer, picked_item_IDs, false);
|
||||
renderPointScene(children, viewer, picked_item_IDs, false);
|
||||
|
|
@ -728,7 +724,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
|||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
viewer->glClearDepth(1);
|
||||
viewer->glClearDepthf(1);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
//renderScene(children, viewer, picked_item_IDs, false, i, true, depth_test[i-1]);
|
||||
renderScene(opaque_items , viewer, picked_item_IDs, false, i, true, depth_test[i-1]);
|
||||
|
|
@ -748,7 +744,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
|||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
viewer->glClearDepth(1);
|
||||
viewer->glClearDepthf(1);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// renderScene(children, viewer, picked_item_IDs, false, (int)viewer->total_pass()-1, false, depth_test[(int)viewer->total_pass()-2]);
|
||||
renderScene(opaque_items , viewer, picked_item_IDs, false, (int)viewer->total_pass()-1, false, depth_test[(int)viewer->total_pass()-2]);
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ void Scene_group_item::renderChildren(Viewer_interface *viewer,
|
|||
|
||||
Q_FOREACH(Scene_interface::Item_id id, children){
|
||||
if(with_names) {
|
||||
viewer->glClearDepth(1.0);
|
||||
viewer->glClearDepthf(1.0f);
|
||||
viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
if(id == scene->mainSelectionIndex()|| scene->selectionIndices().contains(id))
|
||||
|
|
|
|||
|
|
@ -461,17 +461,9 @@ void Viewer_impl::draw_aux(bool with_names, Viewer* viewer)
|
|||
return;
|
||||
current_total_pass = viewer->inFastDrawing() ? total_pass/2 : total_pass;
|
||||
viewer->glLineWidth(1.0f);
|
||||
viewer->glPointSize(2.f);
|
||||
//viewer->glPointSize(2.f);
|
||||
viewer->glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
viewer->glPolygonOffset(1.0f,1.0f);
|
||||
viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
|
||||
viewer->glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
||||
|
||||
if(twosides)
|
||||
viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
||||
else
|
||||
viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
|
||||
|
||||
if(!with_names && antialiasing)
|
||||
{
|
||||
|
|
@ -493,7 +485,6 @@ void Viewer_impl::draw_aux(bool with_names, Viewer* viewer)
|
|||
else
|
||||
scene->draw(viewer);
|
||||
viewer->glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
}
|
||||
|
||||
bool Viewer::inDrawWithNames() const {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
set_point_size(ps);
|
||||
}
|
||||
void set_point_size(GLfloat v) {
|
||||
viewer->glPointSize(v);
|
||||
//viewer->glPointSize(v);
|
||||
}
|
||||
}; // end class Point_size
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue