2 Copyright 2012 Marten Richter
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
20 #include "glmocoshader.h"
\r
21 #include "videovpeogl.h"
\r
23 #define BLOCK_TEXTURE_WIDTH 2048
\r
24 #define BLOCK_TEXTURE_HEIGHT 1024
\r
25 #define BLOCK_SIZE 64
\r
26 #define BLOCK_PER_ROW 32
\r
28 const GLchar moco_vertex_shader[] =
\r
29 "attribute vec4 block_pos;\n"
\r
30 "attribute vec2 block_edge;\n"
\r
31 "attribute vec4 block_types;\n"
\r
32 "attribute vec2 index;\n"
\r
33 "attribute float cbp;\n"
\r
34 "uniform vec2 pict_scale;\n"
\r
35 // "attribute vec2 tex_coord;\n"
\r
36 "varying vec4 out_yblockpos_x;\n"
\r
37 "varying vec4 out_yblockpos_y;\n"
\r
38 "varying vec4 out_uvblockpos_xy;\n"
\r
39 "varying vec2 out_block_edge;\n"
\r
41 "const float one=1.0;\n"
\r
42 "const float c1024=1024.0;\n"
\r
43 "const float c32=32.0;\n"
\r
46 "const float c65536=65536.;\n"
\r
50 "const vec4 y_cbp=vec4(1.0,2.0,4.0,8.0);\n"
\r
51 "const vec2 uv_cbp=vec2(16.0,32.0);\n"
\r
55 " vec4 cbp_vec=vec4(cbp,cbp,cbp,cbp);\n"
\r
56 " vec4 fmod_cbp_y=mod(cbp_vec,y_cbp);\n"
\r
57 " vec2 fmod_cbp_uv=mod(cbp_vec.xy,uv_cbp);\n"
\r
58 " fmod_cbp_y=sign(vec4(fmod_cbp_y.yzw,fmod_cbp_uv.x)-fmod_cbp_y);\n"
\r
59 " fmod_cbp_uv=sign(vec2(fmod_cbp_uv.y,cbp)-fmod_cbp_uv);\n"
\r
60 // resulting vector should indicate with block is present
\r
61 // now transform it to a sum (TODO vectorize this)
\r
62 " vec4 fmod_cbp_y2=fmod_cbp_y;\n"
\r
63 " vec2 fmod_cbp_uv2=fmod_cbp_uv;\n"
\r
64 " fmod_cbp_y2.y+=fmod_cbp_y2.x;\n"
\r
65 " fmod_cbp_y2.z+=fmod_cbp_y2.y;\n"
\r
66 " fmod_cbp_y2.w+=fmod_cbp_y2.z;\n"
\r
67 " fmod_cbp_uv2.x+=fmod_cbp_y2.w;\n"
\r
68 " fmod_cbp_uv2.y+=fmod_cbp_uv2.x;\n"
\r
70 // now calculate their position inside the short array
\r
71 " float m_index=index.x+index.y*c65536;\n" //Not Endian save
\r
72 " fmod_cbp_y2+=m_index;\n" //shift to the blocks
\r
73 " fmod_cbp_uv2+=m_index;\n"
\r
74 " out_yblockpos_x=mod(fmod_cbp_y2,c32);\n"
\r
75 " out_uvblockpos_xy.xy=mod(fmod_cbp_uv2,c32);\n"
\r
76 " out_yblockpos_y=floor((fmod_cbp_y2)/c32);\n"
\r
77 " out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)/c32);\n"
\r
79 //Kick out uncoded blocks
\r
80 " out_yblockpos_y-=sign(fmod_cbp_y-one)*c1024;\n"
\r
81 " out_uvblockpos_xy.zw-=sign(fmod_cbp_uv-one)*c1024;\n"
\r
84 " out_block_edge=block_edge;\n"
\r
85 " vec4 out_pos=block_pos;\n"
\r
86 " out_pos.xy+=block_edge;\n"
\r
87 " out_pos.xy*=pict_scale;\n"
\r
88 " out_pos.xy-=vec2(one,one);"
\r
89 " out_pos.zw=vec2(one,one);"
\r
90 " gl_Position=out_pos;\n"
\r
93 const GLchar moco_frag_shader[] =
\r
94 "precision mediump float;\n"
\r
95 "uniform sampler2D blocks;\n"
\r
96 "varying vec4 out_yblockpos_x;\n"
\r
97 "varying vec4 out_yblockpos_y;\n"
\r
98 "varying vec4 out_uvblockpos_xy;\n"
\r
99 "varying vec2 out_block_edge;\n"
\r
100 "const float halfst=0.5;\n"
\r
101 "const float ctwo=2.0;\n"
\r
102 "const float sieben=7.0;\n"
\r
103 "const float acht=8.0;\n"
\r
104 "const float s8=1./8.;\n"
\r
105 "const float s16=1./16.;\n"
\r
106 "const float c1over2047=1./2047.;\n"
\r
107 "const float c1over1023=1./1023.;\n"
\r
108 "const float c255=255.;\n"
\r
109 "const float c65280=65280.;\n"
\r
110 "const float c65536=65536.;\n"
\r
111 "const float cstep=32767.;\n"
\r
113 "float unpack_short(vec2 income) {\n"
\r
114 " float temp=income.y*c65280+income.x*c255;\n"
\r
115 " temp-=step(cstep,temp)*c65536;\n"
\r
116 " return abs(temp/c255);\n" //temporary work around
\r
118 // "uniform sampler2D textureV;\n"
\r
119 // "uniform sampler2D textureY;\n"
\r
120 // "varying vec2 out_texCoord;\n"
\r
123 // first figure out the block num for y, first decide between up and down, fix me field
\r
125 // " vec4 ypos_temp1=mix(vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y),"
\r
126 // " vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w),step(halfst,out_block_edge.y));\n"
\r
128 " vec4 ypos_temp1=mix(vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y),"
\r
129 " vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w),step(s16,mod(out_block_edge.y,s8)));\n"
\r
131 //decide between left and right
\r
132 " vec2 ypos_temp2=mix(ypos_temp1.xy,ypos_temp1.zw,step(halfst,out_block_edge.x));\n"
\r
133 //now get the intra 8x8 Block coordinates
\r
134 " vec2 ypos_temp3=mod(out_block_edge,halfst)*ctwo;\n"
\r
135 " ypos_temp2.x=(ypos_temp3.x*sieben+(ypos_temp3.y*sieben+acht*ypos_temp2.x)*acht)*c1over2047;\n"
\r
136 " ypos_temp2.y*=c1over1023;\n"
\r
137 " ypos_temp1=texture2D(blocks,ypos_temp2);\n" // now select the right data
\r
138 " ypos_temp2=mix(ypos_temp1.rg,ypos_temp1.ba,step(c1over2047,mod(ypos_temp2.x,c1over1023)));\n" //activate this
\r
140 " gl_FragColor.r=unpack_short(ypos_temp2.rg);\n" //signed later TODO
\r
141 //" gl_FragColor.r=ypos_temp1.b;\n" //signed later TODO
\r
142 " gl_FragColor.g=0.5;\n"
\r
143 " gl_FragColor.b=0.5;\n"
\r
144 " gl_FragColor.a=1.0;\n"
\r
145 //" vec4 blocks=texture2D(blocks,gl_FragCoord.xy/600.);\n"
\r
146 // "help.x=texture2D(textureY,out_texCoord).r;\n"
\r
147 // "help.y=texture2D(textureU,out_texCoord).r;\n"
\r
148 // "help.z=texture2D(textureV,out_texCoord).r;\n" //-uv_corr;\n"
\r
149 // " gl_FragColor.rgba=blocks;\n"
\r
150 // " gl_FragColor.rgba=vec4(0.7,0.5,0.5,1.0);\n"
\r
151 //" gl_FragColor.a=1.;\n"
\r
154 GLMocoShader::GLMocoShader(): GLShader("GLMocoShader")
\r
161 GLMocoShader::~GLMocoShader()
\r
163 //parent does everything
\r
166 int GLMocoShader::init() {
\r
168 if (!initShaders(moco_vertex_shader, moco_frag_shader)) {
\r
169 Log::getInstance()->log("GLMocoShader", Log::ERR, "init Shaders failed for GLMocoShader");
\r
172 loc_pict_scale = glGetUniformLocation(shad_program, "pict_scale");
\r
173 blocks_loc = glGetUniformLocation(shad_program, "blocks");
\r
175 // frame_sampler_locY = glGetUniformLocation(shad_program, "textureY");
\r
176 // Log::getInstance()->log("OSD", Log::WARN, "uniform location %x %x",frame_sampler_locY,glGetError());
\r
177 // frame_sampler_locU = glGetUniformLocation(shad_program, "textureU");
\r
178 //Log::getInstance()->log("OSD", Log::WARN, "uniform location %x %x",frame_sampler_locU,glGetError());
\r
179 // frame_sampler_locV = glGetUniformLocation(shad_program, "textureV");
\r
180 glGenFramebuffers(1, &frame_buf);
\r
181 //Log::getInstance()->log("GLMocoShader", Log::WARN, "genframe bufmark1 glerror %x",glGetError());
\r
182 glGenTextures(1, &data_blocks);
\r
183 glBindTexture(GL_TEXTURE_2D, data_blocks);
\r
184 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, BLOCK_TEXTURE_WIDTH >>1, BLOCK_TEXTURE_HEIGHT, 0, GL_RGBA,
\r
185 GL_UNSIGNED_BYTE, NULL);
\r
186 char buffer[BLOCK_TEXTURE_WIDTH*4];
\r
187 memset(buffer,0,BLOCK_TEXTURE_WIDTH*4); // the last line is black, simplifies the shader algorithms
\r
189 glTexSubImage2D(GL_TEXTURE_2D,0,0,BLOCK_TEXTURE_HEIGHT-1,
\r
191 GL_RGBA,GL_UNSIGNED_BYTE,
\r
194 glGenBuffers(1,¯o_block);
\r
195 glBindBuffer(GL_ARRAY_BUFFER,macro_block);
\r
196 glBufferData(GL_ARRAY_BUFFER,4096*4*sizeof(XvMCMacroBlock),NULL,GL_DYNAMIC_DRAW);
\r
197 valid_macro_blocks=0;
\r
200 glGenBuffers(1,&triangles);
\r
201 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,triangles);
\r
202 GLushort *tri_indices=(GLushort *)malloc(sizeof(GLushort)*4096*6);
\r
203 if (!tri_indices) {
\r
204 Log::getInstance()->log("GLMocoShader", Log::WARN, "allocating triindices failed");
\r
207 GLushort *tri_indices_run=tri_indices;
\r
208 for (int i=0;i<4096;i++) {
\r
209 *tri_indices_run=i+0*4096; //strip
\r
211 *tri_indices_run=i+2*4096; //strip
\r
213 *tri_indices_run=i+1*4096; //strip
\r
215 *tri_indices_run=i+3*4096; //strip
\r
217 *tri_indices_run=i+3*4096; //strip
\r
219 *tri_indices_run=i+1+0*4096; //strip
\r
227 glBufferData(GL_ELEMENT_ARRAY_BUFFER,4096*6*sizeof(GLushort),tri_indices,GL_STREAM_DRAW);
\r
230 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
\r
231 glBindBuffer(GL_ARRAY_BUFFER,0);
\r
239 int GLMocoShader::deinit()
\r
241 glDeleteFramebuffers(1, &frame_buf);
\r
242 glDeleteTextures(1, &data_blocks);
\r
243 return deinitShaders();
\r
248 int GLMocoShader::uploadDataBlocks(short* blocks,unsigned int num_blocks, XvMCMacroBlock *m_blocks,unsigned int num_m_blocks)
\r
250 unsigned int height=(num_blocks)/(BLOCK_PER_ROW);
\r
252 glBindTexture(GL_TEXTURE_2D, data_blocks);
\r
253 glPixelStorei(GL_UNPACK_ALIGNMENT,1);
\r
258 Log::getInstance()->log("GLMocoShader", Log::WARN, "uploadDataBlocks mark1 glerror %x %d",glGetError(),height);
\r
259 glTexSubImage2D(GL_TEXTURE_2D,0,0,0,
\r
260 BLOCK_TEXTURE_WIDTH>>1,height,
\r
261 GL_RGBA,GL_UNSIGNED_BYTE,
\r
263 Log::getInstance()->log("GLMocoShader", Log::WARN, "uploadDataBlocks mark2 glerror %x",glGetError());
\r
264 glTexSubImage2D(GL_TEXTURE_2D,0,0,height+1,
\r
265 (num_blocks%BLOCK_PER_ROW)>>1,1,
\r
266 GL_RGBA,GL_UNSIGNED_BYTE,
\r
269 Log::getInstance()->log("GLMocoShader", Log::WARN, "uploadDataBlocks mark2 glerror %x",glGetError());
\r
273 glBindTexture(GL_TEXTURE_2D, 0);
\r
275 valid_macro_blocks=num_m_blocks;
\r
276 glBindBuffer(GL_ARRAY_BUFFER,macro_block);
\r
277 XvMCMacroBlock *m_blocks_run=m_blocks;
\r
278 XvMCMacroBlock *m_blocks_end=m_blocks+num_m_blocks;
\r
279 while (m_blocks_run!=m_blocks_end) {
\r
280 m_blocks_run->pad0=0xFF00;
\r
284 /* m_blocks[0].x=0;
\r
286 m_blocks[3]=m_blocks[2]=m_blocks[1]=m_blocks[0];
\r
287 m_blocks[0].pad0=0xFF00;
\r
288 m_blocks[1].pad0=0xFFFF;
\r
289 m_blocks[2].pad0=0x0000;
\r
290 m_blocks[3].pad0=0x00FF;
\r
298 glBufferSubData(GL_ARRAY_BUFFER, 0* sizeof(XvMCMacroBlock), num_m_blocks * sizeof(XvMCMacroBlock),
\r
302 m_blocks_run = m_blocks;
\r
303 m_blocks_end = m_blocks + num_m_blocks;
\r
304 while (m_blocks_run != m_blocks_end) {
\r
305 m_blocks_run->pad0 = 0xFFFF;
\r
308 glBufferSubData(GL_ARRAY_BUFFER, 4096* sizeof(XvMCMacroBlock), num_m_blocks * sizeof(XvMCMacroBlock),
\r
312 m_blocks_run = m_blocks;
\r
313 m_blocks_end = m_blocks + num_m_blocks;
\r
314 while (m_blocks_run != m_blocks_end) {
\r
315 m_blocks_run->pad0 = 0x0000;
\r
318 glBufferSubData(GL_ARRAY_BUFFER, 2 * 4096* sizeof(XvMCMacroBlock),
\r
319 num_m_blocks * sizeof(XvMCMacroBlock), m_blocks);
\r
322 m_blocks_run = m_blocks;
\r
323 m_blocks_end = m_blocks + num_m_blocks;
\r
324 while (m_blocks_run != m_blocks_end) {
\r
325 m_blocks_run->pad0 = 0x00FF;
\r
328 glBufferSubData(GL_ARRAY_BUFFER, 3 * 4096* sizeof(XvMCMacroBlock),
\r
329 num_m_blocks * sizeof(XvMCMacroBlock), m_blocks);
\r
332 glBindBuffer(GL_ARRAY_BUFFER,0);
\r
340 int GLMocoShader::doMoCo(VPEOGLFrame *target)
\r
343 // Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark-2 glerror %x %x",glGetError(),frame_buf);
\r
345 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark-1 glerror %x %x",glGetError(),frame_buf);
\r
346 glBindFramebuffer(GL_FRAMEBUFFER, frame_buf);
\r
347 Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark1 glerror %x %x %x",glGetError(),target->textures[0],target->textures[1]);
\r
350 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
\r
351 GL_TEXTURE_2D, target->textures[0], 0);
\r
352 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark1apres glerror %x",glGetError());
\r
357 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark2 glerror %x",glGetError());
\r
359 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark2a glerror %x",glGetError());
\r
361 int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
\r
362 if (status == GL_FRAMEBUFFER_COMPLETE) {
\r
363 glViewport(0, 0, target->width,target->height);
\r
364 // Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark2b glerror %x",glGetError());
\r
366 XvMCMacroBlock * helperp=NULL;
\r
368 glClearColor(0.0f,0.5f,0.5f,1.f); //this black
\r
369 glClear(GL_COLOR_BUFFER_BIT);
\r
370 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark2c glerror %x",glGetError());
\r
372 glUseProgram(shad_program);
\r
373 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark3 glerror %x",glGetError());
\r
376 const GLfloat pict_scale[]={ 32./((float)target->width),32./((float)target->height)};
\r
378 glUniform2fv(loc_pict_scale,1,(const GLfloat*)&pict_scale);
\r
382 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,triangles);
\r
383 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark5 glerror %x",glGetError());
\r
384 glBindBuffer(GL_ARRAY_BUFFER,macro_block);
\r
388 glVertexAttribPointer(0, 2, GL_SHORT, GL_FALSE,
\r
389 sizeof(XvMCMacroBlock), NULL);
\r
391 glEnableVertexAttribArray(0);
\r
393 glVertexAttribPointer(1, 2, GL_UNSIGNED_BYTE, GL_TRUE,sizeof(XvMCMacroBlock), (const void *) &(helperp->pad0));
\r
394 glEnableVertexAttribArray(1);
\r
396 glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_FALSE,sizeof(XvMCMacroBlock), (const void *) &(helperp->macroblock_type));
\r
397 glEnableVertexAttribArray(2);
\r
399 glVertexAttribPointer(3, 1, GL_SHORT, GL_FALSE,sizeof(XvMCMacroBlock), (const void *) &(helperp->coded_block_pattern));
\r
400 glEnableVertexAttribArray(3);
\r
401 glVertexAttribPointer(4, 2, GL_UNSIGNED_SHORT, GL_FALSE,sizeof(XvMCMacroBlock), (const void *) &(helperp->index));
\r
402 glEnableVertexAttribArray(4);
\r
405 glActiveTexture(GL_TEXTURE0);
\r
406 glBindTexture(GL_TEXTURE_2D,data_blocks);
\r
407 glUniform1i(blocks_loc,0);
\r
408 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
\r
409 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
\r
410 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
\r
411 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
\r
413 glDrawElements(GL_TRIANGLE_STRIP, valid_macro_blocks*6,
\r
414 GL_UNSIGNED_SHORT, NULL);
\r
418 glVertexAttribPointer(0, 2, GL_SHORT, GL_FALSE,sizeof(XvMCMacroBlock), 0);
\r
419 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark3 glerror %x",glGetError());
\r
420 glEnableVertexAttribArray(0);
\r
422 glVertexAttribPointer(1, 2, GL_UNSIGNED_BYTE, GL_TRUE,sizeof(XvMCMacroBlock), (const void *) &(helperp->pad0));
\r
423 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark3 glerror %x",glGetError());
\r
424 glEnableVertexAttribArray(1);*/
\r
426 // Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark4 glerror %x",glGetError());
\r
429 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark6 glerror %x",glGetError());
\r
431 // glDrawElements(GL_TRIANGLE_STRIP,/*valid_macro_blocks*/4,GL_UNSIGNED_SHORT,0);
\r
432 Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark7 glerror %x %x",glGetError(),valid_macro_blocks);
\r
435 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
\r
436 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark5 glerror %x",glGetError());
\r
437 glBindBuffer(GL_ARRAY_BUFFER,0);
\r
439 glBindFramebuffer(GL_FRAMEBUFFER, 0);
\r
440 glBindTexture(GL_TEXTURE_2D, 0);
\r
441 //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark8 glerror %x",glGetError());
\r
443 glBindFramebuffer(GL_FRAMEBUFFER, 0);
\r
444 Log::getInstance()->log("GLMocoShader", Log::WARN, "framebuffer not complete %x",status);
\r
448 glFinish(); // since the main rendering is done in a different thread we have to make sure rendering is finished before passing the texture
\r
449 // call this only in the last stage of rendering the moco frame
\r
458 int GLMocoShader::PrepareRendering(GLuint y_tex, GLuint u_tex, GLuint v_tex) { // This Function setups the rendering pipeline according to the shaders standards
\r
460 //Log::getInstance()->log("OSD", Log::WARN, "mark1 glerror %x",glGetError());
\r
463 //Log::getInstance()->log("OSD", Log::WARN, "mark2 glerror %x",glGetError());
\r
466 glActiveTexture( GL_TEXTURE2);
\r
467 glBindTexture(GL_TEXTURE_2D, v_tex);
\r
468 glUniform1i(frame_sampler_locV, 2);
\r
469 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
\r
470 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
\r
472 glActiveTexture( GL_TEXTURE1);
\r
473 glBindTexture(GL_TEXTURE_2D, u_tex);
\r
474 glUniform1i(frame_sampler_locU, 1);
\r
475 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
\r
476 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
\r
478 glActiveTexture( GL_TEXTURE0);
\r
479 glBindTexture(GL_TEXTURE_2D, y_tex);
\r
480 glUniform1i(frame_sampler_locY, 0);
\r
481 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
\r
482 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
\r
487 int GLMocoShader::BindAttributes()
\r
489 glBindAttribLocation(shad_program,0,"block_pos");
\r
490 glBindAttribLocation(shad_program,1,"block_edge");
\r
491 glBindAttribLocation(shad_program,2,"block_types");
\r
492 glBindAttribLocation(shad_program,3,"cbp");
\r
493 glBindAttribLocation(shad_program,4,"index");
\r
494 //glBindAttribLocation(shad_program,1,"tex_coord");
\r