사용자 정의 투영 행렬을 사용하여 처리 할 때 투영 매핑과 관련된 프로젝트를 구현하려고합니다. 나에게 실마리를 줄 수있는 예를 발견했지만 너무 오래되었고 OpenGL과 Processing이 많이 바뀌었다. 저는 셰이더와 OpenGL에 익숙하지 않지만 지금까지는 이전 코드를 아래에 표시된 버전으로 업데이트 할 수 있으므로 원본과 비교할 수도 있습니다.처리 중 GLException을 디버깅하는 방법?
나는 여전히 무엇입니까 :
GLException :하지 않는 GL2 구현
내가 조금 PGL, GL, 동시에 PG2를 사용하여 혼동도입니다. 나는 이것이 좋은 습관이 아니라고 느낀다.
가공 1.0 포럼 코드의 원본 버전은 here입니다.
import com.jogamp.opengl.*;
import java.nio.FloatBuffer;
float[] modelview = {
0.670984f, 0.250691f, 0.674993f, 0, -0.288247f,
0.966749f, -0.137371f, 0f, -0.68315f, -0.0505059f, 0.720934f, 0f,
0.164808f, 2.1425f, 32.9616f, 1f };
float[] proj = {
0.78125f, 0, 0, 0, 0, 1.04167f, 0, 0, 0, 0, -1.0002f, -1, 0,
0, -2.0002f, 0 };
FloatBuffer mvbuf;
FloatBuffer projbuf;
void setup() {
size(1024, 768, P3D);
PJOGL.profile = 2; //not sure if needed
mvbuf = FloatBuffer.wrap(modelview);
projbuf= FloatBuffer.wrap(proj);
GLProfile glp = GLProfile.get(GLProfile.GL2);
GLCapabilitiesImmutable glcaps = (GLCapabilitiesImmutable) new GLCapabilities(glp);
GLCapabilities tGLCapabilities = new GLCapabilities(glp);
println("System Capabilities:" + glcaps.toString());
println("Profile Details: " + glp.toString());
println("Is GL2 Supported?: " + glp.isGL2());
}
void draw() {
background(0);
PGL pgl = (PJOGL) beginPGL();
GL gl = ((PJOGL) pgl).gl;
GL2 gl2 = gl.getGL2(); //GLException: not a GL2 implemantation
gl2.glMatrixMode(GL2.GL_PROJECTION);
gl2.glLoadIdentity();
gl2.glLoadMatrixf(projbuf);
gl2.glMatrixMode(GL2.GL_MODELVIEW);
gl2.glLoadIdentity();
gl2.glLoadMatrixf(mvbuf);
drawGrid(100, 10, gl2);
endPGL(); //not sure if this is closing what it supposed to
}
void drawGrid(float len, float offset, GL2 g) {
int nr_lines = (int)(len/offset);
g.glColor3f(1, 1, 1);
g.glBegin(g.GL_LINES);
for (int i=-nr_lines; i<nr_lines; i++) {
g.glVertex3f(i*offset, 0, -nr_lines*offset);
g.glVertex3f(i*offset, 0, nr_lines*offset);
}
for (int i=-nr_lines; i<nr_lines; i++) {
g.glVertex3f(-nr_lines*offset, 0, i*offset);
g.glVertex3f(nr_lines*offset, 0, i*offset);
}
g.glEnd();
}
OPENGL_VERSION에 대한 나의 출력이 '4.1 INTEL-10.14.66' 내가 1 PJOGL.profile를 설정하고 권장) (설정에 놓여있다이다 그리고 그것은 단지 효과가있었습니다! 나는 내 질문을 게시하기 전에 여기에 시간을 보낸다. 정말 고맙습니다! – Bontempos