PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Open GL ES,Updating of data on the screen

Greetings how me to update data in display-> buffer? I have written the small block:
Code:

display->Perspective3D(display->GetWidth(), display->GetHeight());

glClear (GL_COLOR_BUFFER_BIT);

glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.f, 0.f, -30.f);
glRotatef ((float)(effectTime*29.77f), 1.0f, 2.0f, 0.0f);
glRotatef ((float)(effectTime*22.311f), -0.1f, 0.0f, -5.0f);

glVertexPointer (3, GL_BYTE, 0, s_cubeVertices);
glNormalPointer (GL_BYTE, 0, s_cubeNormals);
glTexCoordPointer (2, GL_BYTE, 0, s_cubeTexCoords);

glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
glDrawArrays (GL_TRIANGLE_STRIP, 4, 4);
glDrawArrays (GL_TRIANGLE_STRIP, 8, 4);
glDrawArrays (GL_TRIANGLE_STRIP, 12, 4);
glDrawArrays (GL_TRIANGLE_STRIP, 16, 4);
glDrawArrays (GL_TRIANGLE_STRIP, 20, 4);

display->Perspective2D(display->GetWidth(), display->GetHeight(), false);
display->DrawFont(2, 2, &display-;>fontinternal, GetFPS());

and on the screen nothing occurs? (the black screen)
Hi Relo,

The problem could have two causes:
- The faces don't point towards the camera and are culled
- The coordinates are too small, they should be in the range of -2048 to 2048.

Alternatively, you may want to set your vertices and other data to an E3DSurface object. Use E3DSurface::Lock to gain direct access to the internal data structure to easily copy your vertex arrays. Make sure to use the EST_NOINTERLEAVE flag when creating your surface for easier data access.
Hi Edge!
Code:
#define EGL_USEGLES
#include "GLES\\gl.h"
#include "GLES\\egl.h"
#pragma comment(lib,"libEGL.lib")
#pragma comment(lib,"libGLES_CM_NoE.lib")
#include "edgemain.h"
#include <stdio.h>
#pragma comment(lib, "edge.lib")
.................
.................
.................
ERESULT ClassMain::OnNextFrame(ClassEDisplay *display, unsigned long timedelta)
{
cube.Reset();
cube.Translate(-1024, 0, 0);
cube.Scale(20000, 20000, 20000);
cube.Rotate(yr, xr, 0);
xr+=10;
yr+=1;
display->Perspective3D(display->GetWidth(), display->GetHeight());
glDisable(GL_LIGHTING);
glClearColorx(0, 19968, 38912, 65536);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

display->Perspective3D(display->GetWidth(), display->GetHeight());
display->WorldReset();
display->WorldTranslate(0, 0, -6000);
display->WorldScale(65536 * 2, 65536 * 2, 65536 * 2);

display->SetShading(E3D_GOURAUD);//E3D_GOURAUD

display->Render(&cube);
display->Perspective2D(display->GetWidth(), display->GetHeight(), false);
display->SetShading(E3D_TEXTURE);//E3D_GOURAUD
display->DrawFont(2, 2, &display->fontinternal, GetFPS());
return(E_OK);
}

ERESULT ClassMain::OnDisplayInit(ENATIVETYPE instance, ClassEDisplay *display)
{
display->UseLight(0);
display->SetLightSource(0, 4096, 4096, -4096, ECOLOR_WHITE);
................
................
}


I use library rasteroid. At start on a handheld computer and the emulator, a background black (i.e. glClearColorx (0, 19968, 38912, 65536); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - does not work)
when have included light:
a command glDisable (GL_LIGHTING); - does not work. On a black background a square with use of a light source.

On the personal computer works perfectly. (there is no light, the background dark blue).
if to replace #define EGL_USEGLES on #define EGL_USEGL

In what there can be a problem?
Hi Relo,

It's odd that the background is black instead of blue. Do you also have that problem when installing the rasteroid version of the View3D sample?

To disable lighting you need to call glDisable(GL_LIGHTNING) and change the OpenGL texture mode:

Code:

glDisable(GL_LIGHTNING);
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
Hi Edge!
Do you also have that problem when installing the rasteroid version of the View3D sample?

yes.

If I add #define EGL_USEGL. That at compilation are mistakes:
error LNK2019: unresolved external symbol "unsigned long __cdecl EdgeGL_GenTexture(void *)" (?EdgeGL_GenTexture@@YAKPAX@Z)



Here a small block from an example view3D

Code:
//Fill the screen with a nice blue color
#if defined(EGL_USEGL)
#if defined(EGL_USEGLES)
glClearColorx(0, 19968, 38912, 65536);
#else
glClearColor(0, 0.3f, 0.6f, 1);
#endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#else
display->buffer.FillRect(NULL, E_RGBX(0, 78, 152));
#endif


i.e. apparently should be certain EGL_USEGL & EGL_USEGLES for
glClearColorx(0, 19968, 38912, 65536);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


But at instruction #define EGL_USEGL, the compiler gives out mistakes:
Code:
1 error LNK2019: unresolved external symbol "unsigned long __cdecl EdgeGL_GenTexture(void *)" (?EdgeGL_GenTexture@@YAKPAX@Z)
2 error LNK2019: unresolved external symbol "void __cdecl EdgeGL_DeleteTexture(void *,unsigned long)" (?EdgeGL_DeleteTexture@@YAXPAXK@Z)
3 error LNK2019: unresolved external symbol "long __cdecl EdgeGL_UpdateTextureData(...)" (?EdgeGL_UpdateTextureData@@YAJPAXKKKPAUtagRECT@@EE0_N@Z)
4 error LNK2019: unresolved external symbol "unsigned char __cdecl EdgeGL_GetVideoType(void *)" (?EdgeGL_GetVideoType@@YAEPAX@Z)
5 error LNK2019: unresolved external symbol "long __cdecl EdgeGL_Open(...)" (?EdgeGL_Open@@YAJPAX0EKK_N@Z)
6 error LNK2019: unresolved external symbol "bool __cdecl EdgeGL_FixedPoint(void)" (?EdgeGL_FixedPoint@@YA_NXZ)
7 error LNK2019: unresolved external symbol "void * __cdecl EdgeGL_NewDriver(void)" (?EdgeGL_NewDriver@@YAPAXXZ)
.................
......................
............................
If to add these lines :
Code:
#define EGL_USEGL
#pragma comment(lib, "plugin1-0.lib")

that all it is compiled and works, but fps falls with 60 up to 8!!!!
In what there can be a problem??
Hi Relo,

The FPS drop is because you're using a software OpenGL renderer instead of the EDGELIB internal renderer. The main reason for it to be slower than the EDGELIB internal renderer is because its using a Z-Buffer.

Can you tell me on which device you're testing on?