Hello,
I am trying to convert 3d coordinates into 2d in renderframe method using following code.
if (vbCounter>0) { // Render frame around button glUseProgram(vbShaderProgramID); glVertexAttribPointer(vbVertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &vbVertices[0]); glEnableVertexAttribArray(vbVertexHandle); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); // We multiply by 8 because that's the number of vertices per button // The reason is that GL_LINES considers only pairs. So some vertices // must be repeated. glDrawArrays(GL_LINES, 0, target->getNumVirtualButtons()*8); SampleUtils::checkGlError("VirtualButtons drawButton"); glDisableVertexAttribArray(vbVertexHandle); ///////////////////////////////Light Rectangle ///////////////////////////////////////////////////// glGetDoublev(GL_MODELVIEW_MATRIX, ModelViewMat); glGetDoublev(GL_PROJECTION_MATRIX, ProjMat); glGetIntegerv(GL_VIEWPORT, Viewport); gluProject(-97.68f, -28.f, 0.f, modelViewMatrix.data,projectionMatrix.data,Viewport,& blY_Lite,& blX_Lite,&winZ); gluProject(-15.93.f, -28.f, 0.f, modelViewMatrix.data,projectionMatrix.data,Viewport,& brY_Lite,& brX_Lite,&winZ); gluProject(-97.68f, -50.52.f, 0.f, modelViewMatrix.data,projectionMatrix.data,Viewport,& tlY_Lite,& tlX_Lite,&winZ); gluProject(-15.93f, -50.52f, 0.f, modelViewMatrix.data,projectionMatrix.data,Viewport,& trY_Lite,& trX_Lite,&winZ);}
Now NDK does not build and give errors that it does not recognize GL_VIEWPORT, GL_PROJECTION_MATRIX and GL_MODELVIEW_MATRIX constants. Does anybody knows solution to it? It says opengl es2/gl2 at top. Does anybody knows how to get these constants.
GLUProject get 2d from 3d coordinates
Hi,
when using OpenGL ES 2.0, you cannot use the following lines:
GLUProject get 2d from 3d coordinates
One more note:
you can also find a very nice solution to what you are trying to achieve in this thread:
GLUProject get 2d from 3d coordinates
i `ve updated code using open GL 1 enabled option in android.mk file and following is in the .cpp file
GLUProject get 2d from 3d coordinates
The link you posted i.e. https://ar.qualcomm.at/content/error-projecting-point-screen shows a method that takes camerapoint and returns screen point. How I will fetch camerapoint using opengl es 2 or 1
GLUProject get 2d from 3d coordinates
Hi, concerning your question on "unimplemented API" in you opengl code, I see an inconsistency in the code that starts with:
GLUProject get 2d from 3d coordinates
Hi, concerning your second question about how to get the cameraPoint (referred to the link https://ar.qualcomm.at/content/error-projecting-point-screen ):
GLUProject get 2d from 3d coordinates
How Can We get These points
QCAR::Vec3F(150.0f, 120.0f, 0.0f))
GLUProject get 2d from 3d coordinates
The point I've used is just an example ;
for instance in your case you will the points that appear in the code you copy-pasted in this post originally:
GLUProject get 2d from 3d coordinates
Than You So Much It Worked
as my Requirment
GLUProject get 2d from 3d coordinates
Sounds great!