Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap rlgl #19

Open
14 of 17 tasks
planetis-m opened this issue Apr 1, 2022 · 3 comments
Open
14 of 17 tasks

Wrap rlgl #19

planetis-m opened this issue Apr 1, 2022 · 3 comments

Comments

@planetis-m
Copy link
Owner

planetis-m commented Apr 1, 2022

  • rl Prefix needs to go from every function/struct/enum definition.
  • MaxShaderLocations constant taken from rlgl.h needs be imported from raylib.
  • rest of the constants wrapped manually?
  • rlTraceLogLevel, rlPixelFormat, rlTextureFilter, rlBlendMode, rlShaderLocationIndex, rlShaderUniformDataType, ShaderAttributeDataType need to be hidden and the respective enums from raylib imported and re-exported.
  • Wrap rlSetUniform, rlSetVertexAttributeDefault the same way as SetShaderValue.
  • rlLoadExtensions, rlGetShaderLocsDefault, glMultMatrixf, rlLoadVertexBuffer, rlLoadVertexBufferElement, rlUpdateVertexBuffer, rlUpdateVertexBufferElements, rlSetVertexAttribute, rlSetVertexAttributeDefault, rlDrawVertexArrayElements, rlDrawVertexArrayElementsInstanced, rlLoadTexture, rlLoadTextureCubemap, rlUpdateTexture, rlGetGlTextureFormats, rlGenTextureMipmaps, rlReadShaderBufferElements, rlUpdateShaderBufferElements, rlLoadShaderBuffer, rlGenTextureMipmaps, rlReadScreenPixels etc all need manual wrapping
  • returning void pointer rlReadTexturePixels need multiple overloads?
  • rlGetGlTextureFormats, others need out parameters.
  • loader of type rlglLoadProc void *(*rlglLoadProc)(const char *name)
  • rlGetShaderLocsDefault same type as rlSetShader and Shader.locs
  • RenderBatch.draws type is ptr array[RL_DEFAULT_BATCH_DRAWCALLS, DrawCall]
  • RenderBatch.vertexBuffer bounds need to be checked at runtime.
  • VertexBuffer.vertices cast to array[4, Vector3] * bufferElements
  • VertexBuffer.texcoords cast to array[4, Vector2] * bufferElements
  • VertexBuffer.colors cast to array[4, Color] * bufferElements
  • RenderBatch needs a destructor.
  • VertexBuffer needs .error =sink, =copy hooks
@planetis-m
Copy link
Owner Author

planetis-m commented Jan 11, 2023

rlGetPixelFormatName can be rewritten in Nim to avoid allocations when converting to string. But imo looks worthless and for debug. $PixelFormat value does the same thing. Maybe remove it.

Removed for now, but one can make a PR with an overload $ for PixelFormat in raylib.nim.

@planetis-m
Copy link
Owner Author

loadShaderBuffer needs StreamCopy as default parameter

@planetis-m
Copy link
Owner Author

planetis-m commented Mar 15, 2023

rlUpdateShaderBuffer, rlUpdateVertexBuffer, rlUpdateVertexBufferElements, rlReadShaderBuffer can be wrapped since it always calls glBindBuffer before. But for the rest, data is nil can be valid. Not sure how to approach this.

So is rlLoadVertexBuffer, rlLoadVertexBufferElement but not rlLoadShadderBuffer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant