PIGLIT_GL_TEST_CONFIG_END

void
piglit_init(int argc, char **argv)
{
	bool pass = true;
	double test_data[4] = { 0.1, 0.2, 0.3, 0.4 };
	double result_data[4];
	float epsilon = .00001;

	piglit_require_extension("GL_ARB_vertex_program");

	glProgramEnvParameter4dARB(GL_VERTEX_PROGRAM_ARB, 0,
				   test_data[0],
				   test_data[1],
				   test_data[2],
				   test_data[3]);

	/* Produce a GL error to trick Mesa's
	 * glGetProgramEnvParameterdvARB code.
	 */
	glDepthFunc(0xd0d0d0d0);

	glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB, 0, result_data);

	if (fabs(test_data[0] - result_data[0]) > epsilon ||
	    fabs(test_data[1] - result_data[1]) > epsilon ||
	    fabs(test_data[2] - result_data[2]) > epsilon ||
	    fabs(test_data[3] - result_data[3]) > epsilon) {
		fprintf(stderr, "glProgramEnvParamter4dvARB failed:\n");
		fprintf(stderr, "Expected: (%f %f %f %f)\n",
			test_data[0],
			test_data[1],
			test_data[2],
			test_data[3]);
		fprintf(stderr, "Expected: (%f %f %f %f)\n",
			result_data[0],
			result_data[1],
			result_data[2],
			result_data[3]);

		pass = false;
	}

	/* Clear our error. */
	(void)glGetError();

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBProgram_nglProgramEnvParameter4dARB(JNIEnv *env, jclass clazz, jint target, jint index, jdouble x, jdouble y, jdouble z, jdouble w, jlong function_pointer) {
	glProgramEnvParameter4dARBPROC glProgramEnvParameter4dARB = (glProgramEnvParameter4dARBPROC)((intptr_t)function_pointer);
	glProgramEnvParameter4dARB(target, index, x, y, z, w);
}
/////////////////////////////////////////////////////////
// Render
//
void GEMglProgramEnvParameter4dARB :: render(GemState *state) {
	glProgramEnvParameter4dARB (target, index, m_x, m_y, m_z, m_w);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBVertexProgram_glProgramEnvParameter4dARB(JNIEnv *__env, jclass clazz, jint target, jint index, jdouble x, jdouble y, jdouble z, jdouble w) {
    glProgramEnvParameter4dARBPROC glProgramEnvParameter4dARB = (glProgramEnvParameter4dARBPROC)tlsGetFunction(1380);
    UNUSED_PARAM(clazz)
    glProgramEnvParameter4dARB(target, index, x, y, z, w);
}