Sorry but I just don't get it.

Started by hytparadisee, May 03, 2007, 09:23:14 AM

Previous topic - Next topic

hytparadisee

I read like tons of posts and just can't figure out how do I get a AWTGLCanvas which i can put this canvas into a Frame, and which renders using hardware (the AWTGL refer to the car bench program: mt_opengl.bat). And more importantly, how do i paint the canvas? I can get the canvas from enableGLCanvasRenderer() but apart from that i dunno what to do? And i try to paint using Frame.display(graphics, x, y) but im sure that is software way of rendering, so what about hardware? I dun need detailed explanation of the concept of GL, Software and AWT GL because i should by now understand them from all the posts. Just don't know how to make it work.
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution


hytparadisee

#2
I already tried the way you mentioned in that post. But I got an all black screen in the canvas. And that's all. To make things clearer, the canvas is not totally black, i see some pixels blinking in red on the left, but im sure that's not the actually thing rendered.
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

Melssj5

ok if you got a black screen that means that the canvas is being shown but the content is not being rendered or there are not any light source.

first. Be sure to add enough light sources.

second. Be sure to hav ethe Camera positioned and aimed to be able to see the Object3d. If the cam is inside the object3D you wont see it.

third. dont use Frame.display(graphics, x, y) because you need to render in OpenGL and that renders on software rendering, so the outpput wont be on your AWTGLCanvas.

There is a small example I did a year ago when I was using jpct. Is just a JFrame with an AWTGLCanvas which renders a car. The example can be found on the download section and its called car. I am not sure if the bat file will run on your PC beucasse I am not expert at oing jars so you need to add the dll on the system32 folder, but the code is there and its working fine. Check it.
Nada por ahora

hytparadisee

Things are getting stranger. The screen is actually not totally black, i see some very small areas get rendered by rubbish pixels, and from the console I got something like this:

Expanding command queue to 2000 entries!
Expanding command queue to 3000 entries!
Expanding command queue to 4000 entries!
Expanding command queue to 5000 entries!
Expanding command queue to 6000 entries!
Expanding command queue to 7000 entries!
Expanding command queue to 8000 entries!

I'm afraid im in need of some code snippets to help me.

Regarding Melssj5's car program, i will take a look at the source. But from what i ran i think the app still runs on software rendering (cos i can feel the difference between software and GL, it is just not as smooth as the AWTGLCanvas on the car bench test program). Does your car program have any args to switch to the AWT GL mode?

Thanks All

YUN TAO
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

Mr.Marbles

Make sure you force a repaint on your canvas after the buffer update, like this:


moveObjects();
moveCamera();

buffer.clear();
theWorld.renderScene(buffer);
buffer.update();

glCanvas.repaint();

Melssj5

I dont remember, I guess you should check the lights and the camera position first. About my car program, I dont really remember it. Anyway there is another called model3d or something like that, It for sure uses AWTGLCanvas becausse I made it to show Opngel on the University. But that code is a bit messy.
Nada por ahora

hytparadisee

OK, i'll take a look into that. Right now i still haven't solved it.
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

hytparadisee

Thanks Melssj5 and Mr. Marbles. Problem Solved!

What I do is the following (from the source of Model3D), Just in case if someone as stupid as me met this problem ;D.

1. Setup a SAMPLINGMODE_HARDWARE_ONLY FrameBuffer
2. Disable software renderer
3. Enable and obtain the AWTGLCanvas
4. Add it to the container
5. In the rendering loop:
        5.1 clear the buffer
        5.2 update the buffer
        5.3 render world scene to buffer
        5.4 draw the world to buffer
        5.5 render buffer to GL (displayGLOnly())
        5.6 repaint canvas

The steps in red are what I missed.

Thanks again Melssj5 and Mr. Marbles.
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

EgonOlsen

Quote from: hytparadisee on May 04, 2007, 02:59:54 AM
        5.5 render buffer to GL (displayGLOnly())
        5.6 repaint canvas
Those two are the most important ones. While the latter may not always be required depending on how your application works, the former one is. If you omit it, the command queue will increase in size over and over and nothing will be rendered (as you've already noticed...).