Skip to content

Commit bdb8335

Browse files
committed
Merge branch 'dev'
2 parents 8eed3eb + 8612e35 commit bdb8335

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+941
-2772
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## 7.78.0
11+
1012
### Added
1113
- This changelog.
1214
- Open source button to README.md.
@@ -18,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1820
- Bumped Jogamp to 2.6.0.
1921
### Deprecated
2022
### Removed
23+
- use of OpenGL and all hardware accelerated graphics
2124
### Fixed
2225
- English label for "Acceleration" in plotter settings tab.
2326
- Calculation for meters of timing belt needed on each side of Makelangelo 5 and HUGE.

pom.xml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.marginallyclever</groupId>
88
<artifactId>Makelangelo</artifactId>
9-
<version>7.77.0</version>
9+
<version>7.78.0</version>
1010
<name>Makelangelo</name>
1111
<description>Makelangelo Software is a Java program that prepares art for CNC plotters. It is especially designed for the Makelangelo Robot.
1212
It pairs really well with Marlin-polargraph, the code in the brain of the robot that receives instructions and moves the motors.</description>
@@ -69,11 +69,6 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
6969
</pluginRepositories>
7070

7171
<repositories>
72-
<repository>
73-
<id>jogamp</id>
74-
<name>JogAmp Repository</name>
75-
<url>https://jogamp.org/deployment/maven/</url>
76-
</repository>
7772
<repository>
7873
<id>maven_central</id>
7974
<name>Maven Central</name>
@@ -369,20 +364,6 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
369364
<artifactId>jssc</artifactId>
370365
<version>2.9.5</version>
371366
</dependency>
372-
<!-- opengl graphics -->
373-
<!-- https://mvnrepository.com/artifact/org.jogamp.gluegen/gluegen-rt-main -->
374-
<dependency>
375-
<groupId>org.jogamp.gluegen</groupId>
376-
<artifactId>gluegen-rt-main</artifactId>
377-
<version>2.6.0</version>
378-
</dependency>
379-
<!-- https://mvnrepository.com/artifact/org.jogamp.jogl/jogl-all-main -->
380-
<dependency>
381-
<groupId>org.jogamp.jogl</groupId>
382-
<artifactId>jogl-all-main</artifactId>
383-
<version>2.6.0</version>
384-
</dependency>
385-
386367
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
387368
<dependency>
388369
<groupId>org.apache.httpcomponents</groupId>
@@ -509,7 +490,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
509490
<dependency>
510491
<groupId>io.github.classgraph</groupId>
511492
<artifactId>classgraph</artifactId>
512-
<version>4.8.171</version>
493+
<version>4.8.184</version>
513494
</dependency>
514495
<dependency>
515496
<groupId>org.reflections</groupId>

src/main/java/com/marginallyclever/communications/tcp/TCPConnection.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package com.marginallyclever.communications.tcp;
22

3+
import com.marginallyclever.communications.NetworkSession;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
6+
37
import java.io.IOException;
48
import java.net.InetSocketAddress;
5-
import java.net.URL;
9+
import java.net.URI;
610
import java.nio.ByteBuffer;
711
import java.nio.channels.SocketChannel;
812

9-
import com.marginallyclever.communications.NetworkSession;
10-
import org.slf4j.Logger;
11-
import org.slf4j.LoggerFactory;
12-
1313

1414
/**
1515
* Encapsulate all TCP/IP receive/transmit implementation
@@ -62,7 +62,8 @@ public void openConnection(String ipAddress) throws Exception {
6262
ipAddress = ipAddress.substring(7);
6363
}
6464

65-
URL a = new URL("http://"+ipAddress);
65+
// validate the address
66+
var a = new URI("http://"+ipAddress);
6667
String host = a.getHost();
6768
int port = a.getPort();
6869
if(port==-1) port = DEFAULT_TCP_PORT;

src/main/java/com/marginallyclever/convenience/ConvexHull.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.marginallyclever.convenience;
22

3-
import com.jogamp.opengl.GL3;
4-
import com.marginallyclever.makelangelo.Mesh;
53
import org.slf4j.Logger;
64
import org.slf4j.LoggerFactory;
75

@@ -18,7 +16,6 @@
1816
public class ConvexHull {
1917
private static final Logger logger = LoggerFactory.getLogger(ConvexHull.class);
2018
private final ArrayList<Vector2d> points = new ArrayList<>();
21-
private final Mesh mesh = new Mesh();
2219

2320
public ConvexHull() {}
2421

@@ -41,7 +38,6 @@ else if(!contains(p)) {
4138

4239
public void clear() {
4340
points.clear();
44-
mesh.clear();
4541
}
4642

4743
public Rectangle2D getBounds() {
@@ -176,20 +172,6 @@ private Vector2d orthogonalXY(Vector2d d) {
176172
return new Vector2d(d.y,-d.x);
177173
}
178174

179-
public void renderAsFan(GL3 gl2) {
180-
throw new RuntimeException("Not implemented");
181-
//gl2.glBegin(GL3.GL_TRIANGLE_FAN);
182-
//for( Vector2d p : points) gl2.glVertex2d(p.x,p.y);
183-
//gl2.glEnd();
184-
}
185-
186-
public void renderAsLineLoop(GL3 gl2) {
187-
throw new RuntimeException("Not implemented");
188-
//gl2.glBegin(GL3.GL_LINE_LOOP);
189-
//for( Vector2d p : points) gl2.glVertex2d(p.x,p.y);
190-
//gl2.glEnd();
191-
}
192-
193175
@Override
194176
public String toString() {
195177
return "ConvexHull{" +

src/main/java/com/marginallyclever/convenience/QuadGraph.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.marginallyclever.convenience;
22

3-
import com.jogamp.opengl.GL3;
4-
53
import javax.vecmath.Point2d;
4+
import java.awt.*;
65
import java.awt.geom.Rectangle2D;
76
import java.util.ArrayList;
87
import java.util.List;
@@ -105,14 +104,13 @@ public Point2d search(Point2d p) {
105104
return bestFound;
106105
}
107106

108-
public void render(GL3 gl2) {
107+
public void render(Graphics2D g2d) {
109108
if (children != null) {
110109
for (int i = 0; i < 4; ++i) {
111-
children[i].render(gl2);
110+
children[i].render(g2d);
112111
}
113112
} else {/*
114113
gl2.glColor3f(1, 0, 1);
115-
gl2.glLineWidth(1);
116114
gl2.glBegin(GL3.GL_LINE_LOOP);
117115
gl2.glVertex2d(bounds.getMinX(), bounds.getMinY());
118116
gl2.glVertex2d(bounds.getMinX(), bounds.getMaxY());
Lines changed: 40 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,46 @@
11
package com.marginallyclever.convenience.helpers;
22

3-
import com.jogamp.opengl.GL3;
4-
import com.marginallyclever.makelangelo.Mesh;
5-
import com.marginallyclever.makelangelo.preview.ShaderProgram;
63
import com.marginallyclever.makelangelo.texture.TextureWithMetadata;
74
import org.slf4j.Logger;
85
import org.slf4j.LoggerFactory;
96

107
import java.awt.*;
8+
import java.awt.image.BufferedImage;
119

1210
public class DrawingHelper {
1311
private static final Logger logger = LoggerFactory.getLogger(DrawingHelper.class);
1412

1513
/**
1614
* Draw a circle
17-
* @param gl2 the render context
15+
* @param graphics the render context
1816
* @param x x center coordinate
1917
* @param y y center coordinate
2018
* @param radius radius
2119
*/
22-
public static void drawCircle(GL3 gl2, float x, float y, float radius, Color color) {
23-
Mesh mesh = new Mesh();
24-
mesh.setRenderStyle(GL3.GL_LINE_LOOP);
25-
for (float f = 0; f < 2.0 * Math.PI; f += 0.3f) {
26-
mesh.addColor(
27-
color.getRed()/255f,
28-
color.getGreen()/255f,
29-
color.getBlue()/255f,
30-
color.getAlpha()/255f);
31-
mesh.addVertex(
32-
(float)(x + Math.cos(f) * radius),
33-
(float)(y + Math.sin(f) * radius),
34-
0);
35-
}
36-
mesh.render(gl2);
20+
public static void drawCircle(Graphics graphics, float x, float y, float radius, Color color) {
21+
Graphics2D g2d = (Graphics2D) graphics;
22+
g2d.setColor(color);
23+
g2d.drawOval((int)(x - radius), (int)(y - radius), (int)(radius * 2), (int)(radius * 2));
3724
}
3825

3926
/**
4027
* Draw an arc
41-
* @param gl the render context
28+
* @param graphics the render context
4229
* @param x x center coordinate
4330
* @param y y center coordinate
4431
* @param radius radius
4532
* @param a1 start angle
4633
* @param a2 end angle
4734
*/
48-
public static void drawArc(GL3 gl, float x, float y, float radius, float a1, float a2) {
49-
Mesh mesh = new Mesh();
50-
mesh.setRenderStyle(GL3.GL_LINE_STRIP);
35+
public static void drawArc(Graphics graphics, float x, float y, float radius, float a1, float a2) {
36+
Graphics2D g2d = (Graphics2D) graphics;
37+
g2d.drawArc(
38+
(int)(x - radius),
39+
(int)(y - radius),
40+
(int)(radius * 2),
41+
(int)(radius * 2),
42+
(int)Math.toDegrees(a1),
43+
(int)Math.toDegrees(a2 - a1));/*
5144
int steps = 10;
5245
float delta = (a2 - a1) / (float) steps;
5346
float f = a1;
@@ -58,54 +51,47 @@ public static void drawArc(GL3 gl, float x, float y, float radius, float a1, flo
5851
0);
5952
f += delta;
6053
}
61-
mesh.render(gl);
54+
mesh.render(graphics);*/
6255
}
6356

6457
/**
6558
* Draw a rectangle
66-
* @param gl the render context
59+
* @param graphics the render context
6760
* @param top top coordinate
6861
* @param right right coordinate
6962
* @param bottom bottom coordinate
7063
* @param left left coordinate
7164
*/
72-
public static void drawRectangle(GL3 gl, double top, double right, double bottom, double left, Color color) {
73-
Mesh mesh = new Mesh();
74-
mesh.setRenderStyle(GL3.GL_QUADS);
75-
mesh.addVertex((float)left, (float)top,0);
76-
mesh.addVertex((float)right, (float)top,0);
77-
mesh.addVertex((float)right, (float)bottom,0);
78-
mesh.addVertex((float)left, (float)bottom,0);
79-
80-
for(int i=0;i<4;++i) {
81-
mesh.addColor(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f);
82-
}
83-
84-
mesh.render(gl);
65+
public static void drawRectangle(Graphics graphics, double top, double right, double bottom, double left, Color color) {
66+
Graphics2D g2d = (Graphics2D) graphics;
67+
g2d.setColor(color);
68+
g2d.fillRect(
69+
(int)left,
70+
(int)top,
71+
(int)Math.abs(right - left),
72+
(int)Math.abs(bottom - top));
8573
}
8674

8775
/**
8876
* Paint a quad with the given texture
89-
* @param shader the render context
77+
* @param graphics the render context
9078
* @param x x center coordinate
9179
* @param y y center coordinate
9280
* @param width with of the texture
9381
* @param height height of the texture
9482
*/
95-
public static void paintTexture(ShaderProgram shader, GL3 gl, TextureWithMetadata texture, double x, double y, double width, double height) {
96-
texture.bind(gl);
97-
gl.glEnable(GL3.GL_TEXTURE_2D);
98-
shader.set1i(gl,"useTexture", 1);
99-
100-
Mesh mesh = new Mesh();
101-
mesh.setRenderStyle(GL3.GL_QUADS);
102-
mesh.addColor(1, 1, 1, 1); mesh.addTexCoord(0, 0); mesh.addVertex((float)(x ), (float)(y ), 0);
103-
mesh.addColor(1, 1, 1, 1); mesh.addTexCoord(1, 0); mesh.addVertex((float)(x + width), (float)(y ), 0);
104-
mesh.addColor(1, 1, 1, 1); mesh.addTexCoord(1, 1); mesh.addVertex((float)(x + width), (float)(y + height), 0);
105-
mesh.addColor(1, 1, 1, 1); mesh.addTexCoord(0, 1); mesh.addVertex((float)(x ), (float)(y + height), 0);
106-
mesh.render(gl);
107-
108-
gl.glDisable(GL3.GL_TEXTURE_2D);
109-
shader.set1i(gl,"useTexture", 0);
83+
public static void paintTexture(Graphics graphics, TextureWithMetadata texture, double x, double y, double width, double height) {
84+
Graphics2D g2d = (Graphics2D) graphics;
85+
BufferedImage img = texture.getTexture();
86+
g2d.drawImage(img,
87+
(int)x,
88+
(int)(y+height),
89+
(int)(x+width),
90+
(int)(y),
91+
0,
92+
0,
93+
img.getWidth(),
94+
img.getHeight(),
95+
null);
11096
}
11197
}

src/main/java/com/marginallyclever/convenience/helpers/OpenGLHelper.java

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)