I did a simplest working example in C, so the next step is to move it to Lazarus, but this needs translating these .h files included in it or at least fragments of these which are important to this example.No luck yet with the Laz/FPC OpenGL examples either.
Code: Select all
glDrawElements(GL_POINTS,... # or
glDrawElements(GL_LINES,.. # or
glDrawArrays(GL_POINTS, etc.Code: Select all
glPointSize(3.0);
glBegin(GL_POINTS);
glVertex3f(10.0,15.0,0.0);
glEnd();
Code: Select all
Program opengl;
uses
SysUtils,
ctypes,
gl,
Glut;
procedure paint; cdecl;
begin
glClearColor(0.3,0.3,0.3,0.0);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glShadeModel(GL_SMOOTH);
glLoadIdentity();
glTranslatef(-15.0, -15.0, 0.0);
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(0.0, 0.0);
glColor3f(0.0, 1.0, 0.0);
glVertex2f(30.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glVertex2f(0.0, 30.0);
glEnd();
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(10.0, 10.0, 10.0);
glEnd();
glPointSize(13.0);
glBegin(GL_POINTS);
glVertex3f(10.0,15.0,0.0);
glEnd();
glFlush();
end;
procedure reshape(width, height: cint); cdecl;
begin
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0);
glMatrixMode(GL_MODELVIEW);
end;
begin
glutInit(@argc, @argv);
glutInitWindowSize(500, 500);
glutCreateWindow('Demo');
glutDisplayFunc(@paint);
glutReshapeFunc(@reshape);
glutMainLoop();
end.
I know that feeling, thought I had broken Lazarus, uninstall, reinstall - same problem.I've also narrowed the problem down to something I've caused.
Code: Select all
glCullFace(GL_FRONT)OpenGL considers points and lines to be always front facing, though points and lines shouldn't be affected by face culling, they are supposed to be rendered regardless. It sounds like the fragment shader is set to kill fragments that have gl_FrontFacing == true, but if the same code works on an RPi3...paddyg wrote: ↑Sat Jul 20, 2019 7:34 pmHi, found the problem. It was the linewhich I set as standard at the start of pi3d but which seems to stop rendering points and lines only on Raspberry Pi 4 - not sure if it's a feature!Code: Select all
glCullFace(GL_FRONT)
Phew.. now I need to update pi3d and push out the next version.
Paddy
Code: Select all
glFrontFace(GL_CW)
Wonder if we can slow the Pi4 down by using two HDMI and doing stereo 3D.Seems to whiz along on the RPi4
I'm pretty sure the VC6 hardware is OpenGLES not OpenGL which is emulated.I also need to benchmark GL verses GLES. Subjectively there didn't seem any difference but maybe that's because I have restricted pi3d to ES compatible functions