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

oGLfbGFX - Added full openGL 2D render for fbGFX #40

Merged
merged 3 commits into from Sep 21, 2017

Conversation

Projects
None yet
2 participants
@ImortisInglorian
Copy link
Contributor

ImortisInglorian commented Sep 15, 2017

See forum post: http://www.freebasic.net/forum/viewtopic.php?f=17&t=25902

To enable 2d rendering when Flip is called:
screencontrol 150,1

To enable automatic 2d rendering:
screencontrol 150,2

To set a zoom factor of 2:
screencontrol 151,2

Then use the openGL mode on the screen command you your choice.

Examples will be included if this gets excepted into the base.

@countingpine countingpine requested review from dkl and removed request for dkl Sep 19, 2017

@dkl

This comment has been minimized.

Copy link
Collaborator

dkl commented Sep 19, 2017

In general I like the idea, and it should be safe too, since as far as I can see, the non-OpenGL graphics mode is not affected.

FB_GL __fb_gl;
FB_GL_PARAMS __fb_gl_params = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
FB_GL_PARAMS __fb_gl_params = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL };
GLfloat texcoords[8];

This comment has been minimized.

Copy link
@dkl

dkl Sep 20, 2017

Collaborator

About the module-level variables here: They should either be static, or maybe even be part of the __fb_gl context struct (unless that doesn't make sense).

__fb_gl.TexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, 0);
}

GLfloat ratio_w=(GLfloat)__fb_gfx->w/w, ratio_h=(GLfloat)__fb_gfx->h/h;

This comment has been minimized.

Copy link
@dkl

dkl Sep 20, 2017

Collaborator

It would be nice to use formatting rules like most of rtlib/gfxlib2 code. There should be more spaces, for example:

GLfloat ratio_w = (GLfloat)__fb_gfx->w / w;
GLfloat ratio_h = (GLfloat)__fb_gfx->h / h;

or above:

- switch(__fb_gfx->depth){
+ switch (__fb_gfx->depth) {
@@ -50,7 +68,20 @@ typedef struct FB_GL {
GLGENTEXTURES GenTextures;
GLDELETETEXTURES DeleteTextures;
GLBINDTEXTURE BindTexture;
GLTEXPARAMETERI TexParameter;

This comment has been minimized.

Copy link
@dkl

dkl Sep 20, 2017

Collaborator

Since this field is used for glTexParameteri, it should probably have an i appended.

GLPUSHCLIENTATTRIB PushClientAttrib;
GLPOPCLIENTATTRIB PopClientAttrib;
GLPIXELTRANSFERI PixelTransferi;
GLPIXELMAP PixelMap;

This comment has been minimized.

Copy link
@dkl

dkl Sep 20, 2017

Collaborator

This field is used for glPixelMapfv, so I think it should be named PixelMapfv (just for better consistency).

oGLfbGFX - Conform to formatting standards, mark vars as static and f…
…ixed bug with widths that are not a multiple of 4.
@dkl

dkl approved these changes Sep 21, 2017

@dkl dkl merged commit 30cb0ca into freebasic:master Sep 21, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.