textures

Texture buffer objects or regular textures?

て烟熏妆下的殇ゞ 提交于 2019-12-05 03:51:01
The OpenGL SuperBible discusses texture buffer objects, which are textures formed from data inside VBOs. It looks like there are benefits to using them, but all the examples I've found create regular textures. Does anyone have any advice regarding when to use one over the other? According to the extension registry , texture buffers are only 1-dimensional, cannot do any filtering and have to be accessed by accessing explicit texels (by index), instead of normalized [0,1] floating point texture coordinates. So they are not really a substitution for regular textures, but for large uniform arrays

opengl create a depth_stencil texture for reading

我是研究僧i 提交于 2019-12-05 02:58:14
问题 I'm using defered rendering in my application and i'm trying to create a texture that will contain both the depth and the stencil. glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, width, height, 0, ???, GL_FLOAT, 0); Now what format enum does opengl want for this particular texture. I tried a couple and got error for all of them Also, what is the correct glsl syntax to access the depth and stencil part of the texture. I understand that depth texture are usually uniform sampler2Dshadow. But

OpenGl glTexImage2D data

ε祈祈猫儿з 提交于 2019-12-05 00:47:36
问题 I am trying to read floatingpoint numbers from a CSV file , that contains a precomputed texture, store it in a 1 dimensional array, and then put that read data into a 2 dimensional texture. I need to make sure the following code does that, because i have problems accessing the data and I cannot figure out where the error is: // Allocate memory float * image = new float [width * height * 3 ]; for( int i = 0; i < height; i++) { for( int j = 0; j < width-1; j++) { fscanf( fDataFile, "%f,",

Tips for improving OpenGL ES fill rate on Android

余生长醉 提交于 2019-12-04 21:59:13
问题 In my live wallpaper I'm drawing 3 textured quads that covers the whole screen. On Nexus One I get 40fps. I'm looking for ways to improving performance. The quads are blended on top of each other, textures are loaded from RGB_8888 bitmaps. Textures are 1024x1024. I've got glDisable(GL_DITHER); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); glDisable(GL10.GL_LIGHTING); glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

Alpha blending with multiple textures leaves colored border

北城余情 提交于 2019-12-04 21:49:06
Following problem: I have two textures and I want to combine these two into a new texture. Thus, one texture is used as background, the other will be overlaid. The overlay texture is getting initialized with glClearColor(1.0, 1.0, 1.0, 0.0). Objects are draw onto the texture, these objects do have alpha values. Now blending between the two textures leaves a white border around the objects. The border comes from the fact that the background color in the second texture is white, isn't it? How can I use alpha blending where I do not have to think about the background color of the overlaying

glDeleteTextures does not seem to free up texture memory on Windows, is there no solution?

扶醉桌前 提交于 2019-12-04 20:17:11
问题 I have been having some problems with my openGL application running out of memory and I am trying to track down my problem. To this end, I created a small test program that basically just loads a giant texture from a file calls glDeleteTextures and then loads it again, if I run this test program on OSX this process can run for hundreds of iterations with no problems (the most I ran it for was 1024 and this had no problems) but after about 14 iterations on windows I get a GLU_OUT_OF_MEMORY

GL_TEXTURE_RECTANGLE_ARB

妖精的绣舞 提交于 2019-12-04 20:11:27
I try to use data raw texture using GL_TEXTURE_RECTANGLE_ARB: void Display::tex(){ GLubyte Texture[16] = { 0,0,0,0, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0,0,0,0 }; GLuint Nom; glLoadIdentity();//load identity matrix glTranslatef(0.0f,0.0f,-4.0f);//move forward 4 units glEnable(GL_DEPTH_TEST); //Active le depth test glDisable( GL_CULL_FACE ); glEnable (GL_TEXTURE_RECTANGLE_ARB); glPixelStorei(GL_UNPACK_ROW_LENGTH, 2); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, &Nom); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, Nom); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,

Android layout background xml texture

梦想的初衷 提交于 2019-12-04 20:06:00
I searched a lot but didn't find anything. I want to make a background for a layout , but instead of filling it with a color or a gradient I want to fill it with a texture and repeat it . I tried this but it didn't work . Can you tell me a solution. card_texture.xml <?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/paper_texture" android:tileMode="repeat" /> card_shape.xml <?xml version="1.0" encoding="utf-8"?> <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> <solid

iPhone 6+ simulator doesn't load @3x images from atlas

烂漫一生 提交于 2019-12-04 18:44:45
What I've noticed when running project on iPhone 6+ simulator is that simulator don't pick up right images. Instead of @3x, @2x images are used. I tried reseting simulators content and settings, clean project and delete derived data from organizer and same thing still happens. When I look for the myatlas.atlasc folder inside the myapp.app (show package contents) at the path: /Users/username/Library/Developer/Xcode/DerivedData/appname-appspecificgeneratedstring/Build/Products/Debug-iphonesimulator/appname.app I can see myatlas.atlasc (note that this is not myatlas.atlas) and inside there are

Loading Images (using their RGB(A) pixel data) in openGL textures

霸气de小男生 提交于 2019-12-04 18:09:38
In the main function: img = cvLoadImage("test.JPG"); //openCV functions to load and create matrix CvMat *mat = cvCreateMat(img->height,img->width,CV_8SC3 ); cvGetMat( img, mat,0,1); //creating the 3-dimensional array during runtime data = new float**[img->height]; for(int i=0;i<img->height;i++){ data[i] = new float*[img->width]; } for(int i=0;i<img->height;i++){ for(int j=0;j<img->width;j++) data[i][j] = new float[3]; } //setting RGB values for(int i=0;i<img->height;i++) { for(int j=0;j<img->width;j++) { CvScalar scal = cvGet2D( mat,i,j); data[i][j][0] = scal.val[0]; data[i][j][1] = scal.val[1