sci-mathematics/mathmod: add 12.1

It includes two patches from upstream for lto and render.

Due to the fix for rendering, media-libs/libglvnd is required as a run-dep.

Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/42719
Closes: https://github.com/gentoo/gentoo/pull/42719
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2025-06-24 08:44:03 +02:00
committed by Sam James
parent bb7378b391
commit 2e5e864309
4 changed files with 239 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST mathmod-12.0.tar.gz 9392067 BLAKE2B 2144c4aa06c3c13bdb5dca333134195d92bea5dcf0478e80f2ca25b41e4c74344725cced3bc72fc4b4f571da5b3ec734b0ea05fc7b1f80566f8b83d229e5627f SHA512 d8a247a14e03c4d6fb4812b4404338162d7ff79745ebe31c467a444fdb48441b950a9d39c7b31fedb3f2bb1961d3075e44eb264b863708bd48f949b8185d60c6
DIST mathmod-12.1.tar.gz 9475468 BLAKE2B 9aeb27578d4c17cc2d8414f95ddcd55910458fe49208c0cb0277439a3d5628f517d79644bdd8c7e1ec747482e14898cdcb2896f57ec02a3af3bc033ac28f6034 SHA512 2e7ed6e2d345ffc16d275ccebc41352b4fd21f0c085ff25ae35fda7329b103371ccfe7bff6b12d8df3ebb145deaaf8f2ddcaedf3190a5542d1db002e2adc7566

View File

@@ -0,0 +1,166 @@
From upstream. Fix render with >qt-6.6
https://github.com/parisolab/mathmod/issues/280
From f5d35f45acc6aa042c486ca60eaa5461c1e56b13 Mon Sep 17 00:00:00 2001
From: Abderrahman Taha <taha_ab@yahoo.fr>
Date: Mon, 23 Jun 2025 23:35:29 -0400
Subject: [PATCH] #280 QT6: render
---
ui_modules/mathmod.cpp | 78 +++++++++++++++++++++++++++++++++++-------
1 file changed, 65 insertions(+), 13 deletions(-)
diff --git a/ui_modules/mathmod.cpp b/ui_modules/mathmod.cpp
index 9dac14f..f40cb56 100644
--- a/ui_modules/mathmod.cpp
+++ b/ui_modules/mathmod.cpp
@@ -20,6 +20,44 @@
#include "mathmod.h"
+#ifndef GLERROR_H
+#define GLERROR_H
+
+void _check_gl_error(const char *file, int line);
+
+///
+/// Usage
+/// [... some opengl calls]
+/// glCheckError();
+///
+#define check_gl_error() _check_gl_error(__FILE__,__LINE__)
+
+#endif // GLERROR_H
+
+using namespace std;
+
+void _check_gl_error(const char *file, int line) {
+ GLenum err (glGetError());
+
+ while(err!=GL_NO_ERROR) {
+ string error;
+
+ switch(err) {
+ case GL_INVALID_OPERATION: error="INVALID_OPERATION"; break;
+ case GL_INVALID_ENUM: error="INVALID_ENUM"; break;
+ case GL_INVALID_VALUE: error="INVALID_VALUE"; break;
+ case GL_OUT_OF_MEMORY: error="OUT_OF_MEMORY"; break;
+ case GL_INVALID_FRAMEBUFFER_OPERATION: error="INVALID_FRAMEBUFFER_OPERATION"; break;
+ default: error="UNKNOWN_ERROR"; break;
+ }
+
+ cerr << "GL_" << error.c_str() <<" - "<<file<<":"<<line<<endl;
+ err=glGetError();
+ }
+}
+
+
+
void MathMod::CalculateTexturePoints(int type)
{
double tmp, val[6]={0,0,0,0,0,0};
@@ -1239,7 +1277,6 @@ void MathMod::CreateShaderProgram()
msgBox.adjustSize();
msgBox.exec();
}
-
glAttachShader(shaderprogramId, vertexshader);
glAttachShader(shaderprogramId, fragmentshader);
glBindAttribLocation(shaderprogramId, 0, "in_Position");
@@ -1452,6 +1489,16 @@ void MathMod::Winitialize_GL()
PutObjectInsideCube();
PutObjectInsideCubeOk=true;
}
+ // check OpenGL error
+ GLenum myGLEnum;
+ while ((myGLEnum = glGetError()) != GL_NO_ERROR) {
+ qDebug("Error_10 : ");
+ /*QMessageBox msgBox;
+ qDebug("Error_10: ");
+ msgBox.setText("Error_10 : " + QString::number(myGLEnum));
+ msgBox.adjustSize();
+ msgBox.exec();*/
+ }
}
void MathMod::UpdateGL()
@@ -1604,11 +1651,11 @@ void MathMod::CopyData(ObjectProperties *scene)
glGenBuffers(2, vbo);
/* Bind our first VBO as being the active buffer and storing vertex attributes (coordinates) */
glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
- glBufferData(GL_ARRAY_BUFFER, sizeof(float)*10*(scene->VertxNumber+(12+60+36)),scene->ArrayNorVer_localPt, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(GL_FLOAT)*10*(scene->VertxNumber+(12+60+36)),scene->ArrayNorVer_localPt, GL_STATIC_DRAW);
+ //glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
/* Bind our first VBO as being the active buffer and storing vertex attributes (coordinates) */
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo[1]);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(uint)*(scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize), scene->PolyIndices_localPt, GL_STATIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(GLuint)*(scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize), scene->PolyIndices_localPt, GL_STATIC_DRAW);
size_t cOffset = 0;
size_t nOffset = cOffset + 4*sizeof( GL_FLOAT);
size_t vOffset = nOffset + 3*sizeof (GL_FLOAT);
@@ -1618,31 +1665,35 @@ void MathMod::CopyData(ObjectProperties *scene)
glEnableVertexAttribArray(attribVertexPosition);
// set attrib arrays using glVertexAttribPointer()
glVertexAttribPointer(attribVertexPosition, 3, GL_FLOAT, false, 10*sizeof( GL_FLOAT), (void*)vOffset);
- glVertexAttribPointer(attribVertexNormal, 3, GL_FLOAT, false, 10*sizeof( GL_FLOAT), (void*)nOffset);
glVertexAttribPointer(attribVertexColor,4, GL_FLOAT, false, 10*sizeof( GL_FLOAT), (void*)cOffset);
+ glVertexAttribPointer(attribVertexNormal, 3, GL_FLOAT, false, 10*sizeof( GL_FLOAT), (void*)nOffset);
previousVertxNumber = scene->VertxNumber;
previousPolyNumberNbPolygnNbVertexPtMin = (scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize);
firstaction++;
}
- else{
- if(scene->VertxNumber>previousVertxNumber)
+ else
+ {
+ glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo[1]);
+ if(scene->VertxNumber>previousVertxNumber>0)
{
- glBufferData(GL_ARRAY_BUFFER, sizeof(float)*10*(scene->VertxNumber+(12+60+36)), scene->ArrayNorVer_localPt, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(GL_FLOAT)*10*(scene->VertxNumber+(12+60+36)), scene->ArrayNorVer_localPt, GL_STATIC_DRAW);
previousVertxNumber = scene->VertxNumber;
}
else
{
- glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(float)*10*(scene->VertxNumber+(12+60+36)), scene->ArrayNorVer_localPt);
+ glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GL_FLOAT)*10*(scene->VertxNumber+(12+60+36)), (void *)scene->ArrayNorVer_localPt);
previousVertxNumber = scene->VertxNumber;
}
+
if((scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize)>previousPolyNumberNbPolygnNbVertexPtMin)
{
- glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(uint)*(scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize), scene->PolyIndices_localPt, GL_STATIC_DRAW);
- previousPolyNumberNbPolygnNbVertexPtMin = (scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(GLuint)*(scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize), scene->PolyIndices_localPt, GL_STATIC_DRAW);
+ previousPolyNumberNbPolygnNbVertexPtMin = (scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize);
}
else
{
- glBufferSubData(GL_ELEMENT_ARRAY_BUFFER,0, sizeof(uint)*(scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize), scene->PolyIndices_localPt);
+ glBufferSubData(GL_ELEMENT_ARRAY_BUFFER,0, sizeof(GLuint)*(scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize), scene->PolyIndices_localPt);
previousPolyNumberNbPolygnNbVertexPtMin = (scene->PolyNumber + scene->NbPolygnNbVertexPtMinSize);
}
}
@@ -1652,11 +1703,13 @@ void MathMod::draw(ObjectProperties *scene)
{
if(!PutObjectInsideCubeOk)
return;
+
if (scene->componentsinfos.Interleave)
{
CopyData(scene);
scene->componentsinfos.Interleave = false;
}
+ glUseProgram(shaderprogramId);
// clear buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// set modelview matrix
@@ -1737,7 +1790,6 @@ void MathMod::draw(ObjectProperties *scene)
for (uint i = 0; i < scene->componentsinfos.NbComponentsType.size(); i++)
if (scene->componentsinfos.ThereisCND[i])
DrawParisoCND(scene, i);
-
// Draw Normales:
if (scene->norm == 1 && scene->componentsinfos.updateviewer)
DrawNormals(scene);

View File

@@ -0,0 +1,29 @@
From upstream, fix lto-type-mismatch
https://github.com/parisolab/mathmod/issues/279
From dac6f48effe334062f91f236906211e922178f50 Mon Sep 17 00:00:00 2001
From: Abderrahman Taha <taha_ab@yahoo.fr>
Date: Thu, 19 Jun 2025 12:27:03 -0400
Subject: [PATCH] =?UTF-8?q?#279=20ui=5Fmodules/comvar.h:21:12:=20warning:?=
=?UTF-8?q?=20type=20of=20=E2=80=98CalculFactor=E2=80=99=20does=20not=20ma?=
=?UTF-8?q?tch=20original=20declaration=20[-Wlto-type-mismatch]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ui_modules/parametersoptions.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui_modules/parametersoptions.cpp b/ui_modules/parametersoptions.cpp
index a2d4b125..298109eb 100644
--- a/ui_modules/parametersoptions.cpp
+++ b/ui_modules/parametersoptions.cpp
@@ -24,7 +24,7 @@
#include <sstream>
#include <string>
int Threads[3]={8,1,64};
-int CalculFactor[6]={4,4,4,8,8};
+int CalculFactor[5]={4,4,4,8,8};
int InitParGrid=50;
int InitIsoGrid=40;
static bool MACOS = false;

View File

@@ -0,0 +1,43 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop qmake-utils xdg
DESCRIPTION="Plot parametric and implicit surfaces"
HOMEPAGE="https://github.com/parisolab/mathmod
https://sourceforge.net/projects/mathmod/
https://www.facebook.com/parisolab"
SRC_URI="https://github.com/parisolab/mathmod/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RDEPEND="
dev-qt/qtbase:6[gui,opengl,widgets]
media-libs/libglvnd
"
DEPEND="${RDEPEND}"
PATCHES=(
# From upstream, to be removed with release 13.0
"${FILESDIR}"/${P}-type_mismatch.patch
"${FILESDIR}"/${P}-fix_render.patch
)
src_configure() {
eqmake6 MathMod.pro
}
src_install() {
dobin MathMod
insinto /usr/share/${P}
doins mathmodconfig.js mathmodcollection.js advancedmodels.js
local size
for size in 16 32 64; do
newicon -s ${size} images/icon/catenoid_mini_${size}x${size}.png catenoid.png
done
make_desktop_entry MathMod MathMod catenoid
}