Answer the question
In order to leave comments, you need to log in
How to draw in WebGL?
Hello.
Tell me please.
I'm making a game on canvas, drawing with sprites.
I see that some games are already being made on webGL, questions:
- sprites are not used there, then what?
- in which editor is the graphics created?
- what restrictions should a designer put on drawing models?
Thank you.
Answer the question
In order to leave comments, you need to log in
I am not an expert in WebGL, but since the API is based on OpenGL, then the development should be similar. Graphics can be created in any editor. textures are loaded something like this:
from here: learningwebgl.com/blog/?p=507. If you apply such a texture to a rectangle, you get a sprite.
var neheTexture;
function initTexture() {
neheTexture = gl.createTexture();
neheTexture.image = new Image();
neheTexture.image.onload = function() {
handleLoadedTexture(neheTexture)
}
neheTexture.image.src = "nehe.gif";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question