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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


Glf module — pxr-usd-api 105.1 documentation

pxr-usd-api

 »
Modules »
Glf module

 

# Glf module

Summary: The Glf module contains Utility classes for OpenGL output.

glf
Classes:

DrawTarget
A class representing a GL render target with mutliple image attachments.

GLQueryObject
Represents a GL query object in Glf

SimpleLight

SimpleMaterial

Texture
Represents a texture object in Glf.

class pxr.Glf.DrawTarget
A class representing a GL render target with mutliple image
attachments.
A DrawTarget is essentially a custom render pass into which several
arbitrary variables can be output into. These can later be used as
texture samplers by GLSL shaders.
The DrawTarget maintains a map of named attachments that correspond to
GL_TEXTURE_2D mages. By default, DrawTargets also create a depth
component that is used both as a depth buffer during the draw pass,
and can later be accessed as a regular GL_TEXTURE_2D data. Stencils
are also available (by setting the format to GL_DEPTH_STENCIL and the
internalFormat to GL_DEPTH24_STENCIL8)
Methods:

AddAttachment(name, format, type, internalFormat)
Add an attachment to the DrawTarget.

Bind()
Binds the framebuffer.

Unbind()
Unbinds the framebuffer.

WriteToFile(name, filename, viewMatrix, ...)
Write the Attachment buffer to an image file (debugging).

Attributes:

expired
True if this object has expired, False otherwise.

AddAttachment(name, format, type, internalFormat) → None
Add an attachment to the DrawTarget.

Parameters

name (str) – 
format (GLenum) – 
type (GLenum) – 
internalFormat (GLenum) – 

Bind() → None
Binds the framebuffer.

Unbind() → None
Unbinds the framebuffer.

WriteToFile(name, filename, viewMatrix, projectionMatrix) → bool
Write the Attachment buffer to an image file (debugging).

Parameters

name (str) – 
filename (str) – 
viewMatrix (Matrix4d) – 
projectionMatrix (Matrix4d) – 

property expired
True if this object has expired, False otherwise.

class pxr.Glf.GLQueryObject
Represents a GL query object in Glf
Methods:

Begin(target)
Begin query for the given target target has to be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE, GL_PRIMITIVES_GENERATED GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN GL_TIME_ELAPSED, GL_TIMESTAMP.

BeginPrimitivesGenerated()
equivalent to Begin(GL_PRIMITIVES_GENERATED).

BeginSamplesPassed()
equivalent to Begin(GL_SAMPLES_PASSED).

BeginTimeElapsed()
equivalent to Begin(GL_TIME_ELAPSED).

End()
End query.

GetResult()
Return the query result (synchronous) stalls CPU until the result becomes available.

GetResultNoWait()
Return the query result (asynchronous) returns 0 if the result hasn't been available.

Begin(target) → None
Begin query for the given target target has to be one of
GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED,
GL_ANY_SAMPLES_PASSED_CONSERVATIVE, GL_PRIMITIVES_GENERATED
GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN GL_TIME_ELAPSED,
GL_TIMESTAMP.

Parameters
target (GLenum) – 

BeginPrimitivesGenerated() → None
equivalent to Begin(GL_PRIMITIVES_GENERATED).
The number of primitives sent to the rasterizer by the scoped drawing
command will be returned.

BeginSamplesPassed() → None
equivalent to Begin(GL_SAMPLES_PASSED).
The number of samples that pass the depth test for all drawing
commands within the scope of the query will be returned.

BeginTimeElapsed() → None
equivalent to Begin(GL_TIME_ELAPSED).
The time that it takes for the GPU to execute all of the scoped
commands will be returned in nanoseconds.

End() → None
End query.

GetResult() → int
Return the query result (synchronous) stalls CPU until the result
becomes available.

GetResultNoWait() → int
Return the query result (asynchronous) returns 0 if the result hasn’t
been available.

class pxr.Glf.SimpleLight
Attributes:

ambient
None

attenuation
None

diffuse
None

hasShadow
None

id

isCameraSpaceLight
None

isDomeLight
None

position
None

shadowBias
None

shadowBlur
None

shadowIndexEnd
None

shadowIndexStart
None

shadowMatrices
None

shadowResolution
None

specular
None

spotCutoff
None

spotDirection
None

spotFalloff
None

transform
None

property ambient
None

type : Vec4f

Type
type

property attenuation
None

type : Vec3f

Type
type

property diffuse
None

type : Vec4f

Type
type

property hasShadow
None

Type
type

property id

property isCameraSpaceLight
None

type : bool

Type
type

property isDomeLight
None

type : bool

Type
type

property position
None

type : Vec4f

Type
type

property shadowBias
None

type : float

Type
type

property shadowBlur
None

type : float

Type
type

property shadowIndexEnd
None

type : int

Type
type

property shadowIndexStart
None

type : int

Type
type

property shadowMatrices
None

type : list[Matrix4d]

Type
type

property shadowResolution
None

type : int

Type
type

property specular
None

type : Vec4f

Type
type

property spotCutoff
None

type : float

Type
type

property spotDirection
None

type : Vec3f

Type
type

property spotFalloff
None

type : float

Type
type

property transform
None

type : Matrix4d

Type
type

class pxr.Glf.SimpleMaterial
Attributes:

ambient
None

diffuse
None

emission
None

shininess
None

specular
None

property ambient
None

type : Vec4f

Type
type

property diffuse
None

type : Vec4f

Type
type

property emission
None

type : Vec4f

Type
type

property shininess
None

type : float

Type
type

property specular
None

type : Vec4f

Type
type

class pxr.Glf.Texture
Represents a texture object in Glf.
A texture is typically defined by reading texture image data from an
image file but a texture might also represent an attachment of a draw
target.
Methods:

GetTextureMemoryAllocated
classmethod GetTextureMemoryAllocated() -> int

Attributes:

magFilterSupported
bool

memoryRequested
None

memoryUsed
int

minFilterSupported
bool

static GetTextureMemoryAllocated()
classmethod GetTextureMemoryAllocated() -> int
static reporting function

property magFilterSupported
bool

Type
type

property memoryRequested
None
Specify the amount of memory the user wishes to allocate to the
texture.

type : int
Amount of memory the user wishes to allocate to the texture.

Type
type

property memoryUsed
int
Amount of memory used to store the texture.

Type
type

property minFilterSupported
bool

Type
type

© Copyright 2019-2023, NVIDIA.
      Last updated on Nov 14, 2023.