-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgl.Version_1_1.cs
600 lines (555 loc) · 36.5 KB
/
gl.Version_1_1.cs
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
#region Copyright and License
// Copyright (c) 2013-2014 The Khronos Group Inc.
// Copyright (c) of C# port 2014 by Shinta <shintadono@googlemail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenGL.Core
{
public static partial class gl
{
/// <summary>
/// Renders primitives from array.
/// </summary>
/// <param name="mode">A <see cref="glDrawMode"/> specifying the type of primitive to be rendered.</param>
/// <param name="first">Start index in the array.</param>
/// <param name="count">Number of elements to be rendered.</param>
[DllImport(DLLName, EntryPoint = "glDrawArrays")]
public static extern void DrawArrays(glDrawMode mode, int first, int count);
/// <summary>
/// Renders primitives from array via indices.
/// </summary>
/// <param name="mode">A <see cref="glDrawMode"/> specifying the type of primitive to render.</param>
/// <param name="count">Number of indices.</param>
/// <param name="type">A <see cref="glDrawElementsType"/> specifying the data type of the indices.</param>
/// <param name="indices">The array, where the indices are stored.</param>
[DllImport(DLLName, EntryPoint = "glDrawElements")]
static extern void DrawElements(glDrawMode mode, int count, glDrawElementsType type, IntPtr indices);
#region Overloads for DrawElements
/// <summary>
/// Renders primitives from array via indices.
/// </summary>
/// <param name="mode">A <see cref="glDrawMode"/> specifying the type of primitive to render.</param>
/// <param name="count">Number of indices.</param>
/// <param name="type">A <see cref="glDrawElementsType"/> specifying the data type of the indices.</param>
/// <param name="offset">The offset into the array bound to <see cref="glBufferTarget.ELEMENT_ARRAY_BUFFER"/>.</param>
public static void DrawElements(glDrawMode mode, int count, glDrawElementsType type, int offset)
{
DrawElements(mode, count, type, (IntPtr)offset);
}
/// <summary>
/// Renders primitives from array via indices.
/// </summary>
/// <param name="mode">A <see cref="glDrawMode"/> specifying the type of primitive to render.</param>
/// <param name="count">Number of indices.</param>
/// <param name="type">A <see cref="glDrawElementsType"/> specifying the data type of the indices.</param>
/// <param name="offset">The offset into the array bound to <see cref="glBufferTarget.ELEMENT_ARRAY_BUFFER"/>.</param>
public static void DrawElements(glDrawMode mode, int count, glDrawElementsType type, long offset)
{
if (IntPtr.Size == 4 && ((long)offset >> 32) != 0) throw new ArgumentOutOfRangeException("offset", PlatformErrorString);
DrawElements(mode, count, type, (IntPtr)offset);
}
#endregion
/// <summary>
/// Returns the pointer for different user-supplied elements.
/// </summary>
/// <param name="pname">A <see cref="glGetPointerParameter"/> specifying the pointer to return.</param>
/// <param name="param">The pointer.</param>
[DllImport(DLLName, EntryPoint = "glGetPointerv")]
public static extern void GetPointerv(glGetPointerParameter pname, out IntPtr param);
/// <summary>
/// Sets factor and units used to calculate depth values.
/// </summary>
/// <param name="factor">Factor to the depth offset.</param>
/// <param name="units">Factor to the value that is guaranteed to produce a resolvable offset for a given implementation.</param>
[DllImport(DLLName, EntryPoint = "glPolygonOffset")]
public static extern void PolygonOffset(float factor, float units);
/// <summary>
/// Copies pixels from the current read buffer to the currently bound 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="internalformat">A <see cref="glInternalFormat"/> specifying the internal format to be used.</param>
/// <param name="x">Horizontal start position of the region to be copied, in window coordinates.</param>
/// <param name="y">Vertical start position of the region to be copied, in window coordinates.</param>
/// <param name="width">The width of the texture.</param>
/// <param name="border">Must be zero for core profile.</param>
[DllImport(DLLName, EntryPoint = "glCopyTexImage1D")]
public static extern void CopyTexImage1D(glTexture1DTarget target, int level, glInternalFormat internalformat, int x, int y, int width, int border);
/// <summary>
/// Copies pixels from the current read buffer to the currently bound 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="internalformat">A <see cref="glInternalFormat"/> specifying the internal format to be used.</param>
/// <param name="x">Horizontal start position of the region to be copied, in window coordinates.</param>
/// <param name="y">Vertical start position of the region to be copied, in window coordinates.</param>
/// <param name="width">The width of the texture.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="border">Must be zero for core profile.</param>
[DllImport(DLLName, EntryPoint = "glCopyTexImage2D")]
public static extern void CopyTexImage2D(glTexture2DTarget target, int level, glInternalFormat internalformat, int x, int y, int width, int height, int border);
/// <summary>
/// Copies pixels inside the currently bound 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="x">Horizontal start position of the region to be copied, in window coordinates.</param>
/// <param name="y">Vertical start position of the region to be copied, in window coordinates.</param>
/// <param name="width">The width of the texture.</param>
[DllImport(DLLName, EntryPoint = "glCopyTexSubImage1D")]
public static extern void CopyTexSubImage1D(glTexture1DTarget target, int level, int xoffset, int x, int y, int width);
/// <summary>
/// Copies pixels inside the currently bound 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="x">Horizontal start position of the region to be copied, in window coordinates.</param>
/// <param name="y">Vertical start position of the region to be copied, in window coordinates.</param>
/// <param name="width">The width of the texture.</param>
/// <param name="height">The height of the texture.</param>
[DllImport(DLLName, EntryPoint = "glCopyTexSubImage2D")]
public static extern void CopyTexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, IntPtr pixels);
#region Overloads for TexSubImage1D
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="offset">The offset into the array bound to <see cref="glBufferTarget.PIXEL_UNPACK_BUFFER"/>.</param>
public static void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, int offset)
{
TexSubImage1D(target, level, xoffset, width, format, type, offset);
}
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="offset">The offset into the array bound to <see cref="glBufferTarget.PIXEL_UNPACK_BUFFER"/>.</param>
public static void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, long offset)
{
if (IntPtr.Size == 4 && ((long)offset >> 32) != 0) throw new ArgumentOutOfRangeException("offset", PlatformErrorString);
TexSubImage1D(target, level, xoffset, width, format, type, offset);
}
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.UNSIGNED_BYTE"/>, <see cref="glPixelDataType.UNSIGNED_BYTE_3_3_2"/> or <see cref="glPixelDataType.UNSIGNED_BYTE_2_3_3_REV"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, byte[] pixels);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.BYTE"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, sbyte[] pixels);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.SHORT"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, short[] pixels);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <b>glPixelDataType.UNSIGNED_SHORT*</b>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, ushort[] pixels);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.INT"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, int[] pixels);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <b>glPixelDataType.UNSIGNED_INT*</b>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, uint[] pixels);
/// <summary>
/// Loads a part a 1D texture. (For future use. Type not yet supported.)
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, long[] pixels);
/// <summary>
/// Loads a part a 1D texture. (For future use. Type not yet supported.)
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, ulong[] pixels);
/// <summary>
/// Loads a part a 1D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.FLOAT"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, float[] pixels);
/// <summary>
/// Loads a part a 1D texture. (For future use. Type not yet supported.)
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage1D")]
public static extern void TexSubImage1D(glTexture1DTarget target, int level, int xoffset, int width, glPixelFormat format, glPixelDataType type, double[] pixels);
#endregion
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, IntPtr pixels);
#region Overloads for TexSubImage2D
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="offset">The offset into the array bound to <see cref="glBufferTarget.PIXEL_UNPACK_BUFFER"/>.</param>
public static void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, int offset)
{
TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntPtr)offset);
}
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture1DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="offset">The offset into the array bound to <see cref="glBufferTarget.PIXEL_UNPACK_BUFFER"/>.</param>
public static void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, long offset)
{
if (IntPtr.Size == 4 && ((long)offset >> 32) != 0) throw new ArgumentOutOfRangeException("offset", PlatformErrorString);
TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntPtr)offset);
}
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.UNSIGNED_BYTE"/>, <see cref="glPixelDataType.UNSIGNED_BYTE_3_3_2"/> or <see cref="glPixelDataType.UNSIGNED_BYTE_2_3_3_REV"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, byte[] pixels);
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.BYTE"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, sbyte[] pixels);
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.SHORT"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, short[] pixels);
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <b>glPixelDataType.UNSIGNED_SHORT*</b>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, ushort[] pixels);
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.INT"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, int[] pixels);
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <b>glPixelDataType.UNSIGNED_INT*</b>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, uint[] pixels);
/// <summary>
/// Loads a part a 2D texture. (For future use. Type not yet supported.)
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, long[] pixels);
/// <summary>
/// Loads a part a 2D texture. (For future use. Type not yet supported.)
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, ulong[] pixels);
/// <summary>
/// Loads a part a 2D texture.
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in. Must be <see cref="glPixelDataType.FLOAT"/>.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, float[] pixels);
/// <summary>
/// Loads a part a 2D texture. (For future use. Type not yet supported.)
/// </summary>
/// <param name="target">A <see cref="glTexture2DTarget"/> specifying the texture target.</param>
/// <param name="level">The level-of-detail to be filled.</param>
/// <param name="xoffset">The horizontal texel offset.</param>
/// <param name="yoffset">The vertical texel offset.</param>
/// <param name="width">The width of the texture subimage.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="format">A <see cref="glPixelFormat"/> specifying the format the pixels a given in.</param>
/// <param name="type">A <see cref="glPixelDataType"/> specifying the data type the pixels a given in.</param>
/// <param name="pixels">Pointer to the pixels.</param>
[DllImport(DLLName, EntryPoint = "glTexSubImage2D")]
public static extern void TexSubImage2D(glTexture2DTarget target, int level, int xoffset, int yoffset, int width, int height, glPixelFormat format, glPixelDataType type, double[] pixels);
#endregion
/// <summary>
/// Binds/unbinds texture name to texture target.
/// </summary>
/// <param name="target">A <see cref="glTextureTarget"/> specifying the texture target.</param>
/// <param name="texture">The texture name to be bound.</param>
[DllImport(DLLName, EntryPoint = "glBindTexture")]
public static extern void BindTexture(glTextureTarget target, uint texture);
/// <summary>
/// Releases <paramref name="count"/> many texture names.
/// </summary>
/// <param name="count">Number of texture names to be released.</param>
/// <param name="textures">Array of texture names to be released.</param>
[DllImport(DLLName, EntryPoint = "glDeleteTextures")]
public static extern void DeleteTextures(int count, params uint[] textures);
/// <summary>
/// Generates <paramref name="count"/> many texture names.
/// </summary>
/// <param name="count">The number of texture names to be generated.</param>
/// <param name="textures">The array that will receive the new texture names.</param>
[DllImport(DLLName, EntryPoint = "glGenTextures")]
public static extern void GenTextures(int count, uint[] textures);
/// <summary>
/// Generates one texture name and returns it.
/// </summary>
/// <param name="one">Must be one.</param>
/// <param name="texture">The new texture name.</param>
[DllImport(DLLName, EntryPoint = "glGenTextures")]
private static extern void GenTextures(int one, out uint texture);
/// <summary>
/// Determines if a name is a texture name.
/// </summary>
/// <param name="texture">The maybe texture name.</param>
/// <returns><b>true</b> if <paramref name="texture"/> is a texture name.</returns>
[DllImport(DLLName, EntryPoint = "glIsTexture")]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool IsTexture(uint texture);
#region GenTexture(s)
/// <summary>
/// Generates one texture name and returns it.
/// </summary>
/// <returns>The new texture name.</returns>
public static uint GenTexture()
{
uint i = 0;
GenTextures(1, out i);
return i;
}
/// <summary>
/// Generates one texture name and returns it.
/// </summary>
/// <param name="texture">The new texture name.</param>
public static void GenTexture(out uint texture)
{
GenTextures(1, out texture);
}
/// <summary>
/// Generates <paramref name="count"/> many texture names and returns them as array.
/// </summary>
/// <param name="count">The number of texture names to be generated.</param>
/// <returns>The new texture names as array.</returns>
public static uint[] GenTextures(int count)
{
uint[] res = new uint[count];
GenTextures(count, res);
return res;
}
#endregion
}
}