-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[rlgl] Allow tint colors in GL_LINE
(wires) and GL_POINT
(points) draw modes on OpenGL 1.1
#5177
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
base: master
Are you sure you want to change the base?
[rlgl] Allow tint colors in GL_LINE
(wires) and GL_POINT
(points) draw modes on OpenGL 1.1
#5177
Conversation
src/rmodels.c
Outdated
else rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals); | ||
|
||
rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors); | ||
extern void glGetIntegerv(unsigned int pname, int *data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this is an undesired approach...
src/rlgl.h
Outdated
|
||
void rlSetPointSize(float size) { glPointSize(size); } | ||
|
||
float rlGetPointSize(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not following raylib coding conventions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to have the curly brace conform and added comments the same as Line width (I am basing the change mostly on line width)
@meisei4 I see the issue but the proposed approach should be reviewed. |
updated with a simple null check, even with the wire and points poor solution it didnt solve the fill mode, actual solution is just |
Updating this because actually i falsely assumed i had rebuilt everything correctly. The issue still remains with OpenGL 1.1 even with the The reason in my case is because Line 4422 in 84e2cbc
Line 4490 in 84e2cbc
The workaround is to just set the apologies for the sloppiness, I am still learning, and i imagine there is a more appropriate way than just inserting the opengl context macro into the |
GL_LINE
(wires) and GL_POINT
(points) draw modes on OpenGL 1.1
af115b5
to
705550e
Compare
…ire mode draws, also add rlSetPointSize
} | ||
|
||
// Set the point drawing size | ||
void rlSetPointSize(float size) { glPointSize(size); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid glPointSize()
is not available on OpenGL ES 2.0. Please, could we avoid adding this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that it would be ok, because of the equivalent pattern for WireMode
(and polygon mode in general according to comments i believe) being gated by context macros:
https://github.com/raysan5/raylib/blob/master/src/rlgl.h#L1968
Would it be ok to keep it if we add the appropriate version context checks like with WireMode
?🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we can use same approach
float rlGetPointSize(void) | ||
{ | ||
float size = 0; | ||
glGetFloatv(GL_POINT_SIZE, &size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid GL_POINT_SIZE
is not available on OpenGL ES 2.0. Please, could we avoid adding this function?
Decided to make a PR because the fix was a little more involved than i felt i could show on discord, and i wanted to show more cleanly where in the code im observing the fix behavior.
Issue
In the Opengl 1.1 context the colors array is getting enabled incorrectly during wire and point mode i think
Desired behavior:
DrawModelWires(..., Color tint)
, should draw the wire model with the wires being colored by "tint"Observed Behavior: loading an obj file and setting it to draw the model fill with WHITE and wire frame any color other than WHITE fails.
Workaround: if you nullify the
.colors
field in the mesh before drawing with wires or points, you can set the color in the draw functionthis PR's solution: during
DrawMesh
, find the currentGL_POLYGON_MODE
and from there do not enable theGL_COLOR_ARRAY
if you are in modes ofGL_LINE
orGL_POINT
, this allows for the draw functions tint to apply without the workaround.NOTE: I also added
rlSetPointSize(float size)
(and getter) to allow forglPointSize(size)
, because my eyes could not debug point mode and color well without this feature of increasing point size (its also a feature i would like to have for debugging in opengl1.1)Concerns:
I am wondering if this code change has any consequences outside of what i believe to be normal behavior matching the other opengl modes now.
Images of current behavior (will only draw white wires, even when undesired -- e.g. on top of an also white model fill)

Images of desired behavior (custom point and wire colors over the main model color)
