By Sceada
on Wed, 06/20/2012 - 17:10
Hi,
I try to draw something with my own vertex and fragment shader.
The result is really annoying.
For example, if I put these values in my vertex-array
[CODE] float crossVertex[] = {
//Dreieck1
0.0, 0.0, 0.0,
-25.0, 50.0, 0.0,
25.0, 50.0, 0.0,
//Dreieck2
0.0, 0.0, 0.0,
50.0, 25.0, 0.0,
50.0, -25.0, 0.0,
//Dreieck3
0.0, 0.0, 0.0,
25.0, -50.0, 0.0,
-25.0, -50.0, 0.0,
//Dreieck4
0.0, 0.0, 0.0,
-50.0, -25.0, 0.0,
-50.0, 25.0, 0.0,
glVertexAttribPointer(maPositionHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &crossVertex[0]);
[/CODE]
nothing happens
When I use another "size"-value inside of glVertexAttribPointer
[QUOTE]glVertexAttribPointer(maPositionHandle, 2, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &crossVertex[0]);[/QUOTE]
something really strange is plotted on the z-and y-axis.
When I write my vertices in a different order (change the last with the first value) my object is correctly drawn along the z an y axis. My reference for the axis is this image *[url]https://ar.qualcomm.at/resources/images/coordinateSystems.jpg*[/url].
I have realy no problem to rotate my object, but i don't understand why this happen?
[QUOTE]QCAR::Matrix44F modelViewProjection;
modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());
//Farbiges Kreuz
SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
&modelViewMatrix.data[0] ,
&modelViewProjection.data[0]);
glUseProgram(customProgramID);
glVertexAttribPointer(maPositionHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &crossVertex[0]);
glVertexAttribPointer(maColorHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &crossColor[0]);
glEnableVertexAttribArray(maPositionHandle);
glEnableVertexAttribArray(maColorHandle);
glUniformMatrix4fv(muMVPMatrixHandle, 1, GL_FALSE,
(GLfloat*)&modelViewProjection.data[0] );
glDrawElements(GL_TRIANGLES, crossNumVerts, GL_UNSIGNED_SHORT,
(const GLvoid*) &crossIndices[0]);[/QUOTE]
greetz Robert
P.S.: Maybe someone has some good sides for OpenGL ES 2.0
Re: Custom Renderer
Re: Custom Renderer
Re: Custom Renderer
Re: Custom Renderer
Re: Custom Renderer