Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Dec 2012
Offline Last Active Jun 01 2015 02:11 PM

Topics I've Started

A weird part in my picture when I follow the RasterTek tutorial

26 October 2014 - 07:07 PM

Hi guys:


I've done all steps as RasterTek tutorial 36 said. And I found a weird part in my scene, please look at the picture below:


Attached File  Weird picture.bmp   2.81MB   117 downloads


P.S: Guys how to stick a picture into my topic? I've been uploading a picture as an attachment. : (


Thanks !

Mouse OnClick with explosion effects

21 October 2014 - 08:17 AM

Hi everyone:


I'm doing a effect like when I click in then window somewhere, there will be a explosion effect. But, here is a requirement : When I continually click on different position, the previous explosion effect should not disappear immediately, I mean they should be work on there own life span.


The first of my solution is that I build a render queue and a position queue. However, it doesn't work. Because it cannot render the current mouse position explosion effect when previous explosion effect is still working.


So I tried to create a thread when I click. And I hope each thread could finish one explosion effects. But there must something wrong when I call the Draw() function, because Draw() is also called by gluDisplayFunc(Draw);


Does anyone have solution ? Thank you very much. 

About transform screen coords to OpenGL 3D World

15 October 2014 - 08:34 AM

Hi everyone:


I tried to use the following code for translate screen coordinates to a fixed-z in OpenGL 3D world:

Point3D Get_3D_Pos(int x, int y)
	Point3D glpt;
	GLint viewport[4];   
	GLdouble modelview[16];   
	GLdouble projection[16];   
	GLfloat winX, winY, winZ;   
	GLdouble posX, posY, posZ;
	GLdouble last_posX, last_posY, last_posZ;


	glGetIntegerv(GL_VIEWPORT, viewport);
	glGetDoublev(GL_MODELVIEW_MATRIX, modelview);   
	glGetDoublev(GL_PROJECTION_MATRIX, projection);   

	winX = x;   
	winY = viewport[3] - (float)y;   
	glReadPixels((int)winX, (int)winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);   
	gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
	glpt.x = posX;
	glpt.y = posY;
	glpt.z = posZ;

	return glpt;

What I'm trying to implement is that I want users to click somewhere in the window and the position will show a explosion effects, just like a fireworks, but I need to fix the Z coordinates, and the effects only works on X & Y axis.


Now I think maybe the results of the function above is wrong. See picture below:

Attached File  Wrong position.bmp   2.81MB   97 downloads


The explosion's position is not where I click.


Could you guys give me an idea?

Using GL drawing a special line

10 October 2014 - 05:53 AM

Hello, everyone:


I've googled how to draw a line which like the paint brush, but I'm going to let the line behind gradually disappearing along with the mouse move. Do you guys have some ideas?



What should down sampled texture looks like?

08 October 2014 - 12:34 PM

Hi everybody:


I'm doing the Blur tutorial which is from RasterTek( It seems has been shutdown at present ). I create a little window for seeing if the last stage's (Render To Texture) result is correct. But I even don't know what should be correct for those results? Could you guys have a look on the following pictures and tell me if the result is correct or not?


In the little window, it is the result of down sampled texture

Attached File  DownSampling.bmp   2.81MB   128 downloads


In the little window, it is the result of horizontal blured texture

Attached File  Horizontal.bmp   2.81MB   131 downloads


I'm very curious why the position of the picture in little window is that weird?