如何在delphi中将数组转换为PGLint(即:^整数)?

时间:2017-09-12 14:37:12

标签: delphi

我在delphi中声明了这个openGL函数:

public class TimestampSerializer extends JsonSerializer<Timestamp> {

    private DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

    @Override
    public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
        // get the timestmap in the default timezone
        ZonedDateTime z = DateTimeUtils.toInstant(value).atZone(ZoneId.systemDefault());
        String str = fmt.format(z);

        gen.writeString(str);
    }
}

public class TimestampDeserializer extends JsonDeserializer<Timestamp> {

    private DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

    @Override
    public Timestamp deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        // parse to a LocalDateTime
        LocalDateTime dt = LocalDateTime.parse(jsonParser.getText(), fmt);
        // the date/time is in the default timezone
        return DateTimeUtils.toSqlTimestamp(dt.atZone(ZoneId.systemDefault()).toInstant());
    }
}

在我在网上找到的样本中,这个函数必须像这样调用:

PGLint = ^GLint;
GLint = Integer;
glTexParameteriv(target, pname: GLenum; params: PGLint);

但是我不知道如何在delphi中翻译crop_rect?特别是如何将它传递给glTexParameteriv?

1 个答案:

答案 0 :(得分:1)

像这样:

var
  crop_rect: array [0..3] of GLint ;
....
crop_rect[0] := x;
crop_rect[1] := y;
crop_rect[2] := width;
crop_rect[3] := height;
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, @crop_rect[0]);