本文整理汇总了Java中com.jogamp.opengl.GL2.glLightfv方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glLightfv方法的具体用法?Java GL2.glLightfv怎么用?Java GL2.glLightfv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glLightfv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* its recommended to use <br>
* <tt>GLM3.loadLight(...);</tt>
* @param gl GLContext for binding
*/
public void bind(GL2 gl){
gl.glLightfv(light_nr, GL2.GL_AMBIENT, ambient, 0);
gl.glLightfv(light_nr, GL2.GL_DIFFUSE, diffuse, 0);
gl.glLightfv(light_nr, GL2.GL_SPECULAR, specular, 0);
gl.glLightfv(light_nr, GL2.GL_POSITION, position, 0);
gl.glLightfv(light_nr, GL2.GL_SPOT_DIRECTION, direction, 0);
gl.glLightfv(light_nr, GL2.GL_SPOT_EXPONENT, spot_exponent, 0);
gl.glLightfv(light_nr, GL2.GL_SPOT_CUTOFF, spot_cut_off, 0);
gl.glLightfv(light_nr, attenuation_type, attenuation, 0);
gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, light_model_ambient,0);
gl.glLightModelfv(GL2.GL_LIGHT_MODEL_TWO_SIDE, light_model_two_side,0);
}
示例2: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable)
{
GL2 gl = drawable.getGL().getGL2();
gl.glPointSize(5.0f);
gl.glLineWidth(1.0f);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-1, 1, -1, 1, 0.01, 1000);
//gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glEnable(GL2.GL_DEPTH_TEST);
gl.glDepthFunc(GL2.GL_LEQUAL);
// Enable smooth shading.
gl.glShadeModel(GL2.GL_SMOOTH);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
// Define "clear" color.
gl.glClearColor(0f, 0f, 0f, 0f);
// We want a nice perspective.
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);
float[] pos = {1,-1,1,0};
float[] diff = {1,1,1,1};
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, diff, 0);
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
gl.glEnable(GL2.GL_LIGHT0);
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_COLOR_MATERIAL);
if(Shoot.DEBUG)
drawable.getAnimator().setUpdateFPSFrames(25, System.out);
}