Skip to content

Commit

Permalink
Move text-renderer into GLG2D (adapted from sgothel/jogl#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSpanel committed Oct 6, 2020
1 parent 91cc4af commit e43a8a7
Show file tree
Hide file tree
Showing 27 changed files with 10,025 additions and 7 deletions.
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.opengrabeso</groupId>
<artifactId>glg2d</artifactId>
<version>0.6.3</version>
<version>0.7.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>GLG2D</name>
<description>OpenGL Text Renderer for JOGL and LWJGL</description>
Expand Down Expand Up @@ -67,12 +67,6 @@
<artifactId>jogl-all-main</artifactId>
<version>${jogl.version}</version>
</dependency>
<dependency>
<groupId>net.opengrabeso</groupId>
<artifactId>text-renderer</artifactId>
<version>0.1.14-SNAPSHOT</version>

</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
58 changes: 58 additions & 0 deletions src/main/java/net/opengrabeso/opengl/util/GLPixelAttributes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package net.opengrabeso.opengl.util;

/**
* Pixel attributes.
*/
public class GLPixelAttributes {
/**
* Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0.
*/
public static final GLPixelAttributes UNDEF = new GLPixelAttributes(0, 0);

/**
* The OpenGL pixel data format
*/
public final int format;
/**
* The OpenGL pixel data type
*/
public final int type;

@Override
public final int hashCode() {
// 31 * x == (x << 5) - x
int hash = format;
return ((hash << 5) - hash) + type;
}

@Override
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof GLPixelAttributes) {
final GLPixelAttributes other = (GLPixelAttributes) obj;
return format == other.format &&
type == other.type;
} else {
return false;
}
}

/**
* Create a new {@link GLPixelAttributes} instance based on GL format and type.
*
* @param dataFormat GL data format
* @param dataType GL data type
*/
public GLPixelAttributes(final int dataFormat, final int dataType) {
this.format = dataFormat;
this.type = dataType;
}

@Override
public String toString() {
return "PixelAttributes[fmt 0x" + Integer.toHexString(format) + ", type 0x" + Integer.toHexString(type) + ", " + "]";
}
}
Loading

0 comments on commit e43a8a7

Please sign in to comment.