[DEV] add draw triangles
This commit is contained in:
parent
e9541980c0
commit
920ac8cb20
@ -22,7 +22,7 @@ import org.atriasoft.gale.key.KeyType;
|
|||||||
import org.atriasoft.gale.resource.ResourceManager;
|
import org.atriasoft.gale.resource.ResourceManager;
|
||||||
|
|
||||||
interface ActionToDoInAsyncLoop {
|
interface ActionToDoInAsyncLoop {
|
||||||
public void run(GaleContext context);
|
void run(GaleContext context);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ApplicationState {
|
enum ApplicationState {
|
||||||
@ -658,7 +658,7 @@ public abstract class GaleContext {
|
|||||||
// // internal clean elements
|
// // internal clean elements
|
||||||
// //this.objectManager.cleanInternalRemoved();
|
// //this.objectManager.cleanInternalRemoved();
|
||||||
// this.resourceManager.cleanInternalRemoved();
|
// this.resourceManager.cleanInternalRemoved();
|
||||||
//
|
//
|
||||||
// Log.info("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
|
// Log.info("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
|
||||||
// //this.objectManager.displayListObject();
|
// //this.objectManager.displayListObject();
|
||||||
// // Resource is an lower element as objects ...
|
// // Resource is an lower element as objects ...
|
||||||
|
@ -27,7 +27,6 @@ public class ResourceColored3DObject extends Resource {
|
|||||||
private int oGLMatrixView;
|
private int oGLMatrixView;
|
||||||
|
|
||||||
protected ResourceColored3DObject() {
|
protected ResourceColored3DObject() {
|
||||||
super();
|
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
this.oGLPosition = 0;
|
this.oGLPosition = 0;
|
||||||
this.program = ResourceProgram.create(new Uri("DATA", "simple3D.vert", "gale"), new Uri("DATA", "simple3D.frag", "gale"));
|
this.program = ResourceProgram.create(new Uri("DATA", "simple3D.vert", "gale"), new Uri("DATA", "simple3D.frag", "gale"));
|
||||||
@ -86,13 +85,13 @@ public class ResourceColored3DObject extends Resource {
|
|||||||
if (color.a() < 1.0f) {
|
if (color.a() < 1.0f) {
|
||||||
OpenGL.enable(OpenGL.Flag.flag_blend);
|
OpenGL.enable(OpenGL.Flag.flag_blend);
|
||||||
}
|
}
|
||||||
// Request the draw of the elements:
|
// Request the draw of the elements:
|
||||||
OpenGL.drawArrays(OpenGL.RenderMode.TRIANGLE, 0, vertices.size());
|
OpenGL.drawArrays(OpenGL.RenderMode.TRIANGLE, 0, vertices.size());
|
||||||
if (color.a() < 1.0f) {
|
if (color.a() < 1.0f) {
|
||||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||||
}
|
}
|
||||||
this.program.unUse();
|
this.program.unUse();
|
||||||
// Request the draw od the elements:
|
// Request the draw od the elements:
|
||||||
//glDrawArrays(oGLLINES, 0, vertices.size());
|
//glDrawArrays(oGLLINES, 0, vertices.size());
|
||||||
//this.oGLprogram.UnUse();
|
//this.oGLprogram.UnUse();
|
||||||
if (depthtest) {
|
if (depthtest) {
|
||||||
@ -134,7 +133,7 @@ public class ResourceColored3DObject extends Resource {
|
|||||||
if (color.a() < 1.0f) {
|
if (color.a() < 1.0f) {
|
||||||
OpenGL.enable(OpenGL.Flag.flag_blend);
|
OpenGL.enable(OpenGL.Flag.flag_blend);
|
||||||
}
|
}
|
||||||
// Request the draw of the elements:
|
// Request the draw of the elements:
|
||||||
OpenGL.drawArrays(OpenGL.RenderMode.TRIANGLE, 0, vertices.size());
|
OpenGL.drawArrays(OpenGL.RenderMode.TRIANGLE, 0, vertices.size());
|
||||||
if (color.a() < 1.0f) {
|
if (color.a() < 1.0f) {
|
||||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||||
@ -424,7 +423,7 @@ public class ResourceColored3DObject extends Resource {
|
|||||||
if (color.a() < 1.0f) {
|
if (color.a() < 1.0f) {
|
||||||
OpenGL.enable(OpenGL.Flag.flag_blend);
|
OpenGL.enable(OpenGL.Flag.flag_blend);
|
||||||
}
|
}
|
||||||
// Request the draw od the elements:
|
// Request the draw od the elements:
|
||||||
OpenGL.drawArrays(OpenGL.RenderMode.LINE, 0, vertices.size());
|
OpenGL.drawArrays(OpenGL.RenderMode.LINE, 0, vertices.size());
|
||||||
if (color.a() < 1.0f) {
|
if (color.a() < 1.0f) {
|
||||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||||
@ -492,6 +491,15 @@ public class ResourceColored3DObject extends Resource {
|
|||||||
draw(tmpVertices, tmpColor, transformationMatrix, true, true);
|
draw(tmpVertices, tmpColor, transformationMatrix, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawTriangle(final Vector3f p1, final Vector3f p2, final Vector3f p3, final Matrix4f transformationMatrix, final Color tmpColor) {
|
||||||
|
final List<Vector3f> tmpVertices = new ArrayList<>();
|
||||||
|
tmpVertices.add(p1);
|
||||||
|
tmpVertices.add(p2);
|
||||||
|
tmpVertices.add(p3);
|
||||||
|
//Log.info("display " << tmpVertices.size() << " vertices form " << indice.size());
|
||||||
|
draw(tmpVertices, tmpColor, transformationMatrix, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void drawTriangles(final List<Vector3f> vertex, final List<Integer> indice, final Matrix4f transformationMatrix, final Color tmpColor) {
|
public void drawTriangles(final List<Vector3f> vertex, final List<Integer> indice, final Matrix4f transformationMatrix, final Color tmpColor) {
|
||||||
drawTriangles(vertex, indice, transformationMatrix, tmpColor, new Vector3f(0.0f, 0.0f, 0.1f));
|
drawTriangles(vertex, indice, transformationMatrix, tmpColor, new Vector3f(0.0f, 0.0f, 0.1f));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user