You Are Here:

Community: Developer Discussion Boards

#1 Old GameCanvas.flushGraphics() - 2004-11-30, 08:28

Join Date: Nov 2004
Posts: 15
ykhun
Offline
Registered User
Hi all,

I have a question (or potential bug report) about the flushGraphics() method of the new GameCanvas.

I'm particularly bewildered by the flushGraphics(int x, int y, int width, int height) method that allows the setting of a region for copying. According to the docs, the following are the definition of the params:

x - the left edge of the region to be flushed
y - the top edge of the region to be flushed
width - the width of the region to be flushed
height - the height of the region to be flushed

I believe the x and y values referred to the region of the off-screen buffer and NOT the display. However, in my case the x and y values seem to refer to the region on the display and not the buffer. Heres the detail explanation.

Imagine i flushed the display to all 0 at the start: (ascii art below)

0000000000
0000000000
0000000000
0000000000

I computed my camera's aspect, checked with the display's dimension and position the clipping region at the center so that the perspective is correct and the display is nicely centered. The clipping region is as shown:

0001111000
0001111000
0001111000
0001111000

Assuming each block is 1 unit, the following is how i setup the clipping for the Graphics3D during each render:

Graphics3D.getInstance().setViewport(4,4,4,4);

I also set the clipping region for the off-screen buffer:

offscrBuffer.setClip(4,4,4,4);

Before rendering the first frame, i filled the entire off-screen buffer with '9', theni render to the clip region of the off-screen buffer and it looks something like this:

9992345999
9992345999
9992345999
9992345999

Ok finally, then i call flushGraphics(4,4,4,4) to flush all the '9's from the off-screen buffer to the display. Instead of getting a nice display, i got the following...

0009992000
0009992000
0009992000
0009992000

As u can see, the (x,y) params in the flushGraphics() call did not flush the correct region of the off-screen buffer to the display. The (x,y) values seem to refer to the "top left" corner of the display and NOT the off-screen display. To show that, i tried call flushGraphics(0,0,4,4). True enough, i got the following:

9992000000
9992000000
9992000000
9992000000


Is this a bug or did i mis-understood something? Have anyone encountered this before?

Oh yes, i forgot to add. I'm using JDK5 and Midp2.0 of course.
System is a intel 2.4GHz and Win2K. I'm using the NetBeans4.2 development environment.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ