Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6809365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:04:42+00:00 2026-05-26T20:04:42+00:00

For example… If I’m developing an application that requires more than one texture in

  • 0

For example…

If I’m developing an application that requires more than one texture in it (unique sprites, basically), do I need to call context3D.createProgram(); and assemble a new Program3D (with a VertexShaderAssembler and a FragmentShaderAssembler) for each individual textures that I wish to use in the application?

How does a Program3D work within an engine typically? Does one program run the whole thing, or does it use one program per textures, models, maps?

And am I correct to assume that you only need to create the Program3D once during initialization time (Event.ADDED_TO_STAGE), and not during each frames (Event.ENTER_FRAME), right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:04:42+00:00Added an answer on May 26, 2026 at 8:04 pm

    For one program (shader) you can have multiple textures. Usually you write a program for each shader that you have.
    For example in my game I have one shader (program) for the terrain lighting, texturing and coloring. I have another shader (program) for the water.

    So the programs are made once, but I tell context3d which program to use before drawing the scene. That way it will draw whatever I’m about to draw with the current program.

    Example usage:

    context3d.setProgram(WaterShader);
    water.drawTriangles();
    
    context3d.setProgram(TerrainShader)
    terrain.drawTriangles();
    

    I draw the water first and then the terrain, each using a different shader.
    My TerrainShader has multiple textures in, e.g. sand, rock and dirt textures. The shader decides which texture to use at given time. E.g. if the height of the vertex is < 10, then use the sand texture.

    So, create the programs once and use them when needed.

    I hope this helps you in the right way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('&#8230;')
(tl;dr: see summary at the bottom.) I am implementing an application that pulls content
Example: var sessions = require('sessions'); function load_session(req) { sessions.load(sid); } Now that the session
I see that some rss on xml have strange strings. For example, ... is
Example Outlook: its only one process but can have multiple windows (user can double
Example, I want to specialize a class to have a member variable that is
Example: require 'commandline' class App < CommandLine::Application def initialize end def main raise 'foo'
example page I have a floating menu that i've built to the left side
Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe
Example I have Person , SpecialPerson , and User . Person and SpecialPerson are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.