Ah sorry for long response time. Anyway, I went back to the problem and started using GLSurfaceView instead and it works with the current setup. With the GLSurfaceView, where am I supposed to implement onTouchListener? Since if I make the "starting" activity to implement the onTouchListener, it never gets called on touch evens.
Any tips what/where it should be implemented? Cheerio for all the tips. On 9 marras, 17:51, Robert Green <[email protected]> wrote: > Ah, I didn't realize how you were initializing GL. I'm bad at the EGL > config stuff which is why I just use GLSurfaceView. I'm wondering if > your problem is there? Consider trying GLSurfaceView and let me know > the results. Otherwise, you may want to debug your init to make sure > that it's correctly initializing a GL context and surface on the > device. > > On Nov 9, 6:35 am, Mika <[email protected]> wrote: > > > > > Hi Robert, > > > Will do. Here goes. > > First part is the "sizeChange()" when Android screen size changes and > > it gets called when the application launches. I'd thought I'd paste in > > the EGL stuff too, not all of it but some of it since it kind of > > relates to the initialisation. But yeah, the problem still is there. > > Itworksfineon emulators but not on the actual device. > > > All the code from below in PasteBin again for easier reading > > (http://pastebin.com/m484eafe6). > > > //OPENGLINITIALISATION > > _screenWidth = w; > > _screenHeight = h; > > > gl.glViewport(0, 0, _screenWidth, _screenHeight); > > gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, > > GL10.GL_FASTEST); > > > gl.glClearColor(0, 0, 1, 1); > > > gl.glClear(GL10.GL_COLOR_BUFFER_BIT); > > gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); > > > gl.glMatrixMode(GL10.GL_PROJECTION); // setupOpenGLworld > > coordinates to match screen coordinates > > GLU.gluOrtho2D(gl, 0, (float)_screenWidth, (float)_screenHeight, 0); > > // trying to match world coordinates to screen coordinates (tried > > using (int) too.. no changes :/) > > > // BEFORE RENDERING: > > gl.glClear(GL10.GL_COLOR_BUFFER_BIT); > > gl.glMatrixMode(GL10.GL_MODELVIEW); > > gl.glLoadIdentity(); > > > // EGL HELPER CLASS THAT TAKES CARE OF GETTING THE CONTEXT FOROPENGL > > AND ALL THAT SHAZAM > > private EGL10 _EGL; > > private EGLDisplay _display; > > private EGLSurface _surface; > > private EGLConfig _configs; > > private EGLContext _context; > > > // EGL INIT > > int[] configSpec = { EGL10.EGL_DEPTH_SIZE, 0, > > EGL10.EGL_NONE }; > > _EGL = (EGL10) EGLContext.getEGL(); > > _display = _EGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); > > > int[] version = new int[2]; > > _EGL.eglInitialize(_display, version); > > EGLConfig[] configs = new EGLConfig[1]; > > > int[] num_config = new int[1]; > > _EGL.eglChooseConfig(_display, configSpec, configs, 1, > > num_config); > > > _configs = configs[0]; > > _context = _EGL.eglCreateContext(_display, _configs, > > EGL10.EGL_NO_CONTEXT, null); > > > _surface = null; > > > But yeah, if anyone knows what's going on or knows what I'm doing > > wrong I'd be mighty grateful. I feel pretty lost with this one. > > > Cheers again guys. > > > On 9 marras, 00:14, Robert Green <[email protected]> wrote: > > > > I had a problem with Ortho on my phone vs on theemulatorat one point > > > as well. Could you post more of your GL initialization code? My > > > problem was something dumb like I was calling orthox using actual > > > screen dimensions when I needed to either use fixed point there or use > > > orthof. > > > > On Nov 8, 3:34 pm, Mika <[email protected]> wrote: > > > > > Hello everyone. Running into REALLY interesting problems withOpenGL > > > >ES. Basically when I start my program in 1.5 or 1.6emulator, itworks > > > > justfinebut on HTC Hero 1.5 it does not. The problem is that the > > > > vertices are not being rendered but the gl.glClear() command is > > > > working justfine. I followed in with the debugger and it does go into > > > > the rendering function and such but still not rendering the > > > > vertices... > > > > > Here is the code in PasteBin (easier to > > > > read:http://pastebin.com/m706686e6 > > > > ) > > > > > And here is the same thing pasted here: > > > > // VERTICE INIT > > > > int one = 65536; > > > > int half = one / 2; > > > > int vertices[] = { > > > > -half, -half, half, half, -half, half, > > > > -half, half, half, half, half, half } > > > > > ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); > > > > vbb.order(ByteOrder.nativeOrder()); > > > > mVertexBuffer = vbb.asIntBuffer(); > > > > mVertexBuffer.put(vertices); > > > > mVertexBuffer.position(0); > > > > > // AND IN RENDER > > > > gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer); > > > > gl.glColor4f(1, 0, 0, 1); > > > > gl.glScalef(50, 50, 1); > > > > gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); > > > > > Also I got my projection set in 2D ortho projection to match screen > > > > coordinates so that's why scale to 50,50 to actually make a bit > > > > bigger. I've tried using glDrawElements and glDrawArrays and nothing > > > > on the actual phone butworksperfectlyfineon the actualemulator. > > > > Any ideas where I might be going wrong? Why is the actual phone not > > > > rendering the vertices like theemulatoris? Am I missing something > > > > completely here? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

