opengl-es

How do you represent a normal or texture coordinate using GLshorts?

▼魔方 西西 提交于 2019-12-22 14:12:07
问题 A lot of suggestions on improving the performance in iPhone games revolve around sending less data to the GPU. The obvious suggestion is to use GLshorts instead of GLfloat wherever possible, such as for vertices, normals, or texture coordinates. What are the specifics when using a GLshort for a normal or a texture coordinate? Is it possible to represent a GLfloat texture coordinate of 0.5 when using a GLshort? If so, how do you do that? Would it just be SHRT_MAX/2? That is, does the range of

OpenGL ES: Rotating 3d model around itself

混江龙づ霸主 提交于 2019-12-22 14:11:20
问题 I'm playing with OpenGL ES on iPhone and I'm trying to rotate a model by panning with the finger. I discovered the open source app Molecules that let's you do that and I'm looking at that code, but when it comes to rotate a model of mine I'm able to rotate it only around a point distant in the space (like it was in orbit as a satellite and I am the fixed planet). Any suggestion on what can be wrong? I can post the code later , maybe on demand (many lines) For the most part refer to Molecules

OpenGL ES: Rotating 3d model around itself

感情迁移 提交于 2019-12-22 14:11:13
问题 I'm playing with OpenGL ES on iPhone and I'm trying to rotate a model by panning with the finger. I discovered the open source app Molecules that let's you do that and I'm looking at that code, but when it comes to rotate a model of mine I'm able to rotate it only around a point distant in the space (like it was in orbit as a satellite and I am the fixed planet). Any suggestion on what can be wrong? I can post the code later , maybe on demand (many lines) For the most part refer to Molecules

GLES20 Texture Not Working on Some Devices

不打扰是莪最后的温柔 提交于 2019-12-22 12:57:20
问题 I have tried to add a fairly simple extension on top of Android's example OpenGL 2.0 project in order to add texturing to basic shapes. This seems pretty straightforward, but on certain devices (Samsung Nexus S, LG Optimus 3D, Samsung Galaxy S) the texture just does not render. This is actually a problem that I am having on a much larger project, but I was able to reproduce the issue with the simple project below in the hope that someone here has an idea of where my code presents issues, or

Drawing a Globe with OpenGL ES

不打扰是莪最后的温柔 提交于 2019-12-22 11:28:38
问题 I am trying to render a globe (sphere with maps on it) with OpenGL ES 1.1 on iOS. I am able to draw the sphere, and map borders but with one problem: lines that are not facing front in my view, are also being drawn on the screen . Like this: In the picture, you can see that America renders just fine, but you can see Australia rendered on the back. It is not supposed to be shown because it's in the back of the globe, and BLACK and PURPLE stripes in the globe are not transparent. Any ideas on

Opengl ES, issue while rendering close by objects

六眼飞鱼酱① 提交于 2019-12-22 11:27:02
问题 I am working with opengl es on android. I have a 3d humanoid model on which i can put a hairstyle which is another 3d model. While rendering i could find that on the area where the two objects are very close/coincides (the head-hair region) the rendering is not proper, in fact i get different results on different mobile devices. I doubt it is z-fighting. Are there some solution for rendering close by objects properly with opengl es which will be consistent across all mobile devices. I have

glFlush() time varies from frame to frame with same content on iPhone

折月煮酒 提交于 2019-12-22 10:45:03
问题 this question is related to presentRenderbuffer : GL_RENDERBUFFER_OES takes long time I have a simple 2D game(with several sprites). glFlush() execution time varies from 1ms to 30ms with same frame content. Do you know why? I am sure that I don't have frame content changed from one frame to another when I compute this, it's a static scene with about 30 sprites. I use ~5MB texture memory with additional 4MB allocated for texture loading. I use opengles 1.1 on a single thread. I have other

NDK OpenGL undefined reference to glVertexPointer

佐手、 提交于 2019-12-22 10:44:36
问题 When compiling the following C code with ndk-build in Terminal (I'm running Ubuntu): #include <jni.h> #include <GLES/gl.h> #include <GLES/glext.h> #include "org_opengldrawinjni_DrawinJNI.h" JNIEXPORT void JNICALL Java_org_opengldrawinjni_DrawinJNI_Draw (JNIEnv *envptr, jobject jobj) { GLfloat vertices[] = { 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 }; GLubyte indices[] = { 0, 1, 2 }; glVertexPointer(3, GL_FLOAT, 0, vertices); glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, indices); }

Hud with shaders (opengl-es 2.0)

懵懂的女人 提交于 2019-12-22 10:44:21
问题 How to draw a HUD using shaders on opengl es 2.0? I have a shader which draws a textured quad on screen, it uses MVP matrix. The quad has it own vertices which are independent of view position and so on (cause of MVP matrix) Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3f, 17); Matrix.setLookAtM(mVMatrix, 0, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f); I'd like to show the same quad on the top right corner (like a button or something else, HUD). As I understand, i need create an ortho

OpenGL gradient fill on iPhone looks striped

让人想犯罪 __ 提交于 2019-12-22 10:16:14
问题 When I draw a gradient fill with OpenGL, the output looks striped, i.e. it's rendered with only about the a fourth of the possible colors. In the render buffer all the colors appear but not in the actual output. I'm developing on iPhone 3G running iOS4. Any ideas? Peter ========== ========== GLint redBits, greenBits, blueBits; glGetIntegerv (GL_RED_BITS, &redBits); // ==> 8 glGetIntegerv (GL_GREEN_BITS, &greenBits); // ==> 8 glGetIntegerv (GL_BLUE_BITS, &blueBits); // ==> 8 glDisable(GL_BLEND