Difference between revisions of "GPU (API)"

From ComputerCraft Wiki
Jump to: navigation, search
Line 16: Line 16:
  
 
== Render Methods ==
 
== Render Methods ==
''These methods can be used in the render code when set using '''gpu.setRenderCode'''.''
+
''These methods can be used in render code when set using '''gpu.setRenderCode'''.''
 
{| border="1" cellpadding="2" cellspacing="0"
 
{| border="1" cellpadding="2" cellspacing="0"
 
!style="background:#EEE" width="380px"|Method name
 
!style="background:#EEE" width="380px"|Method name
Line 31: Line 31:
 
|-
 
|-
 
|gpuBindOutputBuffer(id)
 
|gpuBindOutputBuffer(id)
 +
|Coming soon
 +
|-
 +
|gpuGetOutputResolution(id)
 +
|Coming soon
 +
|}
 +
 +
== OpenGL Methods ==
 +
''These methods are part of [http://en.wikipedia.org/wiki/OpenGL OpenGL] and can only be used in render code when set using '''gpu.setRenderCode'''.''
 +
{| border="1" cellpadding="2" cellspacing="0"
 +
!style="background:#EEE" width="380px"|Method name
 +
!style="background:#EEE" width="*"|Description
 +
|-
 +
|glBegin(mode)
 +
|Coming soon
 +
|-
 +
|glEnd()
 +
|Coming soon
 +
|-
 +
|glBindTexture(id)
 +
|Coming soon
 +
|-
 +
|glTexCoord2f(x, y)
 +
|Coming soon
 +
|-
 +
|glVertex2f(x, y)
 +
|Coming soon
 +
|-
 +
|glVertex3f(x, y, z)
 +
|Coming soon
 +
|-
 +
|glColor3f(red, green, blue)
 +
|Coming soon
 +
|-
 +
|glColor4f(red, green, blue, alpha)
 +
|Coming soon
 +
|}
 +
 +
== OpenGL Constants ==
 +
''These constants are part of [http://en.wikipedia.org/wiki/OpenGL OpenGL] and can only be used in render code when set using '''gpu.setRenderCode'''.''
 +
{| border="1" cellpadding="2" cellspacing="0"
 +
!style="background:#EEE" width="380px"|Constant name
 +
!style="background:#EEE" width="*"|Description
 +
|-
 +
|GL_QUADS
 +
|Coming soon
 +
|-
 +
|GL_TRIANGLES
 +
|Coming soon
 +
|-
 +
|GL_POINTS
 
|Coming soon
 
|Coming soon
 
|}
 
|}

Revision as of 01:08, 18 March 2012

The GPU api provides interaction with and is part of the CCGPU peripheral.
Arguments surrounded with square brackets are optional.

API Methods

These methods can be used in any ComputerCraft program if the CCGPU api is installed.

Method name Description
gpu.setRenderCode([side], renderCode) Sets the gpu rendering code, this code is ran every frame.

@param side the side the gpu is connected to
@param renderCode the code as a string
@return nil

Render Methods

These methods can be used in render code when set using gpu.setRenderCode.

Method name Description
gpuCreateBuffer(width, height) Coming soon
gpuClearBuffer() Coming soon
gpuBindBuffer(id) Coming soon
gpuBindOutputBuffer(id) Coming soon
gpuGetOutputResolution(id) Coming soon

OpenGL Methods

These methods are part of OpenGL and can only be used in render code when set using gpu.setRenderCode.

Method name Description
glBegin(mode) Coming soon
glEnd() Coming soon
glBindTexture(id) Coming soon
glTexCoord2f(x, y) Coming soon
glVertex2f(x, y) Coming soon
glVertex3f(x, y, z) Coming soon
glColor3f(red, green, blue) Coming soon
glColor4f(red, green, blue, alpha) Coming soon

OpenGL Constants

These constants are part of OpenGL and can only be used in render code when set using gpu.setRenderCode.

Constant name Description
GL_QUADS Coming soon
GL_TRIANGLES Coming soon
GL_POINTS Coming soon