Skip to content
cheese3660 edited this page May 31, 2018 · 9 revisions

CCLights 2 is an Open Source Minecraft mod that adds a GPU peripheral, and monitors to suit your need. Unlike CCGPU, this mod does not use OpenGL, but it is Multiplayer Compatible. Please note; this documentation will always try to stay up to date with the github repo, so it might not fit your build.

Returns Method Name Description
nil gpu.fill() Fills the current binded texture with the GPU color. NOTE: This method will fully replace the contents of the texture.
number: textureID gpu.createTexture(number: width, number: height) Creates a texture and returns the texture id. This function will error if there is no more room for the texture.
number: freeMemory gpu.getFreeMemory() Returns the amount of free memory that the GPU has to use. This can be expanded by right clicking the GPU with RAM.
number: totalMemory gpu.totalMemory() Returns the amount of memory that the GPU has. This can be expanded by right clicking the GPU with RAM.
number: usedMemory gpu.getUsedMemory() Returns the amount of memory that the GPU is using. This value is changed by allocating textures with gpu.createTexture and freeing textures with gpu.freeTexture.
nil gpu.bindTexture(number: textureID) Bind the texture at textureID, this method will error if invalid values are used. Texture 0 is the screen.
nil gpu.plot(number: x, number: y) Sets the pixel on x,y to the the GPU's current color. (Remember, all drawing command work on the current binded texture)
nil gpu.drawTexture(number: textureID, number: x, number: y[, number: startX[, number startY[, number: width[, number: height]]]]) Draws the texture textureID to x and y, and if startX, startY, width, and height is defined, it will render only that area of the texture. (Remember: You can render the texture to itself)
nil gpu.freeTexture(number: textureID) Frees the texture defined by textureID
nil gpu.line(number: x0, number y0, number x1, number, y1 Draws a line from x0 and y0 to x1 and y1.
number: width, number: height gpu.getSize(number: textureID) Returns the texture size of textureid or the current binded texture. Using texture 0 will give you the screen size.
number: red, number: green, number: blue gpu.getPixels(number: x, number: y) Returns the color of the pixel in the currently binded texture. Out of bound pixels have an undefined side effect
nil gpu.rectangle(number: x, number: y, number: width, number: height) Draws the outline of a rectangle from x, y to x+width, y+height
nil gpu.filledRectangle(number: x, number: y, number: width, number: height) Draws a filled rectangle from x, y to x+width, y+height.
nil gpu.setColor(number: red, number: green, number: blue Sets the GPU's current drawing color
number: slot gpu.getBindedTexture() Gets the GPU's currently binded texture
nil gpu.setPixelsRaw(number: width, number: height, number: x, number: y takes an array and writes each pixel to the image. this method is accelerated by java and is faster than multiple gpu.plot calls.
nil gpu.setPixelsRawYX(number: width, number: height, number: x, number: y[, number: red[, number: green[, number blue]]]) takes an array and writes each pixel to the image. this method is accelerated by java and is faster than multiple gpu.plot calls. This method will read in the inverse order of setPixelsRaw (each row is first, not columns)
nil gpu.flipTextureV() flips the texture vertically
number: textureID, number: width, number: height gpu.import(string: filename) decodes an imagefile and makes it ready for texture binding.
table: bytes gpu.export(number: textureID, string: format) >encodes an imagefile and makes it ready for saving.
nil gpu.drawText(string: text, number: x, number: y) writes text from pixel x,y
number: textWidth gpu.getTextWidth() Gets Text Width
nil gpu.setColor(number: red, number: green, number: blue Sets the GPU's current color
number: red, number: green, number: blue gpu.getColor() Gets the GPU's current color
nil gpu.translate(number: x, number: y) translates the texture in two dimensions
nil gpu.rotate(number: degrees) rotates the texture in two dimensions
nil gpu.rotateAround(number: degrees, number: x, number: y) rotates the texture around pixel x,y
nil gpu.scale(number: x-axis size, number: y-axis size) scales the texture to the specs
nil gpu.push store transformation commands from here on and push them to the storestack
nil gpu.pop() process stored transformation input
table: monitor gpu.getMonitor() Get Monitor object
nil gpu.blur(number: blur amount) makes the texture blurry
nil gpu.startFrame() Starts a new frame (use this if you plan to draw large amounts of data)
nil gpu.endFrame() ends the frame (ends the frame and sends the data, use this if you plan to draw large amounts of data)
nil gpu.clearRect(number: x, number: y, number: width, number: height) Clear rectangle entirely to alpha 255
nil gpu.origin() Reset RenderPoint with affline transform
Clone this wiki locally