herbalpax.blogg.se

Gluperspective opengl es 2.0
Gluperspective opengl es 2.0








gluperspective opengl es 2.0

The next points are short notes on what I putatively know about camera settings in the above code. Gl.glDisableClientState(GL10.GL_VERTEX_ARRAY) Gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3) Gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertex_buffer) Gl.glEnableClientState(GL10.GL_VERTEX_ARRAY) make triangle with vertices (-2,0,0), (2,0,0), and (0.5,0)įloat vertices = īyteBuffer buffer = ByteBuffer.allocateDirect(vertices.length * 4) įloatBuffer vertex_buffer = buffer.asFloatBuffer() Gl.glMatrixMode(GL10.GL_MODELVIEW) // Change MODELVIEW matrix GLU.gluPerspective(gl, 67, aspect_ratio, 1, 100) Gl.glMatrixMode(GL10.GL_PROJECTION) // Change PROJECTION matrixįloat aspect_ratio = (float) screen_width / screen_height Gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT) Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f) //set background to black Said activity implements GLSurfaceView.Renderer with the onDrawFrame marked with My code is: gl.glViewport(0, 0, screen_width, screen_height) I run the following code in the onDrawFrame-method of my activity. I think I understand what they do, however I cannot see the triangle I draw. I recently started programming OpenGL ES on an Android smartphone and ran into problems understanding how gluPerspective and gluLookAt are used. google this page can easily follow the exact problem and its solutions easily. The following text is a bit lenghty as I wanted to make sure that people with similar problems that e.g.










Gluperspective opengl es 2.0