opengl-es-2.0

How to create and use VBOs in OpenGL ES 2

我只是一个虾纸丫 提交于 2019-12-01 09:59:07
问题 I am looking for help with understanding VBOs. I have done a ton of research and have found tutorials on the subject, but they are still vague to me. I have a few questions: Where should a VBO be created, and how should I create one? I am currently using the code right below to initialize my vertex and index buffers: vertices = new float[] { p[0].x, p[0].y, 0.0f, p[1].x, p[1].y, 0.0f, p[2].x, p[2].y, 0.0f, p[3].x, p[3].y, 0.0f, }; // The order of vertex rendering for a quad indices = new

GLSL Shader will not render color from uniform variable

不想你离开。 提交于 2019-12-01 09:27:07
I am currently building an app for Android, but have run into some problems with a shader that refuses to render. Consider the following fragment shader: uniform vec4 color; void main(){ gl_FragColor = vec4(1.0); } This shader works fine for drawing an object in a solid color (white in this case). The uniform vector color is optimized away, and cannot be found with glGetUniformLocation() (returns -1). Trying to get the color from the uniform variable can be done like so: uniform vec4 color; void main(){ gl_FragColor = color; } However, when I use this, nothing renders. The shader is created

vertex shader doesn't run on galaxy tab10 (tegra 2)

不羁的心 提交于 2019-12-01 08:57:39
问题 I created an app that uses GLES2.0 on a HTC Desire S. It works on the HTC, but not on an Samung Galaxy tab10.1. The program cannot be linked (GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linOk,0) gives-1) and glGetError() gives me an error 1282 (Invalid Operation). When I replace this line (in the shader): graph_coord.z = (texture2D(mytexture, graph_coord.xy / 2.0 + 0.5).r); by graph_coord.z = 0.2; it works also on the galaxy tab. My shader looks like this: private final String

glMapBuffer undeclared in OpenGL-ES 2.0

拈花ヽ惹草 提交于 2019-12-01 08:32:15
I am doing Opengl-es 2.0 in ununtu 10.10 through the use of kronos and pvrsdk .Now code #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> ==========|||||||||||||||||||||||||||||||||||=================== GLfloat *pData = glMapBufferOES (GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES); for(i=0; i<triNum[surfnum]; ++i,pData+=9) { memcpy(pData, triArray[surfnum][i].pt1, 3*sizeof(GLfloat)); memcpy(pData+3, triArray[surfnum][i].pt2, 3*sizeof(GLfloat)); memcpy(pData+6, triArray[surfnum][i].pt3, 3*sizeof(GLfloat)); } glUnmapBufferOES (GL_ARRAY_BUFFER); Error : src/Hello.cpp: In function 'int main(int, char**)':

GLSL Shader will not render color from uniform variable

梦想的初衷 提交于 2019-12-01 07:04:55
问题 I am currently building an app for Android, but have run into some problems with a shader that refuses to render. Consider the following fragment shader: uniform vec4 color; void main(){ gl_FragColor = vec4(1.0); } This shader works fine for drawing an object in a solid color (white in this case). The uniform vector color is optimized away, and cannot be found with glGetUniformLocation() (returns -1). Trying to get the color from the uniform variable can be done like so: uniform vec4 color;

glMapBuffer undeclared in OpenGL-ES 2.0

女生的网名这么多〃 提交于 2019-12-01 06:46:21
问题 I am doing Opengl-es 2.0 in ununtu 10.10 through the use of kronos and pvrsdk .Now code #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> ==========|||||||||||||||||||||||||||||||||||=================== GLfloat *pData = glMapBufferOES (GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES); for(i=0; i<triNum[surfnum]; ++i,pData+=9) { memcpy(pData, triArray[surfnum][i].pt1, 3*sizeof(GLfloat)); memcpy(pData+3, triArray[surfnum][i].pt2, 3*sizeof(GLfloat)); memcpy(pData+6, triArray[surfnum][i].pt3, 3*sizeof(GLfloat)

Issue getting gradient square in glsl es 2.0, Gamemaker Studio 2.0

家住魔仙堡 提交于 2019-12-01 06:40:45
问题 I made a triangle list with 4 triangles, having the middle point a different color. And then aim to combine the triangles to get a nice gradient. But the edges of the triangles create unwanted lines, I don't want these lines I want it to be smooth al the way. How can I get the desired result? Images: Shader Code: // Simple passthrough vertex shader // attribute vec3 in_Position; // (x,y,z) attribute vec4 in_Colour; // (r,g,b,a) attribute vec2 in_TextureCoord; // (u,v) varying vec2 v_texcoord;

Declaring constants instead of literals in vertex shader. Standard practice, or needless rigor?

妖精的绣舞 提交于 2019-12-01 06:01:17
In a vertex shader , there is of course a limited amount of uniform storage allowed, and it is my understanding that different systems may implement GLSL in slightly different ways in terms of compiling code. I've heard the recommendation to use constants instead of writing out literals in the vertex shader code. For instance, the following code could supposedly result in a reduction in available uniform storage. (I don't quite understand how.) Example 1: With literals vec4 myVector = vec4(1.0, 0.0, 0.0, 1.0); To my understanding, there is the possibility that each use of 1.0 or 0.0 takes up

Is there any Android device with screen size greater than GL_MAX_TEXTURE_SIZE?

强颜欢笑 提交于 2019-12-01 05:12:39
I've been searching through glbenchmark.com for a device with screen size (width or height) greater than GL_MAX_TEXTURE_SIZE . I've found over a hundred devices with GL_MAX_VIEWPORT_WIDTH and GL_MAX_VIEWPORT_HEIGHT greater than GL_MAX_TEXTURE_SIZE (for example Acer A110 ), but no device with screen size greater than GL_MAX_TEXTURE_SIZE . So I assume there is no such device. Is there any specification that guarantees that every device (or Android device) has screen size less or equal to GL_MAX_TEXTURE_SIZE ? If not, is there any device that breaks my assumption? You can be sure that GL_MAX

Opengl ES 2.0 : Get texture size and other info

喜欢而已 提交于 2019-12-01 04:39:59
问题 The context of the question is OpenGL ES 2.0 in the Android environment. I have a texture. No problem to display or use it. Is there a method to know its width and height and other info (like internal format) simply starting from its binding id? I need to save texture to bitmap without knowing the texture size. 回答1: Not in ES 2.0. It's actually kind of surprising that the functionality is not there. You can get the size of a renderbuffer, but not the size of a texture, which seems