1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| GLuint computeProgram = CreateComputeProgram("res/shader/simple.compute"); GLuint computeDstTexture; glGenTextures(1, &computeDstTexture); glBindTexture(GL_TEXTURE_2D, computeDstTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexStorage2D(GL_TEXTURE_2D,1,GL_RGBA8,imgWidth,imgHeight); glBindTexture(GL_TEXTURE_2D, 0);
GLuint mainTexture;
glGenTextures(1, &mainTexture); glBindTexture(GL_TEXTURE_2D, mainTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, imgWidth, imgHeight); glTexSubImage2D(GL_TEXTURE_2D,0,0,0,imgWidth,imgHeight,GL_RGB,GL_UNSIGNED_BYTE,pixelData);
glBindTexture(GL_TEXTURE_2D, 0);
|