سؤال

فيما يتعلق بمسألتي السابقة التي قضيتها أسبوعا في محاولة لمعرفة كيفية تشغيل تظليل متعددين مقابل مخزن مؤقت فيديو أساسي.أنا أعرف ما أحتاج إليه، لكنني بصراحة، لا يمكن الحصول على الكود للعمل (لصق أدناه هو النسخة الأصلية غير الأصلية بونغ).

تفتقر إلى لحظة Eureka أنا الآن عالقة تماما :).لا يظهر الكود لإرماد وإرسال التظليل للإيجاز.كل ما يجعل الأمر كله (بنجاح - ولكن أحد شادر واحد يبالغ في الكتابة الأخرى - لذلك في عداد المفقودين الخطوة الحيوية) إلى طبقة متوافقة مع GL وتوجيه UITOOLBAR أسفل، في نهاية المطاف، سيكون له زر في ظلال زر وزر لتشغيل جميع التظليل.

شكرا،

سيمون giveacodicetagpre.

تحرير: أوضح ما هو مفقود

هل كانت مفيدة؟

المحلول

To do ping-pong rendering, you need to do the following:

  • Create 2 textures, with the exact same configuration
  • Create 2 Framebuffers with the same configuration, and attach one texture to each framebuffer.

Let's call the Framebuffers A and B, and the attached textures texA and texB:

To render:

  • Use the first shader with glUseProgram.
  • Bind Framebuffer A.
  • Render a quad.

Now you have the result of the shader execution in texA. To do the ping-pong:

  • Use the second shader with glUseProgram.
  • Bind Framebuffer B.
  • Bind texA and setup texture units for your shader.
  • Render a quad.
  • Use shader with glUseProgram.
  • Bind Framebuffer A.
  • Bind texB and setup texture units.
  • Render a quad.

Now you have the result in texA and you can repeat the process again, hope this helps!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top