Skip to content

Commit e43a8a7

Browse files
committed
Move text-renderer into GLG2D (adapted from sgothel/jogl#47)
1 parent 91cc4af commit e43a8a7

27 files changed

+10025
-7
lines changed

pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>net.opengrabeso</groupId>
55
<artifactId>glg2d</artifactId>
6-
<version>0.6.3</version>
6+
<version>0.7.1-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<name>GLG2D</name>
99
<description>OpenGL Text Renderer for JOGL and LWJGL</description>
@@ -67,12 +67,6 @@
6767
<artifactId>jogl-all-main</artifactId>
6868
<version>${jogl.version}</version>
6969
</dependency>
70-
<dependency>
71-
<groupId>net.opengrabeso</groupId>
72-
<artifactId>text-renderer</artifactId>
73-
<version>0.1.14-SNAPSHOT</version>
74-
75-
</dependency>
7670
<dependency>
7771
<groupId>junit</groupId>
7872
<artifactId>junit</artifactId>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package net.opengrabeso.opengl.util;
2+
3+
/**
4+
* Pixel attributes.
5+
*/
6+
public class GLPixelAttributes {
7+
/**
8+
* Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0.
9+
*/
10+
public static final GLPixelAttributes UNDEF = new GLPixelAttributes(0, 0);
11+
12+
/**
13+
* The OpenGL pixel data format
14+
*/
15+
public final int format;
16+
/**
17+
* The OpenGL pixel data type
18+
*/
19+
public final int type;
20+
21+
@Override
22+
public final int hashCode() {
23+
// 31 * x == (x << 5) - x
24+
int hash = format;
25+
return ((hash << 5) - hash) + type;
26+
}
27+
28+
@Override
29+
public final boolean equals(final Object obj) {
30+
if (this == obj) {
31+
return true;
32+
}
33+
if (obj instanceof GLPixelAttributes) {
34+
final GLPixelAttributes other = (GLPixelAttributes) obj;
35+
return format == other.format &&
36+
type == other.type;
37+
} else {
38+
return false;
39+
}
40+
}
41+
42+
/**
43+
* Create a new {@link GLPixelAttributes} instance based on GL format and type.
44+
*
45+
* @param dataFormat GL data format
46+
* @param dataType GL data type
47+
48+
*/
49+
public GLPixelAttributes(final int dataFormat, final int dataType) {
50+
this.format = dataFormat;
51+
this.type = dataType;
52+
}
53+
54+
@Override
55+
public String toString() {
56+
return "PixelAttributes[fmt 0x" + Integer.toHexString(format) + ", type 0x" + Integer.toHexString(type) + ", " + "]";
57+
}
58+
}

0 commit comments

Comments
 (0)