forked from brandonborkholder/glg2d
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move text-renderer into GLG2D (adapted from sgothel/jogl#47)
- Loading branch information
1 parent
91cc4af
commit e43a8a7
Showing
27 changed files
with
10,025 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/net/opengrabeso/opengl/util/GLPixelAttributes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) + ", " + "]"; | ||
} | ||
} |
Oops, something went wrong.