blob: a2ea8939ab899c8e807181dac780f2abd6b41531 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
---
title: WebGLRenderingContext.createTexture()
slug: Web/API/WebGLRenderingContext/createTexture
tags:
- API
- Méthode
- Reference
- Textures
- WebGL
- WebGLRenderingContext
translation_of: Web/API/WebGLRenderingContext/createTexture
---
<div>{{APIRef("WebGL")}}</div>
<p>La méthode <strong><code>WebGLRenderingContext.createTexture()</code></strong> de l'API WebGL crée et initialise un objet {{domxref("WebGLTexture")}}.</p>
<h2 id="Syntaxe">Syntaxe</h2>
<pre class="syntaxbox">WebGLTexture <var>gl</var>.createTexture();
</pre>
<h3 id="Paramètres">Paramètres</h3>
<p>Aucun.</p>
<h3 id="Valeur_retournée">Valeur retournée</h3>
<p>Un objet {{domxref("WebGLTexture")}} auquel des images peuvent être liées.</p>
<h2 id="Exemples">Exemples</h2>
<p>Voir aussi le <a href="/fr-FR/docs/Web/API/WebGL_API/Tutorial">tutoriel WebGL</a> sur l'<a href="/fr-FR/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL">Utilisation de textures en WebGL</a>.</p>
<h3 id="Création_d'une_texture">Création d'une texture</h3>
<pre class="brush: js">var canevas = document.getElementById('canevas');
var gl = canevas.getContext('webgl');
var texture = gl.createTexture();
</pre>
<h2 id="Spécifications">Spécifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Spécification</th>
<th scope="col">Statut</th>
<th scope="col">Commentaire</th>
</tr>
<tr>
<td>{{SpecName('WebGL', "#5.14.8", "createTexture")}}</td>
<td>{{Spec2('WebGL')}}</td>
<td>
<p>Définition initiale.</p>
</td>
</tr>
<tr>
<td>{{SpecName('OpenGL ES 2.0', "glGenTextures.xml", "glGenTextures")}}</td>
<td>{{Spec2('OpenGL ES 2.0')}}</td>
<td>Page man de l’API OpenGL (similaire).</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
<p class="hidden">Le tableau de compatibilité de cette page est généré à partir de données structurées. Si vous souhaitez contribuer aux données, merci de regarder <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> et envoyez-nous une pull request.</p>
<p>{{Compat("api.WebGLRenderingContext.createTexture")}}</p>
<h2 id="Voir_aussi">Voir aussi</h2>
<ul>
<li>{{domxref("WebGLRenderingContext.bindTexture()")}}</li>
<li>{{domxref("WebGLRenderingContext.deleteTexture()")}}</li>
<li>{{domxref("WebGLRenderingContext.isTexture()")}}</li>
<li>{{domxref("WebGLRenderingContext.texImage2D()")}}</li>
</ul>
|