Creating 3d Ring in Android/Openegl with index buffer Objects

149 views Asked by At

enter image description here

Right now im Creating an 3D game for android/OpenGL the sence is to fly through such 3D Rings made with index Buffer Objects as shown in the pictures.

My Problem: Actually my twisted Loop is generating the Coordinates like it should but if i translate it got squezzed, because this is causing in this case the Y Coordinate not to match to the z Coordinate.
I tried around a few days finding a way to compensate this issue but succesless, anyone of you could say me a way creating a translateble 3D Ring in OpenGL/android with or even without my basics that would Help me very well.

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; 

Translation = 1

translation = 1

Translation = 0

translation = 0

0

There are 0 answers