1

在此处输入图像描述

现在我正在为 android/OpenGL 创建一个 3D 游戏,感觉是飞过用索引缓冲区对象制作的这种 3D 环,如图所示。

我的问题:实际上我的扭曲循环正在生成它应该的坐标,但是如果我翻译它就会被挤压,因为在这种情况下这会导致 Y 坐标与 z 坐标不匹配。
我尝试了几天来寻找一种方法来弥补这个问题但没有成功,你们中的任何人都可以说我在 OpenGL/android 中创建一个可翻译的 3D 环的方法,无论有没有我的基础知识都会很好地帮助我。

for (int y = 0; y < 32; y++) {
    for (int x = 0; x < 32; x++) {

        final float xPosR =  0.5f * (float) Math.cos((x) * move) ; //move = 2*Pi/31 : In this part the x coordinates are getting builded (after rotating they are actually the z coordinates)
        final float yPosR =  translationY + (float) Math.sin((y) * move) //translation = 1[enter image description here][1]/0 otherwise you could do it as translation with the modelmatrix
                            + 0.5f * (float) Math.cos((x) * move) * (float) Math.cos((y) * move) ; //In this part the Y Coordinates are getting builded
        final float zPosR =   - (1f * (float) Math.cos((y) * move)) +
                            0.5f * (float) Math.cos((x) * move) * (float) Math.sin((y) * move); //In this part the z Coordinates are getting builded(after rotating they are actually the z coordinates)

        //in the onDrawFrame Method it gets rotate 90 degree around the y-axis and translated -5 in the z-axis
        heightMapVertexDataR[offsetR++] = xPosR;
        heightMapVertexDataR[offsetR++] = yPosR;
        heightMapVertexDataR[offsetR++] = zPosR; 

翻译 = 1

翻译 = 1

翻译 = 0

翻译 = 0

4

0 回答 0