2004-01-20 15:24:36 +01:00
|
|
|
package org.lwjgl.opengl.glu;
|
|
|
|
|
|
|
|
|
|
import java.nio.ByteBuffer;
|
2004-01-21 17:17:15 +01:00
|
|
|
import java.nio.FloatBuffer;
|
|
|
|
|
import java.nio.IntBuffer;
|
2004-01-20 15:24:36 +01:00
|
|
|
|
2004-01-21 11:06:47 +01:00
|
|
|
import org.lwjgl.opengl.GL11;
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GLU.java
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Created 23-dec-2003
|
|
|
|
|
* @author Erik Duijs
|
|
|
|
|
*/
|
2004-01-21 17:17:15 +01:00
|
|
|
public class GLU implements GLUConstants {
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluLookAt
|
|
|
|
|
* @param eyex
|
|
|
|
|
* @param eyey
|
|
|
|
|
* @param eyez
|
|
|
|
|
* @param centerx
|
|
|
|
|
* @param centery
|
|
|
|
|
* @param centerz
|
|
|
|
|
* @param upx
|
|
|
|
|
* @param upy
|
|
|
|
|
* @param upz
|
|
|
|
|
*/
|
|
|
|
|
public static void gluLookAt(
|
2004-01-21 17:17:15 +01:00
|
|
|
float eyex,
|
|
|
|
|
float eyey,
|
|
|
|
|
float eyez,
|
|
|
|
|
float centerx,
|
|
|
|
|
float centery,
|
|
|
|
|
float centerz,
|
|
|
|
|
float upx,
|
|
|
|
|
float upy,
|
|
|
|
|
float upz) {
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
Project.gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluOrtho2D
|
|
|
|
|
* @param left
|
|
|
|
|
* @param right
|
|
|
|
|
* @param bottom
|
|
|
|
|
* @param top
|
|
|
|
|
*/
|
|
|
|
|
public static void gluOrtho2D(
|
2004-01-21 17:17:15 +01:00
|
|
|
float left,
|
|
|
|
|
float right,
|
|
|
|
|
float bottom,
|
|
|
|
|
float top) {
|
2004-01-20 15:24:36 +01:00
|
|
|
|
2004-01-21 11:06:47 +01:00
|
|
|
GL11.glOrtho(left, right, bottom, top, -1.0, 1.0);
|
2004-01-20 15:24:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluPerspective
|
|
|
|
|
* @param fovy
|
|
|
|
|
* @param aspect
|
|
|
|
|
* @param zNear
|
|
|
|
|
* @param zFar
|
|
|
|
|
*/
|
|
|
|
|
public static void gluPerspective(
|
2004-01-21 17:17:15 +01:00
|
|
|
float fovy,
|
|
|
|
|
float aspect,
|
|
|
|
|
float zNear,
|
|
|
|
|
float zFar) {
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
Project.gluPerspective(fovy, aspect, zNear, zFar);
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-21 17:17:15 +01:00
|
|
|
/**
|
|
|
|
|
* Method gluProject
|
|
|
|
|
* @param objx
|
|
|
|
|
* @param objy
|
|
|
|
|
* @param objz
|
|
|
|
|
* @param modelMatrix
|
|
|
|
|
* @param projMatrix
|
|
|
|
|
* @param viewport
|
|
|
|
|
* @param winx
|
|
|
|
|
* @param winy
|
|
|
|
|
* @param winz
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static boolean gluProject(float objx, float objy, float objz,
|
|
|
|
|
FloatBuffer modelMatrix,
|
|
|
|
|
FloatBuffer projMatrix,
|
|
|
|
|
IntBuffer viewport,
|
|
|
|
|
FloatBuffer winx, FloatBuffer winy, FloatBuffer winz)
|
|
|
|
|
{
|
|
|
|
|
return Project.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluUnproject
|
|
|
|
|
* @param winx
|
|
|
|
|
* @param winy
|
|
|
|
|
* @param winz
|
|
|
|
|
* @param modelMatrix
|
|
|
|
|
* @param projMatrix
|
|
|
|
|
* @param viewport
|
2004-02-07 12:43:17 +01:00
|
|
|
* @param obj_pos
|
2004-01-21 17:17:15 +01:00
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static boolean gluUnProject(float winx, float winy, float winz,
|
|
|
|
|
FloatBuffer modelMatrix,
|
|
|
|
|
FloatBuffer projMatrix,
|
|
|
|
|
IntBuffer viewport,
|
2004-02-05 17:53:30 +01:00
|
|
|
FloatBuffer obj_pos)
|
2004-01-21 17:17:15 +01:00
|
|
|
{
|
2004-02-05 17:53:30 +01:00
|
|
|
return Project.gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, obj_pos);
|
2004-01-21 17:17:15 +01:00
|
|
|
}
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluPickMatrix
|
|
|
|
|
* @param x
|
|
|
|
|
* @param y
|
|
|
|
|
* @param width
|
|
|
|
|
* @param height
|
|
|
|
|
* @param viewport
|
|
|
|
|
*/
|
|
|
|
|
public static void gluPickMatrix(
|
2004-01-21 17:17:15 +01:00
|
|
|
float x,
|
|
|
|
|
float y,
|
|
|
|
|
float width,
|
|
|
|
|
float height,
|
2004-02-05 17:53:30 +01:00
|
|
|
IntBuffer viewport) {
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
Project.gluPickMatrix(x, y, width, height, viewport);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluGetString.
|
|
|
|
|
* @param name
|
|
|
|
|
* @return String
|
|
|
|
|
*/
|
|
|
|
|
public static String gluGetString(int name) {
|
|
|
|
|
return Registry.gluGetString(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluCheckExtension.
|
|
|
|
|
* @param string
|
|
|
|
|
* @param string1
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public static boolean gluCheckExtension(String extName, String extString) {
|
|
|
|
|
return Registry.gluCheckExtension(extName, extString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluBuild2DMipmaps
|
|
|
|
|
* @param target
|
|
|
|
|
* @param components
|
|
|
|
|
* @param width
|
|
|
|
|
* @param height
|
|
|
|
|
* @param format
|
|
|
|
|
* @param type
|
|
|
|
|
* @param data
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public static int gluBuild2DMipmaps(
|
2004-01-21 17:17:15 +01:00
|
|
|
int target,
|
|
|
|
|
int components,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
int format,
|
|
|
|
|
int type,
|
|
|
|
|
ByteBuffer data) {
|
|
|
|
|
|
2004-01-20 15:24:36 +01:00
|
|
|
return MipMap.gluBuild2DMipmaps(target, components, width, height, format, type, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method gluScaleImage.
|
|
|
|
|
* @param format
|
|
|
|
|
* @param width
|
|
|
|
|
* @param height
|
|
|
|
|
* @param type
|
|
|
|
|
* @param data
|
|
|
|
|
* @param w
|
|
|
|
|
* @param h
|
|
|
|
|
* @param type1
|
|
|
|
|
* @param image
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public static int gluScaleImage(
|
2004-01-21 17:17:15 +01:00
|
|
|
int format,
|
|
|
|
|
int widthIn,
|
|
|
|
|
int heightIn,
|
|
|
|
|
int typeIn,
|
|
|
|
|
ByteBuffer dataIn,
|
|
|
|
|
int widthOut,
|
|
|
|
|
int heightOut,
|
|
|
|
|
int typeOut,
|
|
|
|
|
ByteBuffer dataOut) {
|
2004-01-20 15:24:36 +01:00
|
|
|
|
|
|
|
|
return MipMap.gluScaleImage(format, widthIn, heightIn, typeIn, dataIn, widthOut, heightOut, typeOut, dataOut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|