Search Results

Search found 3627 results on 146 pages for 'opengl es 2 0'.

Page 1/146 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • OpenGL or OpenGL ES

    - by zxspectrum
    What should I learn? OpenGL 4.1 or OpenGL ES 2.0? I will be developing desktop applications using Qt but I may start developing mobile applications in a few months, too. I don't know anything about 3D, 3D math, etc and I'd rather spend 100 bucks in a good book than 1 week digging websites and going through trial and error. One problem I see with OpenGL 4.1 is as far as I know there is no book yet (the most recent ones are for OpenGL 3.3 or 4.0), while there are books on OpenGL ES 2.0. On the other hand, from my naive point of view, OpenGL 4.1 seems like OpenGL ES 2.0 + additions, so it looks like it would be easier/better to first learn OpenGL ES 2.0, then go for the shader language, etc Please, don't tell me to use NeHe (it's generally agreed it's full of bad/old practices), the Durian tutorial, etc. Thanks

    Read the article

  • Geometry instancing in OpenGL ES 2.0

    - by seahorse
    I am planning to do geometry instancing in OpenGL ES 2.0 Basically I plan to render the same geometry(a chair) maybe 1000 times in my scene. What is the best way to do this in OpenGL ES 2.0? I am considering passing model view mat4 as an attribute. Since attributes are per vertex data do I need to pass this same mat4, three times for each vertex of the same triangle(since modelview remains constant across vertices of the triangle). That would amount to a lot of extra data sent to the GPU( 2 extra vertices*16 floats*(Number of triangles) amount of extra data). Or should I be sending the mat4 only once per triangle?But how is that possible using attributes since attributes are defined as "per vertex" data? What is the best and efficient way to do instancing in OpenGL ES 2.0?

    Read the article

  • How can I bend an object in OpenGL?

    - by mindnoise
    Is there a way one could bend an object, like a cylinder or a plane using OpenGL? I'm an OpenGL beginner (I'm using OpenGL ES 2.0, if that matters, although I suspect, math matters most in this case, so it's somehow version independent), I understand the basics: translate, rotate, matrix transformations, etc. I was wondering if there is a technique which allows you to actually change the geometry of your objects (in this case by bending them)? Any links, tutorials or other references are welcomed!

    Read the article

  • 2D Rendering with OpenGL ES 2.0 on Android (matrices not working)

    - by TranquilMarmot
    So I'm trying to render two moving quads, each at different locations. My shaders are as simple as possible (vertices are only transformed by the modelview-projection matrix, there's only one color). Whenever I try and render something, I only end up with slivers of color! I've only done work with 3D rendering in OpenGL before so I'm having issues with 2D stuff. Here's my basic rendering loop, simplified a bit (I'm using the Matrix manipulation methods provided by android.opengl.Matrix and program is a custom class I created that just calls GLES20.glUniformMatrix4fv()): Matrix.orthoM(projection, 0, 0, windowWidth, 0, windowHeight, -1, 1); program.setUniformMatrix4f("Projection", projection); At this point, I render the quads (this is repeated for each quad): Matrix.setIdentityM(modelview, 0); Matrix.translateM(modelview, 0, quadX, quadY, 0); program.setUniformMatrix4f("ModelView", modelview); quad.render(); // calls glDrawArrays and all I see is a sliver of the color each quad is! I'm at my wits end here, I've tried everything I can think of and I'm at the point where I'm screaming at my computer and tossing phones across the room. Anybody got any pointers? Am I using ortho wrong? I'm 100% sure I'm rendering everything at a Z value of 0. I tried using frustumM instead of orthoM, which made it so that I could see the quads but they would get totally skewed whenever they got moved, which makes sense if I correctly understand the way frustum works (it's more for 3D rendering, anyway). If it makes any difference, I defined my viewport with GLES20.glViewport(0, 0, windowWidth, windowHeight); Where windowWidth and windowHeight are the same values that are pased to orthoM It might be worth noting that the android.opengl.Matrix methods take in an offset as the second parameter so that multiple matrices can be shoved into one array, so that'w what the first 0 is for For reference, here's my vertex shader code: uniform mat4 ModelView; uniform mat4 Projection; attribute vec4 vPosition; void main() { mat4 mvp = Projection * ModelView; gl_Position = vPosition * mvp; } I tried swapping Projection * ModelView with ModelView * Projection but now I just get some really funky looking shapes... EDIT Okay, I finally figured it out! (Note: Since I'm new here (longtime lurker!) I can't answer my own question for a few hours, so as soon as I can I'll move this into an actual answer to the question) I changed Matrix.orthoM(projection, 0, 0, windowWidth, 0, windowHeight, -1, 1); to float ratio = windowWwidth / windowHeight; Matrix.orthoM(projection, 0, 0, ratio, 0, 1, -1, 1); I then had to scale my projection matrix to make it a lot smaller with Matrix.scaleM(projection, 0, 0.05f, 0.05f, 1.0f);. I then added an offset to the modelview translations to simulate a camera so that I could center on my action (so Matrix.translateM(modelview, 0, quadX, quadY, 0); was changed to Matrix.translateM(modelview, 0, quadX + camX, quadY + camY, 0);) Thanks for the help, all!

    Read the article

  • OpenGL ES 2/3 vs OpenGL 3 (and 4)

    - by Martin Perry
    I have migrated my code from OpenGL ES 2/3 to OpenGL 3 (I added bunch of defines and abstract classes to encapsulate both versions, so I have both in one project and compile only one or another). All I need to change was context initialization and glClearDepth. I dont have any errors. This was kind of strange to me. Even shaders are working correctly (some of them are GL ES 3 - with #version 300 es in their header) Is this a kind of good solution, or should I rewrite something more, before I start adding another functionality like geometry shaders, performance tools etc ?

    Read the article

  • exporting bind and keyframe bone poses from blender to use in OpenGL

    - by SaldaVonSchwartz
    I'm having a hard time trying to understand how exactly Blender's concept of bone transforms maps to the usual math of skinning (which I'm implementing in an OpenGL-based engine of sorts). Or I'm missing out something in the math.. It's gonna be long, but here's as much background as I can think of. First, a few notes and assumptions: I'm using column-major order and multiply from right to left. So for instance, vertex v transformed by matrix A and then further transformed by matrix B would be: v' = BAv. This also means whenever I export a matrix from blender through python, I export it (in text format) in 4 lines, each representing a column. This is so I can then I can read them back into my engine like this: if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[0], &skeleton.joints[currentJointIndex].inverseBindTransform.m[1], &skeleton.joints[currentJointIndex].inverseBindTransform.m[2], &skeleton.joints[currentJointIndex].inverseBindTransform.m[3])) { if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[4], &skeleton.joints[currentJointIndex].inverseBindTransform.m[5], &skeleton.joints[currentJointIndex].inverseBindTransform.m[6], &skeleton.joints[currentJointIndex].inverseBindTransform.m[7])) { if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[8], &skeleton.joints[currentJointIndex].inverseBindTransform.m[9], &skeleton.joints[currentJointIndex].inverseBindTransform.m[10], &skeleton.joints[currentJointIndex].inverseBindTransform.m[11])) { if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[12], &skeleton.joints[currentJointIndex].inverseBindTransform.m[13], &skeleton.joints[currentJointIndex].inverseBindTransform.m[14], &skeleton.joints[currentJointIndex].inverseBindTransform.m[15])) { I'm simplifying the code I show because otherwise it would make things unnecessarily harder (in the context of my question) to explain / follow. Please refrain from making remarks related to optimizations. This is not final code. Having said that, if I understand correctly, the basic idea of skinning/animation is: I have a a mesh made up of vertices I have the mesh model-world transform W I have my joints, which are really just transforms from each joint's space to its parent's space. I'll call these transforms Bj meaning matrix which takes from joint j's bind pose to joint j-1's bind pose. For each of these, I actually import their inverse to the engine, Bj^-1. I have keyframes each containing a set of current poses Cj for each joint J. These are initially imported to my engine in TQS format but after (S)LERPING them I compose them into Cj matrices which are equivalent to the Bjs (not the Bj^-1 ones) only that for the current spacial configurations of each joint at that frame. Given the above, the "skeletal animation algorithm is" On each frame: check how much time has elpased and compute the resulting current time in the animation, from 0 meaning frame 0 to 1, meaning the end of the animation. (Oh and I'm looping forever so the time is mod(total duration)) for each joint: 1 -calculate its world inverse bind pose, that is Bj_w^-1 = Bj^-1 Bj-1^-1 ... B0^-1 2 -use the current animation time to LERP the componets of the TQS and come up with an interpolated current pose matrix Cj which should transform from the joints current configuration space to world space. Similar to what I did to get the world version of the inverse bind poses, I come up with the joint's world current pose, Cj_w = C0 C1 ... Cj 3 -now that I have world versions of Bj and Cj, I store this joint's world- skinning matrix K_wj = Cj_w Bj_w^-1. The above is roughly implemented like so: - (void)update:(NSTimeInterval)elapsedTime { static double time = 0; time = fmod((time + elapsedTime),1.); uint16_t LERPKeyframeNumber = 60 * time; uint16_t lkeyframeNumber = 0; uint16_t lkeyframeIndex = 0; uint16_t rkeyframeNumber = 0; uint16_t rkeyframeIndex = 0; for (int i = 0; i < aClip.keyframesCount; i++) { uint16_t keyframeNumber = aClip.keyframes[i].number; if (keyframeNumber <= LERPKeyframeNumber) { lkeyframeIndex = i; lkeyframeNumber = keyframeNumber; } else { rkeyframeIndex = i; rkeyframeNumber = keyframeNumber; break; } } double lTime = lkeyframeNumber / 60.; double rTime = rkeyframeNumber / 60.; double blendFactor = (time - lTime) / (rTime - lTime); GLKMatrix4 bindPosePalette[aSkeleton.jointsCount]; GLKMatrix4 currentPosePalette[aSkeleton.jointsCount]; for (int i = 0; i < aSkeleton.jointsCount; i++) { F3DETQSType& lPose = aClip.keyframes[lkeyframeIndex].skeletonPose.jointPoses[i]; F3DETQSType& rPose = aClip.keyframes[rkeyframeIndex].skeletonPose.jointPoses[i]; GLKVector3 LERPTranslation = GLKVector3Lerp(lPose.t, rPose.t, blendFactor); GLKQuaternion SLERPRotation = GLKQuaternionSlerp(lPose.q, rPose.q, blendFactor); GLKVector3 LERPScaling = GLKVector3Lerp(lPose.s, rPose.s, blendFactor); GLKMatrix4 currentTransform = GLKMatrix4MakeWithQuaternion(SLERPRotation); currentTransform = GLKMatrix4Multiply(currentTransform, GLKMatrix4MakeTranslation(LERPTranslation.x, LERPTranslation.y, LERPTranslation.z)); currentTransform = GLKMatrix4Multiply(currentTransform, GLKMatrix4MakeScale(LERPScaling.x, LERPScaling.y, LERPScaling.z)); if (aSkeleton.joints[i].parentIndex == -1) { bindPosePalette[i] = aSkeleton.joints[i].inverseBindTransform; currentPosePalette[i] = currentTransform; } else { bindPosePalette[i] = GLKMatrix4Multiply(aSkeleton.joints[i].inverseBindTransform, bindPosePalette[aSkeleton.joints[i].parentIndex]); currentPosePalette[i] = GLKMatrix4Multiply(currentPosePalette[aSkeleton.joints[i].parentIndex], currentTransform); } aSkeleton.skinningPalette[i] = GLKMatrix4Multiply(currentPosePalette[i], bindPosePalette[i]); } } At this point, I should have my skinning palette. So on each frame in my vertex shader, I do: uniform mat4 modelMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix; uniform mat4 skinningPalette[6]; attribute vec4 position; attribute vec3 normal; attribute vec2 tCoordinates; attribute vec4 jointsWeights; attribute vec4 jointsIndices; varying highp vec2 tCoordinatesVarying; varying highp float lIntensity; void main() { vec3 eyeNormal = normalize(normalMatrix * normal); vec3 lightPosition = vec3(0., 0., 2.); lIntensity = max(0.0, dot(eyeNormal, normalize(lightPosition))); tCoordinatesVarying = tCoordinates; vec4 skinnedVertexPosition = vec4(0.); for (int i = 0; i < 4; i++) { skinnedVertexPosition += jointsWeights[i] * skinningPalette[int(jointsIndices[i])] * position; } gl_Position = projectionMatrix * modelMatrix * skinnedVertexPosition; } The result: The mesh parts that are supposed to animate do animate and follow the expected motion, however, the rotations are messed up in terms of orientations. That is, the mesh is not translated somewhere else or scaled in any way, but the orientations of rotations seem to be off. So a few observations: In the above shader notice I actually did not multiply the vertices by the mesh modelMatrix (the one which would take them to model or world or global space, whichever you prefer, since there is no parent to the mesh itself other than "the world") until after skinning. This is contrary to what I implied in the theory: if my skinning matrix takes vertices from model to joint and back to model space, I'd think the vertices should already be premultiplied by the mesh transform. But if I do so, I just get a black screen. As far as exporting the joints from Blender, my python script exports for each armature bone in bind pose, it's matrix in this way: def DFSJointTraversal(file, skeleton, jointList): for joint in jointList: poseJoint = skeleton.pose.bones[joint.name] jointTransform = poseJoint.matrix.inverted() file.write('Joint ' + joint.name + ' Transform {\n') for col in jointTransform.col: file.write('{:9f} {:9f} {:9f} {:9f}\n'.format(col[0], col[1], col[2], col[3])) DFSJointTraversal(file, skeleton, joint.children) file.write('}\n') And for current / keyframe poses (assuming I'm in the right keyframe): def exportAnimations(filepath): # Only one skeleton per scene objList = [object for object in bpy.context.scene.objects if object.type == 'ARMATURE'] if len(objList) == 0: return elif len(objList) > 1: return #raise exception? dialog box? skeleton = objList[0] jointNames = [bone.name for bone in skeleton.data.bones] for action in bpy.data.actions: # One animation clip per action in Blender, named as the action animationClipFilePath = filepath[0 : filepath.rindex('/') + 1] + action.name + ".aClip" file = open(animationClipFilePath, 'w') file.write('target skeleton: ' + skeleton.name + '\n') file.write('joints count: {:d}'.format(len(jointNames)) + '\n') skeleton.animation_data.action = action keyframeNum = max([len(fcurve.keyframe_points) for fcurve in action.fcurves]) keyframes = [] for fcurve in action.fcurves: for keyframe in fcurve.keyframe_points: keyframes.append(keyframe.co[0]) keyframes = set(keyframes) keyframes = [kf for kf in keyframes] keyframes.sort() file.write('keyframes count: {:d}'.format(len(keyframes)) + '\n') for kfIndex in keyframes: bpy.context.scene.frame_set(kfIndex) file.write('keyframe: {:d}\n'.format(int(kfIndex))) for i in range(0, len(skeleton.data.bones)): file.write('joint: {:d}\n'.format(i)) joint = skeleton.pose.bones[i] jointCurrentPoseTransform = joint.matrix translationV = jointCurrentPoseTransform.to_translation() rotationQ = jointCurrentPoseTransform.to_3x3().to_quaternion() scaleV = jointCurrentPoseTransform.to_scale() file.write('T {:9f} {:9f} {:9f}\n'.format(translationV[0], translationV[1], translationV[2])) file.write('Q {:9f} {:9f} {:9f} {:9f}\n'.format(rotationQ[1], rotationQ[2], rotationQ[3], rotationQ[0])) file.write('S {:9f} {:9f} {:9f}\n'.format(scaleV[0], scaleV[1], scaleV[2])) file.write('\n') file.close() Which I believe follow the theory explained at the beginning of my question. But then I checked out Blender's directX .x exporter for reference.. and what threw me off was that in the .x script they are exporting bind poses like so (transcribed using the same variable names I used so you can compare): if joint.parent: jointTransform = poseJoint.parent.matrix.inverted() else: jointTransform = Matrix() jointTransform *= poseJoint.matrix and exporting current keyframe poses like this: if joint.parent: jointCurrentPoseTransform = joint.parent.matrix.inverted() else: jointCurrentPoseTransform = Matrix() jointCurrentPoseTransform *= joint.matrix why are they using the parent's transform instead of the joint in question's? isn't the join transform assumed to exist in the context of a parent transform since after all it transforms from this joint's space to its parent's? Why are they concatenating in the same order for both bind poses and keyframe poses? If these two are then supposed to be concatenated with each other to cancel out the change of basis? Anyway, any ideas are appreciated.

    Read the article

  • Missing features from WebGL and OpenGL ES

    - by Chris Smith
    I've started using WebGL and am pleased with how easy it is to leverage my OpenGL (and by extension OpenGL ES) experience. However, my understanding is as follows: OpenGL ES is a subset of OpenGL WebGL is a subset of OpenGL ES Is this correct for both cases? If so, are there resources for detailing which features are missing? For example, one notable missing feature is glPushMatrix and glPopMatrix. I don't see those in WebGL, but in my searches I cannot find them referenced in OpenGL ES material either.

    Read the article

  • Should we always prefer OpenGL ES version 2 over version 1.x

    - by Shivan Dragon
    OpengGL ES version 2 goes a long way into changing the development paradigm that was established with OpenGL ES 1.x. You have shaders which you can chain together to apply varios effects/transforms to your elements, the projection and transformation matrices work completly different etc. I've seen a lot of online tutorials and blogs that simply say "ditch version 1.x, use version 2, that's the way to go". Even on Android's documentation it sais to "use version 2 as it may prove faster than 1.x". Now, I've also read a book on OpenGL ES (which was rather good, but I'm not gonna mention here because I don't want to give the impression that I'm trying to make hidden publicity). The guy there treated only OpenGL ES 1.x for 80% of the book, and then at the end only listed the differences in version 2 and said something like "if OpenGL ES 1 does what you need, there's no need to switch to version 2, as it's only gonna over complicate your code. Version 2 was changed a lot to facillitate newer, fancier stuff, but if you don't need it, version 1.x is fine". My question is then, is the last statement right? Should I always use Open GL ES version 1.x if I don't need version 2 only stuff? I'd sure like to do that, because I find coding in version 1.x A LOT simpler than version 2 but I'm afraid that my apps might get obsolete faster for using an older version.

    Read the article

  • book and resource about vanilla OpenGL ES 2.0 development

    - by user827992
    I Found this book but it talks about an SDK created by the author rather than pure simple OpenGL ES 2.0; this sounds more like a commercial to me than a good book for programming, i would like to start with just OpenGL ES 2.0 without talking about anything else: can you give me a good advice on this? A good book or on-line resource. I'm also interested in cross platform development with OpenGL ES, in particular Android and iOS.

    Read the article

  • Where are some good resources to learn Game Development with OpenGL ES 2.X

    - by Mahbubur R Aaman
    Background: From http://www.khronos.org/opengles/2_X/ OpenGL ES 2.0 combines a version of the OpenGL Shading Language for programming vertex and fragment shaders that has been adapted for embedded platforms, together with a streamlined API from OpenGL ES 1.1 that has removed any fixed functionality that can be easily replaced by shader programs, to minimize the cost and power consumption of advanced programmable graphics subsystems. Related Resources The OpenGL ES 2.0 specification, header files, and optional extension specifications The OpenGL ES 2.0 Online Manual Pages The OpenGL ES 3.0 Shading LanguageOnline Reference Pages The OpenGL ES 2.0 Quick Reference Card OpenGL ES 1.X OpenGL ES 2.0 From http://www.cocos2d-iphone.org/archives/2003 Cocos2d Version 2 released and one of primary key point noted as OpenGL ES 2.0 support From http://www.h-online.com/open/news/item/Compiz-now-supports-OpenGL-ES-2-0-1674605.html Compiz now supports OpenGL ES 2.0 My Question : Being as a Game Developer ( I have to work with several game engine Cocos2d, Unity). I need several resources to cope up with OpenGL ES 2.X for better outcome while developing games?

    Read the article

  • OpenGL ES 2.0: Using VBOs?

    - by Bunkai.Satori
    OpenGL VBOs (vertex buffer objects) have been developed to improve performance of OpenGL (OpenGL ES 2.0 in my case). The logic is that with the help of VBOs, the data does not need to be copied from client memory to graphics card on per frame basis. However, as I see it, the game scene changes continuously: position of objects change, their scaling and rotating change, they get animated, they explode, they get spawn or disappear. In such highly dynamic environment, such as computer game scene is, what is the point of using VBOs, if the VBOs would need to be constructed on per-frame basis anyway? Can you please help me to understand how to practically take beneif of VBOs in computer games? Can there be more vertex based VBOs (say one per one object) or there must be always exactly only one VBO present for each draw cycle?

    Read the article

  • Trying to Draw a 2D Triangle in OpenGL ES 2.0

    - by Nathan Campos
    I'm trying to convert a code from OpenGL to OpenGL ES 2.0 (for the BlackBerry PlayBook). So far what I got is this (just the part of the code that should draw the triangle): void setupScene() { glClearColor(250, 250, 250, 1); glViewport(0, 0, 600, 1024); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void drawScene() { setupScene(); glColorMask(0, 0, 0, 1); const GLfloat triangleVertices[] = { 100, 100, 150, 0, 200, 100 }; glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, triangleVertices); glEnableVertexAttribArray(0); glDrawArrays(GL_TRIANGLES, 0, 2); } void render() { drawScene(); bbutil_swap(); } The problem is that when I launch the app instead of showing me the triangle the screen just flickers (very fast) from white to gray. Any idea what I'm doing wrong? Also, here is the entire code if you need: Full source code

    Read the article

  • OpenGL ES 2.0: Filtering Polygons within VBO

    - by Bunkai.Satori
    Say, I send 10 polygon pairs (one polygon pair == one 2d sprite == one rectangle == two triangles) into OpenGL ES 2.0 VBO. The 10 polygon pairs represent one animated 2D object consisting of 10 frames. The 10 frames, of course, can not be rendered all at the same time, but will be rendered in particular order to make up smooth animation. Would you have an advice, how to pick up proper polygon pair for rendering (4 vertices) inside Vertex Shader from the VBO? Creating separate VBO for each frame would end up with thousands of VBOs, which is not the right way of doing it. I use OpenGL ES 2.0, and VBOs for both Vertices and Indices.

    Read the article

  • How to use mipmap in OpenGL-ES

    - by VanDir
    I have recently entered in the OpenGL world. I am very pleased with the performance that I got with opengl compared to those obtained with a SurfaceView and its canvas. At the same time because of the limitation of the images to be in power of two I noticed that the quality of the sprite of my game is a little decreased. I read that we can use mipmap in Android but I have not found a real tutotial. Are they compatible with Android 2.2+ ? Which program creates mipmaps? How do you actually use in code?

    Read the article

  • Camera rotation flicker in OpenGL ES 2.0

    - by seahorse
    I implemented an orbit camera in my own OpenGL ES 2.0 application. I was getting extensive amount of flicker while rotating the camera using the mouse. When I added the line eglSwapInterval( ..., 0.1); after eglSwapBuffers() and then the flicker immediately stopped. I am not able to understand why eglSwapInterval solves the flicker problem? (The FPS of my app prior to eglSwapInterval was around 700FPS) (The flicker is NOT due to z-fighting because I have set near and far clip planes as 100 and 500)

    Read the article

  • OpenGL ES 2.0: Vertex and Fragment Shader for 2D with Transparency

    - by Bunkai.Satori
    Could I knindly ask for correct examples of OpenGL ES 2.0 Vertex and Fragment shader for displaying 2D textured sprites with transparency? I have fairly simple shaders that display textured polygon pairs but transparency is not applied despite: texture map contains transparency information Blending is enabled: glEnable(GL_BLEND); glEnable(GL_DEPTH_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); My Vertex Shader: uniform mat4 uOrthoProjection; uniform vec3 Translation; attribute vec4 Position; attribute vec2 TextureCoord; varying vec2 TextureCoordOut; void main() { gl_Position = uOrthoProjection * (Position + vec4(Translation, 0)); TextureCoordOut = TextureCoord; } My Fragment Shader: varying mediump vec2 TextureCoordOut; uniform sampler2D Sampler; void main() { gl_FragColor = texture2D(Sampler, TextureCoordOut); }

    Read the article

  • OpenGL 3.0+ framebuffer to texture/images

    - by user827992
    I need a way to capture what is rendered on screen, i have read about glReadPixels but it looks really slow. Can you suggest a more efficient or just an alternative way for just copying what is rendered by OpenGL 3.0+ to the local RAM and in general to output this in a image or in a data stream? How i can achieve the same goal with OpenGL ES 2.0 ? EDIT: i just forgot: with this OpenGL functions how i can be sure that I'm actually reading a complete frame, meaning that there is no overlapping between 2 frames or any nasty side effect I'm actually reading the frame that comes right next to the previous one so i do not lose frames

    Read the article

  • OpenGL ES 1 Pixel Error?

    - by Beginner001
    I am developing a game on android using OpenGL ES 1.0 for Android OS. It is a 2d game using a simple Orthographic projection and textures for the sprites. One of these textures has a small line (it looks like 1 pixel) all the way across the top that has the same colors as the bottom 1-pixel line of the texture. It is almost as if the bottom line of the image raster was copied and pasted as the top line as well. Is anyone familiar with this type of error? What could the problem be?

    Read the article

  • Unity completely broken after upgrade to 12.10?

    - by NlightNFotis
    I am facing a very frustrating issue with my computer right now. I successfully upgraded to Ubuntu 12.10 this afternoon, but after the upgrade, the graphical user interface seems completely broken. To be more specific, I can not get the Unity bar to appear on the right. I have tried many things, including (but not limited to) purging and then reinstalling the fglrx drivers, apt-get install --reinstall ubuntu-desktop, apt-get install --reinstall unity, tried to remove the Xorg and Compiz configurations, checked to see if the Ubuntu Unity wall was enabled (it was) in ccsm, all to no avail. Could someone help me troubleshoot and essentially fix this issue? NOTE: This is the output when I try to enable unity via a terminal: compiz (core) - Info: Loading plugin: core compiz (core) - Info: Starting plugin: core unity-panel-service: no process found compiz (core) - Info: Loading plugin: reset compiz (core) - Error: Failed to load plugin: reset compiz (core) - Info: Loading plugin: ccp compiz (core) - Info: Starting plugin: ccp compizconfig - Info: Backend : gsettings compizconfig - Info: Integration : true compizconfig - Info: Profile : unity compiz (core) - Info: Loading plugin: composite compiz (core) - Info: Starting plugin: composite compiz (core) - Info: Loading plugin: opengl X Error of failed request: BadRequest (invalid request code or no such operation) Major opcode of failed request: 153 (GLX) Minor opcode of failed request: 19 (X_GLXQueryServerString) Serial number of failed request: 22 Current serial number in output stream: 22 compiz (core) - Info: Unity is not supported by your hardware. Enabling software rendering instead (slow). compiz (core) - Info: Starting plugin: opengl Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Error: Plugin initScreen failed: opengl compiz (core) - Error: Failed to start plugin: opengl compiz (core) - Info: Unloading plugin: opengl compiz (core) - Info: Loading plugin: decor compiz (core) - Info: Starting plugin: decor compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: imgpng compiz (core) - Info: Starting plugin: imgpng compiz (core) - Info: Loading plugin: vpswitch compiz (core) - Info: Starting plugin: vpswitch compiz (core) - Info: Loading plugin: resize compiz (core) - Info: Starting plugin: resize Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: compiztoolbox compiz (core) - Info: Starting plugin: compiztoolbox compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Info: Loading plugin: move compiz (core) - Info: Starting plugin: move compiz (core) - Info: Loading plugin: gnomecompat compiz (core) - Info: Starting plugin: gnomecompat compiz (core) - Info: Loading plugin: mousepoll compiz (core) - Info: Starting plugin: mousepoll compiz (core) - Info: Loading plugin: wall compiz (core) - Info: Starting plugin: wall compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: wall compiz (core) - Error: Failed to start plugin: wall compiz (core) - Info: Unloading plugin: wall compiz (core) - Info: Loading plugin: regex compiz (core) - Info: Starting plugin: regex compiz (core) - Info: Loading plugin: snap compiz (core) - Info: Starting plugin: snap compiz (core) - Info: Loading plugin: unitymtgrabhandles compiz (core) - Info: Starting plugin: unitymtgrabhandles compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: unitymtgrabhandles compiz (core) - Error: Failed to start plugin: unitymtgrabhandles compiz (core) - Info: Unloading plugin: unitymtgrabhandles compiz (core) - Info: Loading plugin: place compiz (core) - Info: Starting plugin: place compiz (core) - Info: Loading plugin: grid compiz (core) - Info: Starting plugin: grid Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: animation compiz (core) - Info: Starting plugin: animation compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: animation compiz (core) - Error: Failed to start plugin: animation compiz (core) - Info: Unloading plugin: animation compiz (core) - Info: Loading plugin: fade compiz (core) - Info: Starting plugin: fade compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: fade compiz (core) - Error: Failed to start plugin: fade compiz (core) - Info: Unloading plugin: fade compiz (core) - Info: Loading plugin: session compiz (core) - Info: Starting plugin: session compiz (core) - Info: Loading plugin: expo compiz (core) - Info: Starting plugin: expo compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: expo compiz (core) - Error: Failed to start plugin: expo compiz (core) - Info: Unloading plugin: expo compiz (core) - Info: Loading plugin: ezoom compiz (core) - Info: Starting plugin: ezoom compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: ezoom compiz (core) - Error: Failed to start plugin: ezoom compiz (core) - Info: Unloading plugin: ezoom compiz (core) - Info: Loading plugin: workarounds compiz (core) - Info: Starting plugin: workarounds compiz (core) - Error: Plugin 'opengl' not loaded. Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: scale compiz (core) - Info: Starting plugin: scale compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: scale compiz (core) - Error: Failed to start plugin: scale compiz (core) - Info: Unloading plugin: scale Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Segmentation fault (core dumped)

    Read the article

  • OpenGL extension vs OpenGL core

    - by user209347
    I was doubting: I'm writing a cross-platform engine OpenGL C++, I figured out windows forces the developers to access OpenGL features above 1.1 through extensions. Now the thing is, on Linux, I know that I can directly access functions if the version supports it through glext.h and opengl version. The problem is that if on Linux, the core doesn't support it, is it possible there is an extensions that supports the same functionality, in my case vertex buffer objects? I'm doing something like this: Windows: (hashdeck) define glFunction functionpointer_to_the_extension (apparently the layout changes font size if I use #) Linux: Since glext already defined glFunction, I can write in client code glFunction, and compile it both on Windows AND Linux without changing a single line in my client code using the engine (my goal). Now the thing is, I saw a tutorial use only the extension on Linux, and not checking for the opengl implementation version. If the functionality is available in the core, is it also available as extension (VBO's e.g.)? Or is an extension something you never know is available? I want to write an engine that gets all the possibilities on hardware, so I need to check (on Linux) for extensions as well as core version for possible functionality implementation.

    Read the article

  • Setting up OpenGL camera with off-center perspective

    - by user5484
    Hi, I'm using OpenGL ES (in iOS) and am struggling with setting up a viewport with an off-center distance point. Consider a game where you have a character in the left hand side of the screen, and some controls alpha'd over the left-hand side. The "main" part of the screen is on the right, but you still want to show whats in the view on the left. However when the character moves "forward" you want the character to appear to be going "straight", or "up" on the device, and not heading on an angle to the point that is geographically at the mid-x position in the screen. Here's the jist of how i set my viewport up where it is centered in the middle: // setup the camera // glMatrixMode(GL_PROJECTION); glLoadIdentity(); const GLfloat zNear = 0.1; const GLfloat zFar = 1000.0; const GLfloat fieldOfView = 90.0; // can definitely adjust this to see more/less of the scene GLfloat size = zNear * tanf(DEGREES_TO_RADIANS(fieldOfView) / 2.0); CGRect rect; rect.origin = CGPointMake(0.0, 0.0); rect.size = CGSizeMake(backingWidth, backingHeight); glFrustumf(-size, size, -size / (rect.size.width / rect.size.height), size / (rect.size.width / rect.size.height), zNear, zFar); glMatrixMode(GL_MODELVIEW); // rotate the whole scene by the tilt to face down on the dude const float tilt = 0.3f; const float yscale = 0.8f; const float zscale = -4.0f; glTranslatef(0.0, yscale, zscale); const int rotationMinDegree = 0; const int rotationMaxDegree = 180; glRotatef(tilt * (rotationMaxDegree - rotationMinDegree) / 2, 1.0f, 0.0f, 0.0f); glTranslatef(0, -yscale, -zscale); static float b = -25; //0; static float c = 0; // rotate by to face in the direction of the dude float a = RADIANS_TO_DEGREES(-atan2f(-gCamera.orientation.x, -gCamera.orientation.z)); glRotatef(a, 0.0, 1.0, 0.0); // and move to where it is glTranslatef(-gCamera.pos.x, -gCamera.pos.y, -gCamera.pos.z); // draw the rest of the scene ... I've tried a variety of things to make it appear as though "the dude" is off to the right: - do a translate after the frustrum to the x direction - do a rotation after the frustrum about the up/y-axis - move the camera with a biased lean to the left of the dude Nothing i do seems to produce good results, the dude will either look like he's stuck on an angle, or the whole scene will appear tilted. I'm no OpenGL expert, so i'm hoping someone can suggest some ideas or tricks on how to "off-center" these model views in OpenGL. Thanks!

    Read the article

  • Bad FPS for smaller size (OpenGL ES with SDL)

    - by ber4444
    If you saw my other question, well, there is still a little problem: Click here to watch on youtube Basically, the frame rate is very bad on the actual device, where for some reason the animation is scaled (it looks like the left side on the video). It is quite fast on the simulator where it is not scaled (right side). For a test, I submitted this new changeset that hard-codes the smaller size (plus increases the point size for HII regions to make the dust clouds more visible), and as you see in the video, now it is slow even in the simulator (left side shows the small size, right side shows the original size -- otherwise the code is the same). I'm clueless why it's soooo slow with a smaller galaxy, in fact it should be FASTER. As for general speed optimization (which is not strictly part of my question but is closely related to it, esp. if we need a workaround to speed things up), some initial ideas: reducing the number of items drawn may affect the appearance negatively but screen resolution could be reduced there are too many glBegin(GL_POINTS)/glEnd() blocks, we could draw more than just a single star at once

    Read the article

  • OpenGL: Where shoud I place shaders?

    - by mivic
    I'm trying to learn OpenGL ES 2.0 and I'm wondering what is the most common practice to "manage" shaders. I'm asking this question because in the examples I've found (like the one included in the API Demo provided with the android sdk), I usually see everything inside the GLRenderer class and I'd rather separate things so I can have, for example, a GLImage object that I can reuse whenever I want to draw a textured quad (I'm focusing on 2D only at the moment), just like I had in my OpenGL ES 1.0 code. In almost every example I've found, shaders are just defined as class attributes. For example: public class Square { public final String vertexShader = "uniform mat4 uMVPMatrix;\n" + "attribute vec4 aPosition;\n" + "attribute vec4 aColor;\n" + "varying vec4 vColor;\n" + "void main() {\n" + " gl_Position = uMVPMatrix * aPosition;\n" + " vColor = aColor;\n" + "}\n"; public final String fragmentShader = "precision mediump float;\n" + "varying vec4 vColor;\n" + "void main() {\n" + " gl_FragColor = vColor;\n" + "}\n"; // ... } I apologize in advance if some of these questions are dumb, but I've never worked with shaders before. 1) Is the above code the common way to define shaders (public final class properties)? 2) Should I have a separate Shader class? 3) If shaders are defined outside the class that uses them, how would I know the names of their attributes (e.g. "aColor" in the following piece of code) so I can bind them? colorHandle = GLES20.glGetAttribLocation(program, "aColor");

    Read the article

  • Wine is no longer able to initialize OpenGL

    - by nebukadnezzar
    Since a while, wine is no longer able to initialize OpenGL on my 64bit Linux. This is by no means a unique problem to me- Lots of people with nvidia cards running 64bit linux seem to have this problem with wine on oneiric: http://forum.winehq.org/viewtopic.php?p=66856&sid=9d6e5ad628ee6fb6e5ef04577275daed http://forum.pinguyos.com/Thread-Wine-OpenGl-Problem https://bbs.archlinux.org/viewtopic.php?id=137696 And while some launchpad bug reports say one should use this workaround: LD_PRELOAD=/usr/lib32/nvidia-current/libGL.so.1 wine <app> It unfortunately does not solve the problem at all for me; That is, if i'd run CS:S, the game will run just fine for a while, but will abort after some time, including a range of GLSL-related errors. Here the startup errors from simply running steam: + wine steam.exe fixme:process:GetLogicalProcessorInformation ((nil),0x33e488): stub [.. snip ...] fixme:dwmapi:DwmSetWindowAttribute (0x1009a, 3, 0x33d384, 4) stub fixme:dwmapi:DwmSetWindowAttribute (0x1009a, 4, 0x33d374, 4) stub err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! [... this error is being reported a few dozen times, so snip again ...] err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct! fixme:iphlpapi:NotifyAddrChange (Handle 0x47cdba8, overlapped 0x45dba80): stub fixme:winsock:WSALookupServiceBeginW (0x47cdbc8 0x00000ff0 0x47cdbc4) Stub! [... snip ...] Here are the errors reported while running, and after running (because the log is huge-ish, it's pasted elsewhere): http://paste.ubuntu.com/901925/ Now, 32bit OpenGL works just fine; The 32bit executables of Nexuiz, for example, work just fine. That being said, I'm suspecting that this is a problem of wine itself. I've already manually built the git version of wine, to no avail. So what's going on? Is something broken? How do I check (correctly) whether something is broken? How do I solve this?

    Read the article

  • OpenGL slower than Canvas

    - by VanDir
    Up to 3 days ago I used a Canvas in a SurfaceView to do all the graphics operations but now I switched to OpenGL because my game went from 60FPS to 30/45 with the increase of the sprites in some levels. However, I find myself disappointed because OpenGL now reaches around 40/50 FPS at all levels. Surely (I hope) I'm doing something wrong. How can I increase the performance at stable 60FPS? My game is pretty simple and I can not believe that it is impossible to reach them. I use 2D sprite texture applied to a square for all the objects. I use a transparent GLSurfaceView, the real background is applied in a ImageView behind the GLSurfaceView. Some code public MyGLSurfaceView(Context context, AttributeSet attrs) { super(context); setZOrderOnTop(true); setEGLConfigChooser(8, 8, 8, 8, 0, 0); getHolder().setFormat(PixelFormat.RGBA_8888); mRenderer = new ClearRenderer(getContext()); setRenderer(mRenderer); setLongClickable(true); setFocusable(true); } public void onSurfaceCreated(final GL10 gl, EGLConfig config) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glShadeModel(GL10.GL_SMOOTH); gl.glDisable(GL10.GL_DEPTH_TEST); gl.glDepthMask(false); gl.glEnable(GL10.GL_ALPHA_TEST); gl.glAlphaFunc(GL10.GL_GREATER, 0); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); } public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrthof(0, width, height, 0, -1f, 1f); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); } public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Draw all the graphic object. for (byte i = 0; i < mGame.numberOfObjects(); i++){ mGame.getObject(i).draw(gl); } // Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } mGame.getObject(i).draw(gl) is for all the objects like this: /* HERE there is always a translatef and scalef transformation and sometimes rotatef */ gl.glBindTexture(GL10.GL_TEXTURE_2D, mTexPointer[0]); // Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTextureBuffer); // Draw the vertices as triangle strip gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, mVertices.length / 3); EDIT: After some test it seems to be due to the transparent GLSurfaceView. If I delete this line of code: setEGLConfigChooser(8, 8, 8, 8, 0, 0); the background becomes all black but I reach 60 fps. What can I do?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >