Rev 6142 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6142 | Rev 6334 | ||
---|---|---|---|
Line 360... | Line 360... | ||
360 | "{\n" |
360 | "{\n" |
361 | " gl_Position = v_position;\n" |
361 | " gl_Position = v_position;\n" |
362 | " tex_coord = v_texcoord0.xy;\n" |
362 | " tex_coord = v_texcoord0.xy;\n" |
363 | "}\n"; |
363 | "}\n"; |
Line 364... | Line 364... | ||
364 | 364 | ||
365 | const char *fs_rgba = |
365 | const char *fs_i965 = |
366 | "uniform sampler2D tex_rgba;\n" |
366 | "uniform sampler2D tex_rgba;\n" |
367 | "uniform sampler2D tex_mask;\n" |
367 | "uniform sampler2D tex_mask;\n" |
368 | "varying vec2 tex_coord;\n" |
368 | "varying vec2 tex_coord;\n" |
369 | "void main()\n" |
369 | "void main()\n" |
370 | "{\n" |
370 | "{\n" |
371 | " float ca = texture2D(tex_mask, tex_coord).r;\n" |
371 | " float ca = texture2D(tex_mask, tex_coord).r;\n" |
372 | " gl_FragColor = vec4(texture2D(tex_rgba, tex_coord).rgb, ca);\n" |
372 | " gl_FragColor = vec4(texture2D(tex_rgba, tex_coord).rgb, ca);\n" |
Line -... | Line 373... | ||
- | 373 | "}\n"; |
|
- | 374 | ||
- | 375 | const char *fs_i915 = |
|
- | 376 | "uniform sampler2D tex_rgba;\n" |
|
- | 377 | "uniform sampler2D tex_mask;\n" |
|
- | 378 | "varying vec2 tex_coord;\n" |
|
- | 379 | "void main()\n" |
|
- | 380 | "{\n" |
|
- | 381 | " float ca = texture2D(tex_mask, tex_coord).a;\n" |
|
- | 382 | " gl_FragColor = vec4(texture2D(tex_rgba, tex_coord).rgb, ca);\n" |
|
373 | "}\n"; |
383 | "}\n"; |
374 | 384 | ||
- | 385 | GLuint prog; |
|
- | 386 | GLint vs_shader, fs_shader; |
|
375 | GLuint prog; |
387 | const char *fs_src; |
Line 376... | Line 388... | ||
376 | GLint vs_shader, fs_shader; |
388 | char *drv_name; |
377 | int ret; |
389 | int ret; |
378 | 390 | ||
Line 379... | Line 391... | ||
379 | prog = glCreateProgram(); |
391 | prog = glCreateProgram(); |
380 | if(prog == 0) |
392 | if(prog == 0) |
381 | goto err; |
393 | goto err; |
Line -... | Line 394... | ||
- | 394 | ||
- | 395 | vs_shader = create_shader(GL_VERTEX_SHADER, vs_src); |
|
- | 396 | if(vs_shader == 0) |
|
- | 397 | goto err; |
|
- | 398 | ||
- | 399 | drv_name = (char*)glGetString(0x1F04); |
|
- | 400 | printf("Render: %s\n", drv_name); |
|
- | 401 | ||
- | 402 | if(strstr(drv_name, "i965")) |
|
382 | 403 | fs_src = fs_i965; |
|
383 | vs_shader = create_shader(GL_VERTEX_SHADER, vs_src); |
404 | else if(strstr(drv_name, "i915")) |
384 | if(vs_shader == 0) |
405 | fs_src = fs_i915; |
Line 385... | Line 406... | ||
385 | goto err; |
406 | else fs_src = NULL; |
386 | 407 |